diff --git a/puppet/zulip/files/nagios_plugins/zulip_postgresql/check_postgresql_replication_lag b/puppet/zulip/files/nagios_plugins/zulip_postgresql/check_postgresql_replication_lag index a91354eef2..7a98c726e6 100755 --- a/puppet/zulip/files/nagios_plugins/zulip_postgresql/check_postgresql_replication_lag +++ b/puppet/zulip/files/nagios_plugins/zulip_postgresql/check_postgresql_replication_lag @@ -63,7 +63,7 @@ def run_sql_query(query: str) -> List[List[str]]: return [] return [x.split("\0") for x in output.split("\n")] except subprocess.CalledProcessError as e: - report("CRITICAL", f"psql failed: {str(e)}: {e.output}") + report("CRITICAL", f"psql failed: {e}: {e.output}") sys.exit(MAXSTATE) diff --git a/zerver/data_import/slack.py b/zerver/data_import/slack.py index 1643c85bbf..6995581eb5 100644 --- a/zerver/data_import/slack.py +++ b/zerver/data_import/slack.py @@ -370,7 +370,7 @@ def build_customprofile_field( if field in slack_custom_fields: field_name = field else: - field_name = f"Slack custom field {str(custom_profile_field_id + 1)}" + field_name = f"Slack custom field {custom_profile_field_id + 1}" customprofilefield = CustomProfileField( id=custom_profile_field_id, name=field_name, diff --git a/zerver/lib/avatar_hash.py b/zerver/lib/avatar_hash.py index 491b7ea074..9ace9d1096 100644 --- a/zerver/lib/avatar_hash.py +++ b/zerver/lib/avatar_hash.py @@ -35,7 +35,7 @@ def user_avatar_path(user_profile: UserProfile) -> str: def user_avatar_path_from_ids(user_profile_id: int, realm_id: int) -> str: user_id_hash = user_avatar_hash(str(user_profile_id)) - return f"{str(realm_id)}/{user_id_hash}" + return f"{realm_id}/{user_id_hash}" def user_avatar_content_hash(ldap_avatar: bytes) -> str: diff --git a/zerver/lib/test_classes.py b/zerver/lib/test_classes.py index ac8db8d7a1..6470e6c82d 100644 --- a/zerver/lib/test_classes.py +++ b/zerver/lib/test_classes.py @@ -1171,7 +1171,7 @@ Output: for item in items: print(item) print(f"\nexpected length: {count}\nactual length: {actual_count}") - raise AssertionError(f"{str(type(items))} is of unexpected size!") + raise AssertionError(f"{type(items)} is of unexpected size!") @contextmanager def assert_database_query_count( diff --git a/zerver/openapi/openapi.py b/zerver/openapi/openapi.py index cac83d1a9f..53a88b9269 100644 --- a/zerver/openapi/openapi.py +++ b/zerver/openapi/openapi.py @@ -558,5 +558,5 @@ See https://zulip.readthedocs.io/en/latest/documentation/api.html for help. The errors logged by the OpenAPI validator are below:\n""" for error in errors: - msg += f"* {str(error)}\n" + msg += f"* {error}\n" raise SchemaError(msg) diff --git a/zerver/tests/test_push_notifications.py b/zerver/tests/test_push_notifications.py index ccbf94bf05..4d1eae0591 100644 --- a/zerver/tests/test_push_notifications.py +++ b/zerver/tests/test_push_notifications.py @@ -1028,14 +1028,14 @@ class HandlePushNotificationTest(PushNotificationTest): views_logger.output, [ "INFO:zilencer.views:" - f"Sending mobile push notifications for remote user 6cde5f7a-1f7e-4978-9716-49f69ebfc9fe:: " + f"Sending mobile push notifications for remote user 6cde5f7a-1f7e-4978-9716-49f69ebfc9fe:: " f"{len(gcm_devices)} via FCM devices, {len(apns_devices)} via APNs devices" ], ) for _, _, token in apns_devices: self.assertIn( "INFO:zerver.lib.push_notifications:" - f"APNs: Success sending for user to device {token}", + f"APNs: Success sending for user to device {token}", pn_logger.output, ) for _, _, token in gcm_devices: @@ -1089,7 +1089,7 @@ class HandlePushNotificationTest(PushNotificationTest): views_logger.output, [ "INFO:zilencer.views:" - f"Sending mobile push notifications for remote user 6cde5f7a-1f7e-4978-9716-49f69ebfc9fe:: " + f"Sending mobile push notifications for remote user 6cde5f7a-1f7e-4978-9716-49f69ebfc9fe:: " f"{len(gcm_devices)} via FCM devices, {len(apns_devices)} via APNs devices" ], )