mirror of https://github.com/zulip/zulip.git
ruff: Fix FLY002 Consider f"…" instead of string join.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
c3fe96af52
commit
55aa29bef4
|
@ -102,6 +102,7 @@ select = [
|
|||
"E", # style errors
|
||||
"EXE", # shebang
|
||||
"F", # flakes
|
||||
"FLY", # string formatting
|
||||
"G", # logging format
|
||||
"I", # import sorting
|
||||
"INT", # gettext
|
||||
|
|
|
@ -58,7 +58,7 @@ def build_for_dev_server(host: str, port: str, minify: bool, disable_host_check:
|
|||
if disable_host_check:
|
||||
webpack_args.append("--allowed-hosts=all")
|
||||
else:
|
||||
webpack_args.append("--allowed-hosts=" + ",".join([host, ".zulipdev.com", ".zulipdev.org"]))
|
||||
webpack_args.append(f"--allowed-hosts={host},.zulipdev.com,.zulipdev.org")
|
||||
|
||||
# Tell webpack-dev-server to fall back to periodic polling on
|
||||
# filesystems where inotify is known to be broken.
|
||||
|
|
|
@ -347,7 +347,7 @@ def has_request_variables(
|
|||
|
||||
post_params = []
|
||||
|
||||
view_func_full_name = ".".join([req_func.__module__, req_func.__name__])
|
||||
view_func_full_name = f"{req_func.__module__}.{req_func.__name__}"
|
||||
|
||||
for name, value in zip(default_param_names, default_param_values):
|
||||
if isinstance(value, _REQ):
|
||||
|
|
|
@ -236,7 +236,7 @@ class LocalUploadBackend(ZulipUploadBackend):
|
|||
)
|
||||
|
||||
image_data = emoji_file.read()
|
||||
write_local_file("avatars", ".".join((emoji_path, "original")), image_data)
|
||||
write_local_file("avatars", f"{emoji_path}.original", image_data)
|
||||
resized_image_data, is_animated, still_image_data = resize_emoji(image_data)
|
||||
write_local_file("avatars", emoji_path, resized_image_data)
|
||||
if is_animated:
|
||||
|
|
|
@ -456,7 +456,7 @@ class S3UploadBackend(ZulipUploadBackend):
|
|||
image_data = emoji_file.read()
|
||||
upload_image_to_s3(
|
||||
self.avatar_bucket,
|
||||
".".join((emoji_path, "original")),
|
||||
f"{emoji_path}.original",
|
||||
content_type,
|
||||
user_profile,
|
||||
image_data,
|
||||
|
|
|
@ -82,7 +82,7 @@ def get_uploader() -> Uploader:
|
|||
|
||||
def get_emoji_file_name(emoji_file_name: str, new_name: str) -> str:
|
||||
_, image_ext = os.path.splitext(emoji_file_name)
|
||||
return "".join((new_name, image_ext))
|
||||
return f"{new_name}{image_ext}"
|
||||
|
||||
|
||||
def migrate_realm_emoji_image_files(
|
||||
|
|
|
@ -556,7 +556,7 @@ class InviteUserTest(InviteUserBase):
|
|||
|
||||
cross_realm_bot_email = "emailgateway@zulip.com"
|
||||
legit_new_email = "fred@zulip.com"
|
||||
invitee_emails = ",".join([cross_realm_bot_email, legit_new_email])
|
||||
invitee_emails = f"{cross_realm_bot_email},{legit_new_email}"
|
||||
|
||||
result = self.invite(invitee_emails, ["Denmark"])
|
||||
self.assert_json_error(
|
||||
|
|
|
@ -326,11 +326,8 @@ class NarrowBuilderTest(ZulipTestCase):
|
|||
)
|
||||
|
||||
def test_add_term_using_dm_operator_and_self_and_user_as_operand(self) -> None:
|
||||
myself_and_other = ",".join(
|
||||
[
|
||||
self.example_user("hamlet").email,
|
||||
self.example_user("othello").email,
|
||||
]
|
||||
myself_and_other = (
|
||||
f"{self.example_user('hamlet').email},{self.example_user('othello').email}"
|
||||
)
|
||||
term = dict(operator="dm", operand=myself_and_other)
|
||||
self._do_add_term_test(
|
||||
|
@ -339,23 +336,15 @@ class NarrowBuilderTest(ZulipTestCase):
|
|||
)
|
||||
|
||||
def test_add_term_using_dm_operator_more_than_one_user_as_operand(self) -> None:
|
||||
two_others = ",".join(
|
||||
[
|
||||
self.example_user("cordelia").email,
|
||||
self.example_user("othello").email,
|
||||
]
|
||||
)
|
||||
two_others = f"{self.example_user('cordelia').email},{self.example_user('othello').email}"
|
||||
term = dict(operator="dm", operand=two_others)
|
||||
self._do_add_term_test(term, "WHERE recipient_id = %(recipient_id_1)s")
|
||||
|
||||
def test_add_term_using_dm_operator_self_and_user_as_operand_and_negated(
|
||||
self,
|
||||
) -> None: # NEGATED
|
||||
myself_and_other = ",".join(
|
||||
[
|
||||
self.example_user("hamlet").email,
|
||||
self.example_user("othello").email,
|
||||
]
|
||||
myself_and_other = (
|
||||
f"{self.example_user('hamlet').email},{self.example_user('othello').email}"
|
||||
)
|
||||
term = dict(operator="dm", operand=myself_and_other, negated=True)
|
||||
self._do_add_term_test(
|
||||
|
@ -366,12 +355,7 @@ class NarrowBuilderTest(ZulipTestCase):
|
|||
def test_add_term_using_dm_operator_more_than_one_user_as_operand_and_negated(
|
||||
self,
|
||||
) -> None: # NEGATED
|
||||
two_others = ",".join(
|
||||
[
|
||||
self.example_user("cordelia").email,
|
||||
self.example_user("othello").email,
|
||||
]
|
||||
)
|
||||
two_others = f"{self.example_user('cordelia').email},{self.example_user('othello').email}"
|
||||
term = dict(operator="dm", operand=two_others, negated=True)
|
||||
self._do_add_term_test(term, "WHERE recipient_id != %(recipient_id_1)s")
|
||||
|
||||
|
|
Loading…
Reference in New Issue