ruff: Fix RUF010 Use conversion in f-string.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2023-05-26 17:30:33 -07:00 committed by Tim Abbott
parent 0c09a4fffe
commit 9797de52a0
6 changed files with 8 additions and 8 deletions

View File

@ -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)

View File

@ -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,

View File

@ -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:

View File

@ -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(

View File

@ -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)

View File

@ -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:<id:{str(self.user_profile.id)}><uuid:{str(self.user_profile.uuid)}>: "
f"Sending mobile push notifications for remote user 6cde5f7a-1f7e-4978-9716-49f69ebfc9fe:<id:{self.user_profile.id}><uuid:{self.user_profile.uuid}>: "
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 <id:{str(self.user_profile.id)}><uuid:{str(self.user_profile.uuid)}> to device {token}",
f"APNs: Success sending for user <id:{self.user_profile.id}><uuid:{self.user_profile.uuid}> 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:<id:{str(self.user_profile.id)}><uuid:{str(self.user_profile.uuid)}>: "
f"Sending mobile push notifications for remote user 6cde5f7a-1f7e-4978-9716-49f69ebfc9fe:<id:{self.user_profile.id}><uuid:{self.user_profile.uuid}>: "
f"{len(gcm_devices)} via FCM devices, {len(apns_devices)} via APNs devices"
],
)