mirror of https://github.com/zulip/zulip.git
ruff: Fix RUF005 Consider spread instead of concatenation.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
91b22cb1af
commit
4eda29bd86
|
@ -109,7 +109,7 @@ if aux_services:
|
|||
if (
|
||||
action == "restart"
|
||||
and len(
|
||||
list_supervisor_processes(workers + ["zulip-django", "zulip-tornado:*"], only_running=True)
|
||||
list_supervisor_processes([*workers, "zulip-django", "zulip-tornado:*"], only_running=True)
|
||||
)
|
||||
== 0
|
||||
):
|
||||
|
|
|
@ -361,7 +361,7 @@ if __name__ == "__main__":
|
|||
my_token=api_token,
|
||||
template_id=template_id,
|
||||
name=droplet_domain_name,
|
||||
tags=args.tags + ["dev"],
|
||||
tags=[*args.tags, "dev"],
|
||||
user_data=user_data,
|
||||
region=args.region,
|
||||
)
|
||||
|
|
|
@ -9,7 +9,7 @@ zulip_git_version_file = os.path.join(
|
|||
lines = [ZULIP_VERSION, ""]
|
||||
if os.path.exists(zulip_git_version_file):
|
||||
with open(zulip_git_version_file) as f:
|
||||
lines = f.readlines() + ["", ""]
|
||||
lines = [*f, "", ""]
|
||||
ZULIP_VERSION = lines.pop(0).strip()
|
||||
ZULIP_MERGE_BASE = lines.pop(0).strip()
|
||||
|
||||
|
|
|
@ -867,7 +867,7 @@ def do_send_messages(
|
|||
# this results in the sender receiving the message first if
|
||||
# there are thousands of recipients, decreasing perceived latency.
|
||||
if sender_id in user_ids:
|
||||
user_list = [sender_id] + list(user_ids - {sender_id})
|
||||
user_list = [sender_id, *user_ids - {sender_id}]
|
||||
else:
|
||||
user_list = list(user_ids)
|
||||
|
||||
|
|
|
@ -261,7 +261,7 @@ def event_dict_type(
|
|||
assert "type" in rkeys
|
||||
assert "id" not in keys
|
||||
return DictType(
|
||||
required_keys=list(required_keys) + [("id", int)],
|
||||
required_keys=[*required_keys, ("id", int)],
|
||||
optional_keys=optional_keys,
|
||||
)
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ html_safelisted_schemes = (
|
|||
"wtai",
|
||||
"xmpp",
|
||||
)
|
||||
allowed_schemes = ("http", "https", "ftp", "file") + html_safelisted_schemes
|
||||
allowed_schemes = ("http", "https", "ftp", "file", *html_safelisted_schemes)
|
||||
|
||||
|
||||
def one_time(method: Callable[[], ReturnT]) -> Callable[[], ReturnT]:
|
||||
|
|
|
@ -54,7 +54,7 @@ class APIReturnValuesTablePreprocessor(Preprocessor):
|
|||
else:
|
||||
text = self.render_table(return_values, 0)
|
||||
if len(text) > 0:
|
||||
text = ["#### Return values"] + text
|
||||
text = ["#### Return values", *text]
|
||||
line_split = REGEXP.split(line, maxsplit=0)
|
||||
preceding = line_split[0]
|
||||
following = line_split[-1]
|
||||
|
|
|
@ -141,7 +141,7 @@ def render_python_code_example(
|
|||
endpoint, endpoint_method = function.split(":")
|
||||
extra_imports = check_additional_imports(endpoint, endpoint_method)
|
||||
if extra_imports:
|
||||
extra_imports = sorted(extra_imports + ["zulip"])
|
||||
extra_imports = sorted([*extra_imports, "zulip"])
|
||||
extra_imports = [f"import {each_import}" for each_import in extra_imports]
|
||||
config_string = config_string.replace("import zulip", "\n".join(extra_imports))
|
||||
|
||||
|
|
|
@ -713,7 +713,7 @@ class TestRealmAuditLog(ZulipTestCase):
|
|||
allow_subdomains=False,
|
||||
)
|
||||
expected_extra_data = {
|
||||
"realm_domains": initial_domains + [added_domain],
|
||||
"realm_domains": [*initial_domains, added_domain],
|
||||
"added_domain": added_domain,
|
||||
}
|
||||
self.assertEqual(
|
||||
|
@ -734,7 +734,7 @@ class TestRealmAuditLog(ZulipTestCase):
|
|||
allow_subdomains=True,
|
||||
)
|
||||
expected_extra_data = {
|
||||
"realm_domains": initial_domains + [changed_domain],
|
||||
"realm_domains": [*initial_domains, changed_domain],
|
||||
"changed_domain": changed_domain,
|
||||
}
|
||||
self.assertEqual(
|
||||
|
@ -787,7 +787,7 @@ class TestRealmAuditLog(ZulipTestCase):
|
|||
url_prefix="https://python.example.com",
|
||||
)
|
||||
expected_extra_data = {
|
||||
"realm_playgrounds": initial_playgrounds + [added_playground],
|
||||
"realm_playgrounds": [*initial_playgrounds, added_playground],
|
||||
"added_playground": added_playground,
|
||||
}
|
||||
self.assertEqual(
|
||||
|
@ -845,7 +845,7 @@ class TestRealmAuditLog(ZulipTestCase):
|
|||
id=linkifier_id,
|
||||
)
|
||||
expected_extra_data = {
|
||||
"realm_linkifiers": initial_linkifiers + [added_linkfier],
|
||||
"realm_linkifiers": [*initial_linkifiers, added_linkfier],
|
||||
"added_linkifier": added_linkfier,
|
||||
}
|
||||
self.assertEqual(
|
||||
|
@ -873,7 +873,7 @@ class TestRealmAuditLog(ZulipTestCase):
|
|||
id=linkifier_id,
|
||||
)
|
||||
expected_extra_data = {
|
||||
"realm_linkifiers": initial_linkifiers + [changed_linkifier],
|
||||
"realm_linkifiers": [*initial_linkifiers, changed_linkifier],
|
||||
"changed_linkifier": changed_linkifier,
|
||||
}
|
||||
self.assertEqual(
|
||||
|
|
|
@ -308,8 +308,9 @@ class HomeTest(ZulipTestCase):
|
|||
|
||||
page_params = self._get_page_params(result)
|
||||
actual_keys = sorted(str(k) for k in page_params)
|
||||
expected_keys = self.expected_page_params_keys + [
|
||||
"demo_organization_scheduled_deletion_date"
|
||||
expected_keys = [
|
||||
*self.expected_page_params_keys,
|
||||
"demo_organization_scheduled_deletion_date",
|
||||
]
|
||||
|
||||
self.assertEqual(set(actual_keys), set(expected_keys))
|
||||
|
|
Loading…
Reference in New Issue