Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
python: Replace list literal concatenation with * unpacking.
Anders Kaseorg1ded51aa9d2c
diff --git a/analytics/tests/test_views.py b/analytics/tests/test_views.pyindex 6376e5d46b8..f1067d64e0f 100644--- a/analytics/tests/test_views.py+++ b/analytics/tests/test_views.py@@ -302,7 +302,7 @@ class TestGetChartData(ZulipTestCase):data = result.json()end_times = [ceiling_to_day(self.realm.date_created) + timedelta(days=i) for i in range(-1, 4)]self.assertEqual(data['end_times'], [datetime_to_timestamp(dt) for dt in end_times])- self.assertEqual(data['everyone'], {'_1day': [0]+self.data(100), '_15day': [0]+self.data(100), 'all_time': [0]+self.data(100)})+ self.assertEqual(data['everyone'], {'_1day': [0, *self.data(100)], '_15day': [0, *self.data(100)], 'all_time': [0, *self.data(100)]})def test_non_existent_chart(self) -> None:result = self.client_get('/json/analytics/chart_data',diff --git a/scripts/lib/create-production-venv b/scripts/lib/create-production-venvindex 16c27a4a13e..969ead5f9c2 100755--- a/scripts/lib/create-production-venv+++ b/scripts/lib/create-production-venv@@ -20,9 +20,9 @@ vendor = distro_info['ID']os_version = distro_info['VERSION_ID']VENV_DEPENDENCIES = get_venv_dependencies(vendor, os_version)if "debian" in os_families():- run(["apt-get", "-y", "install"] + VENV_DEPENDENCIES)+ run(["apt-get", "-y", "install", *VENV_DEPENDENCIES])elif "fedora" in os_families():- run(["yum", "-y", "install"] + VENV_DEPENDENCIES)+ run(["yum", "-y", "install", *VENV_DEPENDENCIES])else:print("Unsupported platform: {}".format(distro_info['ID']))sys.exit(1)diff --git a/scripts/lib/create-thumbor-venv b/scripts/lib/create-thumbor-venvindex 45cf5c6e7df..d9b9ba29f42 100755--- a/scripts/lib/create-thumbor-venv+++ b/scripts/lib/create-thumbor-venv@@ -21,9 +21,9 @@ args = parser.parse_args()# install dependencies for setting up the virtualenvdistro_info = parse_os_release()if "debian" in os_families():- run(["apt-get", "-y", "install"] + THUMBOR_VENV_DEPENDENCIES)+ run(["apt-get", "-y", "install", *THUMBOR_VENV_DEPENDENCIES])elif "fedora" in os_families():- run(["yum", "-y", "install"] + YUM_THUMBOR_VENV_DEPENDENCIES)+ run(["yum", "-y", "install", *YUM_THUMBOR_VENV_DEPENDENCIES])else:print("Unsupported platform: {}".format(distro_info['ID']))sys.exit(1)diff --git a/scripts/lib/node_cache.py b/scripts/lib/node_cache.pyindex c2d086e9bd2..8a568b19ff2 100644--- a/scripts/lib/node_cache.py+++ b/scripts/lib/node_cache.py@@ -83,7 +83,7 @@ def do_yarn_install(shutil.copytree("node_modules/", cached_node_modules, symlinks=True)if os.environ.get('CUSTOM_CA_CERTIFICATES'):run([YARN_BIN, "config", "set", "cafile", os.environ['CUSTOM_CA_CERTIFICATES']])- run([YARN_BIN, "install", "--non-interactive", "--frozen-lockfile"] + yarn_args,+ run([YARN_BIN, "install", "--non-interactive", "--frozen-lockfile", *yarn_args],cwd=target_path)with open(success_stamp, 'w'):passdiff --git a/scripts/lib/setup_venv.py b/scripts/lib/setup_venv.pyindex 330e3339058..62776f2b6af 100644--- a/scripts/lib/setup_venv.py+++ b/scripts/lib/setup_venv.py@@ -59,12 +59,14 @@ COMMON_YUM_VENV_DEPENDENCIES = ["jq",]-REDHAT_VENV_DEPENDENCIES = COMMON_YUM_VENV_DEPENDENCIES + [+REDHAT_VENV_DEPENDENCIES = [+ *COMMON_YUM_VENV_DEPENDENCIES,"python36-devel","python-virtualenv",]-FEDORA_VENV_DEPENDENCIES = COMMON_YUM_VENV_DEPENDENCIES + [+FEDORA_VENV_DEPENDENCIES = [+ *COMMON_YUM_VENV_DEPENDENCIES,"python3-pip","virtualenv", # see https://unix.stackexchange.com/questions/27877/install-virtualenv-on-fedora-16]diff --git a/scripts/lib/upgrade-zulip b/scripts/lib/upgrade-zulipindex 5a1105ea192..1d8fc5c3790 100755--- a/scripts/lib/upgrade-zulip+++ b/scripts/lib/upgrade-zulip@@ -65,7 +65,7 @@ try:# version is much better for fixing bugs in the upgrade process).deploy_path = deploy_path.strip()os.chdir(deploy_path)- subprocess.check_call([os.path.abspath("./scripts/lib/upgrade-zulip-stage-2"), deploy_path]- + deploy_options)+ subprocess.check_call([os.path.abspath("./scripts/lib/upgrade-zulip-stage-2"), deploy_path,+ *deploy_options])finally:release_deployment_lock()diff --git a/scripts/lib/upgrade-zulip-from-git b/scripts/lib/upgrade-zulip-from-gitindex a91ebb8db2b..cfb4fe3c7ce 100755--- a/scripts/lib/upgrade-zulip-from-git+++ b/scripts/lib/upgrade-zulip-from-git@@ -78,6 +78,6 @@ try:overwrite_symlink(deploy_path, os.path.join(DEPLOYMENTS_DIR, "next"))subprocess.check_call([os.path.join(deploy_path, "scripts", "lib", "upgrade-zulip-stage-2"),- deploy_path, "--from-git"] + deploy_options)+ deploy_path, "--from-git", *deploy_options])finally:release_deployment_lock()diff --git a/scripts/lib/upgrade-zulip-stage-2 b/scripts/lib/upgrade-zulip-stage-2index 746e2c6c98a..0a6bb52630c 100755--- a/scripts/lib/upgrade-zulip-stage-2+++ b/scripts/lib/upgrade-zulip-stage-2@@ -104,7 +104,7 @@ def shutdown_server() -> None:core_server_services.append("zulip-thumbor")logging.info("Stopping Zulip...")- subprocess.check_call(["supervisorctl", "stop"] + core_server_services + worker_services,+ subprocess.check_call(["supervisorctl", "stop", *core_server_services, *worker_services],preexec_fn=su_to_zulip)IS_SERVER_UP = Falsediff --git a/scripts/lib/zulip_tools.py b/scripts/lib/zulip_tools.pyindex 05a2dc2473c..d333201731b 100755--- a/scripts/lib/zulip_tools.py+++ b/scripts/lib/zulip_tools.py@@ -460,7 +460,7 @@ def is_root() -> bool:def run_as_root(args: List[str], **kwargs: Any) -> None:sudo_args = kwargs.pop('sudo_args', [])if not is_root():- args = ['sudo'] + sudo_args + ['--'] + args+ args = ['sudo', *sudo_args, '--', *args]run(args, **kwargs)def assert_not_running_as_root() -> None:diff --git a/scripts/purge-old-deployments b/scripts/purge-old-deploymentsindex 36ab43efc97..674aad82889 100755--- a/scripts/purge-old-deployments+++ b/scripts/purge-old-deployments@@ -62,7 +62,7 @@ def main() -> None:print("Cleaning orphaned/unused caches...")# Call 'clean-unused-caches' script to clean any orphaned/unused caches.- subprocess.check_call([os.path.join(ZULIP_PATH, "scripts/lib/clean-unused-caches")] + sys.argv[1:])+ subprocess.check_call([os.path.join(ZULIP_PATH, "scripts/lib/clean-unused-caches"), *sys.argv[1:]])print("Done!")if __name__ == "__main__":diff --git a/scripts/restart-server b/scripts/restart-serverindex 8553b4fc601..d0937e14cef 100755--- a/scripts/restart-server+++ b/scripts/restart-server@@ -75,10 +75,10 @@ else:logging.info("Stopping workers")subprocess.check_call(["supervisorctl", "stop", "zulip-workers:*"])logging.info("Stopping server core")-subprocess.check_call(["supervisorctl", "stop"] + core_server_services)+subprocess.check_call(["supervisorctl", "stop", *core_server_services])logging.info("Starting server core")-subprocess.check_call(["supervisorctl", "start"] + core_server_services)+subprocess.check_call(["supervisorctl", "start", *core_server_services])logging.info("Starting workers")subprocess.check_call(["supervisorctl", "start", "zulip-workers:*"])diff --git a/scripts/setup/restore-backup b/scripts/setup/restore-backupindex f4bc0096207..e07c7488e5a 100755--- a/scripts/setup/restore-backup+++ b/scripts/setup/restore-backup@@ -75,7 +75,7 @@ def restore_backup(tarball_file: IO[bytes]) -> None:os.mkdir(os.path.join(tmp, "zulip-backup"))tarball_file.seek(0, 0)- run(["tar", "-C", tmp] + transform_args + ["-xPz"], stdin=tarball_file)+ run(["tar", "-C", tmp, *transform_args, "-xPz"], stdin=tarball_file)# Now, extract the the database backup, destroy the old# database, and create a new, empty database.diff --git a/scripts/zulip-puppet-apply b/scripts/zulip-puppet-applyindex 60442b64173..289feaf5eee 100755--- a/scripts/zulip-puppet-apply+++ b/scripts/zulip-puppet-apply@@ -50,7 +50,7 @@ if (distro_info['ID'], distro_info['VERSION_ID']) in [('ubuntu', '20.04')]:puppet_env["RUBYOPT"] = "-W0"if not args.noop and not args.force:- subprocess.check_call(puppet_cmd + ['--noop', '--show_diff'], env=puppet_env)+ subprocess.check_call([*puppet_cmd, '--noop', '--show_diff'], env=puppet_env)do_apply = Nonewhile do_apply != 'y':@@ -60,7 +60,7 @@ if not args.noop and not args.force:if do_apply == '' or do_apply == 'n':sys.exit(0)-ret = subprocess.call(puppet_cmd + ['--detailed-exitcodes'], env=puppet_env)+ret = subprocess.call([*puppet_cmd, '--detailed-exitcodes'], env=puppet_env)# ret = 0 => no changes, no errors# ret = 2 => changes, no errors# ret = 4 => no changes, yes errorsdiff --git a/tools/lib/html_branches.py b/tools/lib/html_branches.pyindex 3e5eb760759..226865ba4a6 100644--- a/tools/lib/html_branches.py+++ b/tools/lib/html_branches.py@@ -66,10 +66,11 @@ class TagInfo:self.classes = classesself.ids = idsself.token = token- self.words = \- [self.tag] + \- ['.' + s for s in classes] + \- ['#' + s for s in ids]+ self.words = [+ self.tag,+ *('.' + s for s in classes),+ *('#' + s for s in ids),+ ]def text(self) -> str:s = self.tagdiff --git a/tools/lib/provision.py b/tools/lib/provision.pyindex e9fec428bd4..2b4d08feba7 100755--- a/tools/lib/provision.py+++ b/tools/lib/provision.py@@ -145,64 +145,68 @@ COMMON_DEPENDENCIES = [# Puppeteer dependencies end here.]-UBUNTU_COMMON_APT_DEPENDENCIES = COMMON_DEPENDENCIES + [+UBUNTU_COMMON_APT_DEPENDENCIES = [+ *COMMON_DEPENDENCIES,"redis-server","hunspell-en-us","puppet-lint","netcat", # Used for flushing memcached"default-jre-headless", # Required by vnu-jar-] + THUMBOR_VENV_DEPENDENCIES+ *THUMBOR_VENV_DEPENDENCIES,+]-COMMON_YUM_DEPENDENCIES = COMMON_DEPENDENCIES + [+COMMON_YUM_DEPENDENCIES = [+ *COMMON_DEPENDENCIES,"redis","hunspell-en-US","rubygem-puppet-lint","nmap-ncat",-] + YUM_THUMBOR_VENV_DEPENDENCIES+ *YUM_THUMBOR_VENV_DEPENDENCIES,+]BUILD_PGROONGA_FROM_SOURCE = Falseif vendor == 'debian' and os_version in [] or vendor == 'ubuntu' and os_version in []:# For platforms without a pgroonga release, we need to build it# from source.BUILD_PGROONGA_FROM_SOURCE = True- SYSTEM_DEPENDENCIES = UBUNTU_COMMON_APT_DEPENDENCIES + [- pkg.format(POSTGRES_VERSION) for pkg in [- "postgresql-{0}",- # Dependency for building pgroonga from source- "postgresql-server-dev-{0}",- "libgroonga-dev",- "libmsgpack-dev",- "clang-9",- "llvm-9-dev",- ]- ] + VENV_DEPENDENCIES+ SYSTEM_DEPENDENCIES = [+ *UBUNTU_COMMON_APT_DEPENDENCIES,+ "postgresql-{0}".format(POSTGRES_VERSION),+ # Dependency for building pgroonga from source+ "postgresql-server-dev-{0}".format(POSTGRES_VERSION),+ "libgroonga-dev",+ "libmsgpack-dev",+ "clang-9",+ "llvm-9-dev",+ *VENV_DEPENDENCIES,+ ]elif "debian" in os_families():- SYSTEM_DEPENDENCIES = UBUNTU_COMMON_APT_DEPENDENCIES + [- pkg.format(POSTGRES_VERSION) for pkg in [- "postgresql-{0}",- "postgresql-{0}-pgroonga",- ]- ] + VENV_DEPENDENCIES+ SYSTEM_DEPENDENCIES = [+ *UBUNTU_COMMON_APT_DEPENDENCIES,+ "postgresql-{0}".format(POSTGRES_VERSION),+ "postgresql-{0}-pgroonga".format(POSTGRES_VERSION),+ *VENV_DEPENDENCIES,+ ]elif "rhel" in os_families():- SYSTEM_DEPENDENCIES = COMMON_YUM_DEPENDENCIES + [- pkg.format(POSTGRES_VERSION) for pkg in [- "postgresql{0}-server",- "postgresql{0}",- "postgresql{0}-devel",- "postgresql{0}-pgroonga",- ]- ] + VENV_DEPENDENCIES+ SYSTEM_DEPENDENCIES = [+ *COMMON_YUM_DEPENDENCIES,+ "postgresql{0}-server".format(POSTGRES_VERSION),+ "postgresql{0}".format(POSTGRES_VERSION),+ "postgresql{0}-devel".format(POSTGRES_VERSION),+ "postgresql{0}-pgroonga".format(POSTGRES_VERSION),+ *VENV_DEPENDENCIES,+ ]elif "fedora" in os_families():- SYSTEM_DEPENDENCIES = COMMON_YUM_DEPENDENCIES + [- pkg.format(POSTGRES_VERSION) for pkg in [- "postgresql{0}-server",- "postgresql{0}",- "postgresql{0}-devel",- # Needed to build pgroonga from source- "groonga-devel",- "msgpack-devel",- ]- ] + VENV_DEPENDENCIES+ SYSTEM_DEPENDENCIES = [+ *COMMON_YUM_DEPENDENCIES,+ "postgresql{0}-server".format(POSTGRES_VERSION),+ "postgresql{0}".format(POSTGRES_VERSION),+ "postgresql{0}-devel".format(POSTGRES_VERSION),+ # Needed to build pgroonga from source+ "groonga-devel",+ "msgpack-devel",+ *VENV_DEPENDENCIES,+ ]BUILD_PGROONGA_FROM_SOURCE = Trueif "fedora" in os_families():@@ -247,9 +251,8 @@ def install_apt_deps(deps_to_install: List[str]) -> None:run_as_root(["env", "DEBIAN_FRONTEND=noninteractive",- "apt-get", "-y", "install", "--no-install-recommends",+ "apt-get", "-y", "install", "--no-install-recommends", *deps_to_install,]- + deps_to_install,)def install_yum_deps(deps_to_install: List[str]) -> None:@@ -274,7 +277,7 @@ def install_yum_deps(deps_to_install: List[str]) -> None:else:print("Unrecognized output. `subscription-manager` might not be available")- run_as_root(["yum", "install", "-y"] + yum_extra_flags + deps_to_install)+ run_as_root(["yum", "install", "-y", *yum_extra_flags, *deps_to_install])if "rhel" in os_families():# This is how a pip3 is installed to /usr/bin in CentOS/RHEL# for python35 and later.@@ -363,7 +366,7 @@ def main(options: argparse.Namespace) -> "NoReturn":"https_proxy=" + os.environ.get("https_proxy", ""),"no_proxy=" + os.environ.get("no_proxy", ""),]- run_as_root(proxy_env + ["scripts/lib/install-node"], sudo_args = ['-H'])+ run_as_root([*proxy_env, "scripts/lib/install-node"], sudo_args = ['-H'])if not os.access(NODE_MODULES_CACHE_PATH, os.W_OK):run_as_root(["mkdir", "-p", NODE_MODULES_CACHE_PATH])diff --git a/tools/lint b/tools/lintindex 0f9dfcf6cc8..6f2aef5a9da 100755--- a/tools/lint+++ b/tools/lint@@ -61,7 +61,7 @@ def run() -> None:description="Runs the puppet parser validator, ""checking for syntax errors.")linter_config.external_linter('puppet-lint',- ['puppet-lint', '--fail-on-warnings'] + PUPPET_CHECK_RULES_TO_EXCLUDE,+ ['puppet-lint', '--fail-on-warnings', *PUPPET_CHECK_RULES_TO_EXCLUDE],['pp'],fix_arg='--fix',description="Standard puppet linter"diff --git a/tools/linter_lib/custom_check.py b/tools/linter_lib/custom_check.pyindex 4cfac2f88dc..72dd11a951d 100644--- a/tools/linter_lib/custom_check.py+++ b/tools/linter_lib/custom_check.py@@ -75,7 +75,8 @@ comma_whitespace_rule: List["Rule"] = ['good_lines': ['foo(1, 2, 3)', 'foo = bar # some inline comment'],'bad_lines': ['foo(1, 2, 3)', 'foo(1, 2, 3)']},]-markdown_whitespace_rules = list([rule for rule in whitespace_rules if rule['pattern'] != r'\s+$']) + [+markdown_whitespace_rules: List["Rule"] = [+ *(rule for rule in whitespace_rules if rule['pattern'] != r'\s+$'),# Two spaces trailing a line with other content is okay--it's a Markdown line break.# This rule finds one space trailing a non-space, three or more trailing spaces, and# spaces on an empty line.@@ -246,7 +247,7 @@ python_rules = RuleList('exclude': {'scripts/lib/setup_venv.py'},'exclude_line': {('scripts/lib/zulip_tools.py', 'sudo_args = kwargs.pop(\'sudo_args\', [])'),- ('scripts/lib/zulip_tools.py', 'args = [\'sudo\'] + sudo_args + [\'--\'] + args'),+ ('scripts/lib/zulip_tools.py', 'args = [\'sudo\', *sudo_args, \'--\', *args]'),},'description': 'Most scripts are intended to run on systems without sudo.','good_lines': ['subprocess.check_call(["ls"])'],@@ -442,7 +443,9 @@ prose_style_rules: List["Rule"] = ['description': "Use Botserver instead of botserver or bot server."},*comma_whitespace_rule,]-html_rules: List["Rule"] = whitespace_rules + prose_style_rules + [+html_rules: List["Rule"] = [+ *whitespace_rules,+ *prose_style_rules,{'pattern': 'subject|SUBJECT','exclude': {'templates/zerver/email.html'},'exclude_pattern': 'email subject',@@ -578,7 +581,8 @@ html_rules: List["Rule"] = whitespace_rules + prose_style_rules + [handlebars_rules = RuleList(langs=['hbs'],- rules=html_rules + [+ rules=[+ *html_rules,{'pattern': "[<]script",'description': "Do not use inline <script> tags here; put JavaScript in static/js instead."},{'pattern': '{{ t ("|\')',@@ -600,7 +604,8 @@ handlebars_rules = RuleList(jinja2_rules = RuleList(langs=['html'],- rules=html_rules + [+ rules=[+ *html_rules,{'pattern': r"{% endtrans %}[\.\?!]",'description': "Period should be part of the translatable string."},{'pattern': r"{{ _(.+) }}[\.\?!]",@@ -653,7 +658,9 @@ markdown_docs_length_exclude = {markdown_rules = RuleList(langs=['md'],- rules=markdown_whitespace_rules + prose_style_rules + [+ rules=[+ *markdown_whitespace_rules,+ *prose_style_rules,{'pattern': r'\[(?P<url>[^\]]+)\]\((?P=url)\)','description': 'Linkified Markdown URLs should use cleaner <http://example.com> syntax.'},{'pattern': 'https://zulip.readthedocs.io/en/latest/[a-zA-Z0-9]',diff --git a/tools/run-dev.py b/tools/run-dev.pyindex 2563c673234..46946d65ca6 100755--- a/tools/run-dev.py+++ b/tools/run-dev.py@@ -135,10 +135,10 @@ with open(pid_file_path, 'w+') as f:def server_processes() -> List[List[str]]:main_cmds = [- ['./manage.py', 'runserver'] +- manage_args + runserver_args + [f'127.0.0.1:{django_port}'],- ['env', 'PYTHONUNBUFFERED=1', './manage.py', 'runtornado'] +- manage_args + [f'127.0.0.1:{tornado_port}'],+ ['./manage.py', 'runserver',+ *manage_args, *runserver_args, f'127.0.0.1:{django_port}'],+ ['env', 'PYTHONUNBUFFERED=1', './manage.py', 'runtornado',+ *manage_args, f'127.0.0.1:{tornado_port}'],]if options.streamlined:@@ -147,7 +147,7 @@ def server_processes() -> List[List[str]]:return main_cmdsother_cmds = [- ['./manage.py', 'process_queue', '--all'] + manage_args,+ ['./manage.py', 'process_queue', '--all', *manage_args],['env', 'PGHOST=127.0.0.1', # Force password authentication using .pgpass'./puppet/zulip/files/postgresql/process_fts_updates', '--quiet'],['./manage.py', 'deliver_scheduled_messages'],diff --git a/tools/run-mypy b/tools/run-mypyindex e72148591b2..a4c33f06cb1 100755--- a/tools/run-mypy+++ b/tools/run-mypy@@ -70,8 +70,8 @@ if not python_files and not pyi_files:mypy_args: List[str] = []if args.quiet:mypy_args += ["--no-error-summary"]-mypy_args += ["--"] + python_files + pyi_files-rc = subprocess.call([mypy_command] + mypy_args)+mypy_args += ["--", *python_files, *pyi_files]+rc = subprocess.call([mypy_command, *mypy_args])if rc != 0:print("")diff --git a/tools/setup/emoji/import_emoji_names_from_csv b/tools/setup/emoji/import_emoji_names_from_csvindex cface499c66..3f9cf386265 100755--- a/tools/setup/emoji/import_emoji_names_from_csv+++ b/tools/setup/emoji/import_emoji_names_from_csv@@ -56,7 +56,7 @@ def check_valid_emoji_name(emoji_name: str) -> None:def check_emoji_names(canonical_name: str, aliases: List[str]) -> None:if canonical_name == 'X':return- names_to_check = [canonical_name] + aliases+ names_to_check = [canonical_name, *aliases]for name in names_to_check:check_valid_emoji_name(name)check_uniqueness(name)diff --git a/tools/test-help-documentation b/tools/test-help-documentationindex e0bb8aa4dc0..138de54ac50 100755--- a/tools/test-help-documentation+++ b/tools/test-help-documentation@@ -55,14 +55,14 @@ def vnu_servlet() -> Iterator[None]:with vnu_servlet(), \test_server_running(options.force, external_host, log_file=LOG_FILE,dots=True, use_db=True):- ret_help_doc = subprocess.call(['scrapy', 'crawl_with_status'] + extra_args +- ['help_documentation_crawler'],+ ret_help_doc = subprocess.call(['scrapy', 'crawl_with_status', *extra_args,+ 'help_documentation_crawler'],cwd='tools/documentation_crawler')- ret_api_doc = subprocess.call(['scrapy', 'crawl_with_status'] + extra_args +- ['api_documentation_crawler'],+ ret_api_doc = subprocess.call(['scrapy', 'crawl_with_status', *extra_args,+ 'api_documentation_crawler'],cwd='tools/documentation_crawler')- ret_portico_doc = subprocess.call(['scrapy', 'crawl_with_status'] + extra_args +- ['portico_documentation_crawler'],+ ret_portico_doc = subprocess.call(['scrapy', 'crawl_with_status', *extra_args,+ 'portico_documentation_crawler'],cwd='tools/documentation_crawler')if ret_help_doc != 0 or ret_api_doc != 0 or ret_portico_doc != 0:diff --git a/tools/test-js-with-puppeteer b/tools/test-js-with-puppeteerindex bd2904bc61c..79e2e5e0757 100755--- a/tools/test-js-with-puppeteer+++ b/tools/test-js-with-puppeteer@@ -64,7 +64,7 @@ def run_tests(files: Iterable[str], external_host: str) -> None:current_test_num = test_numberfor test_file in test_files[test_number:]:test_name = os.path.basename(test_file)- cmd = ["node"] + [test_file]+ cmd = ["node", test_file]print("\n\n===================== {}\nRunning {}\n\n".format(test_name, " ".join(map(shlex.quote, cmd))), flush=True)ret = subprocess.call(cmd)if ret != 0:diff --git a/tools/test-locked-requirements b/tools/test-locked-requirementsindex 1708c4dad64..e98b7eb99a1 100755--- a/tools/test-locked-requirements+++ b/tools/test-locked-requirements@@ -97,7 +97,7 @@ def main() -> None:# Cache the hash so that we need not to run the `update_locked_requirements`# tool again for checking this set of requirements.valid_hash = get_requirements_hash(tmp_dir, use_test_lock_files=True)- update_cache([h for h in hash_list if h != valid_hash] + [valid_hash])+ update_cache([*(h for h in hash_list if h != valid_hash), valid_hash])if not requirements_are_consistent:for test_locked_file in glob.glob(os.path.join(tmp_dir, "*.txt")):fn = os.path.basename(test_locked_file)diff --git a/zerver/lib/event_schema.py b/zerver/lib/event_schema.pyindex f3832808fb9..f34b24d4f19 100644--- a/zerver/lib/event_schema.py+++ b/zerver/lib/event_schema.py@@ -80,7 +80,7 @@ def check_events_dict(assert "type" in rkeysassert "id" not in keysreturn check_dict_only(- required_keys=list(required_keys) + [("id", check_int)],+ required_keys=[*required_keys, ("id", check_int)],optional_keys=optional_keys,)diff --git a/zerver/lib/export.py b/zerver/lib/export.pyindex 3ee74f2158f..6f9515e9952 100644--- a/zerver/lib/export.py+++ b/zerver/lib/export.py@@ -1466,7 +1466,7 @@ def do_write_stats_file_for_realm_export(output_dir: Path) -> None:attachment_file = os.path.join(output_dir, 'attachment.json')analytics_file = os.path.join(output_dir, 'analytics.json')message_files = glob.glob(os.path.join(output_dir, 'messages-*.json'))- fns = sorted([analytics_file] + [attachment_file] + message_files + [realm_file])+ fns = sorted([analytics_file, attachment_file, *message_files, realm_file])logging.info('Writing stats file: %s\n', stats_file)with open(stats_file, 'w') as f:diff --git a/zerver/lib/markdown/api_arguments_table_generator.py b/zerver/lib/markdown/api_arguments_table_generator.pyindex 40eede60dae..4c0852755ed 100644--- a/zerver/lib/markdown/api_arguments_table_generator.py+++ b/zerver/lib/markdown/api_arguments_table_generator.py@@ -80,7 +80,7 @@ class APIArgumentsTablePreprocessor(Preprocessor):line_split = REGEXP.split(line, maxsplit=0)preceding = line_split[0]following = line_split[-1]- text = [preceding] + text + [following]+ text = [preceding, *text, following]lines = lines[:loc] + text + lines[loc+1:]breakelse:diff --git a/zerver/lib/markdown/api_return_values_table_generator.py b/zerver/lib/markdown/api_return_values_table_generator.pyindex 4fc3128886a..d244c42054f 100644--- a/zerver/lib/markdown/api_return_values_table_generator.py+++ b/zerver/lib/markdown/api_return_values_table_generator.py@@ -52,7 +52,7 @@ class APIReturnValuesTablePreprocessor(Preprocessor):line_split = REGEXP.split(line, maxsplit=0)preceding = line_split[0]following = line_split[-1]- text = [preceding] + text + [following]+ text = [preceding, *text, following]lines = lines[:loc] + text + lines[loc+1:]breakelse:diff --git a/zerver/lib/markdown/help_relative_links.py b/zerver/lib/markdown/help_relative_links.pyindex e8937211478..a7f159e9574 100644--- a/zerver/lib/markdown/help_relative_links.py+++ b/zerver/lib/markdown/help_relative_links.py@@ -95,7 +95,7 @@ class RelativeLinks(Preprocessor):line_split = REGEXP.split(line, maxsplit=0)preceding = line_split[0]following = line_split[-1]- text = [preceding] + text + [following]+ text = [preceding, *text, following]lines = lines[:loc] + text + lines[loc+1:]breakelse:diff --git a/zerver/lib/markdown/help_settings_links.py b/zerver/lib/markdown/help_settings_links.pyindex b08404c8de7..85056f61660 100644--- a/zerver/lib/markdown/help_settings_links.py+++ b/zerver/lib/markdown/help_settings_links.py@@ -91,7 +91,7 @@ class Setting(Preprocessor):line_split = REGEXP.split(line, maxsplit=0)preceding = line_split[0]following = line_split[-1]- text = [preceding] + text + [following]+ text = [preceding, *text, following]lines = lines[:loc] + text + lines[loc+1:]breakelse:diff --git a/zerver/lib/markdown/tabbed_sections.py b/zerver/lib/markdown/tabbed_sections.pyindex 2e2dde741c2..e20f9951895 100644--- a/zerver/lib/markdown/tabbed_sections.py+++ b/zerver/lib/markdown/tabbed_sections.py@@ -103,7 +103,7 @@ class TabbedSectionsPreprocessor(Preprocessor):start = tab_section['start_tabs_index']end = tab_section['end_tabs_index'] + 1- lines = lines[:start] + [rendered_tabs] + lines[end:]+ lines = [*lines[:start], rendered_tabs, *lines[end:]]tab_section = self.parse_tabs(lines)return linesdiff --git a/zerver/lib/test_fixtures.py b/zerver/lib/test_fixtures.pyindex 8d918aa0c53..923c390a4f1 100644--- a/zerver/lib/test_fixtures.py+++ b/zerver/lib/test_fixtures.py@@ -100,12 +100,12 @@ class Database:'ZULIP_DB_NAME=' + self.database_name,]- run(env_prelude + [- './manage.py', 'migrate', '--no-input',+ run([+ *env_prelude, './manage.py', 'migrate', '--no-input',])- run(env_prelude + [- './manage.py', 'get_migration_status', '--output='+self.migration_status_file,+ run([+ *env_prelude, './manage.py', 'get_migration_status', '--output='+self.migration_status_file,])def what_to_do_with_migrations(self) -> str:diff --git a/zerver/lib/test_helpers.py b/zerver/lib/test_helpers.pyindex f5ce6372734..cff551e5b5c 100644--- a/zerver/lib/test_helpers.py+++ b/zerver/lib/test_helpers.py@@ -416,7 +416,7 @@ def write_instrumentation_reports(full_suite: bool, include_webhooks: bool) -> Nassert len(pattern_cnt) > 100untested_patterns = {p.replace("\\", "") for p in pattern_cnt if pattern_cnt[p] == 0}- exempt_patterns = set([+ exempt_patterns = {# We exempt some patterns that are called via Tornado.'api/v1/events','api/v1/events/internal',@@ -429,7 +429,8 @@ def write_instrumentation_reports(full_suite: bool, include_webhooks: bool) -> N'docs/(?P<path>.+)','casper/(?P<path>.+)','static/(?P<path>.*)',- ] + [webhook.url for webhook in WEBHOOK_INTEGRATIONS if not include_webhooks])+ *(webhook.url for webhook in WEBHOOK_INTEGRATIONS if not include_webhooks),+ }untested_patterns -= exempt_patternsdiff --git a/zerver/lib/topic_mutes.py b/zerver/lib/topic_mutes.pyindex 7898c5cdb69..2e98365321f 100644--- a/zerver/lib/topic_mutes.py+++ b/zerver/lib/topic_mutes.py@@ -103,7 +103,7 @@ def exclude_topic_mutes(conditions: List[Selectable],return and_(stream_cond, topic_cond)condition = not_(or_(*list(map(mute_cond, rows))))- return conditions + [condition]+ return [*conditions, condition]def build_topic_mute_checker(user_profile: UserProfile) -> Callable[[int, str], bool]:rows = MutedTopic.objects.filter(diff --git a/zerver/lib/users.py b/zerver/lib/users.pyindex b219ec7d36d..540e6ddd333 100644--- a/zerver/lib/users.py+++ b/zerver/lib/users.py@@ -394,7 +394,7 @@ def user_profile_to_user_row(user_profile: UserProfile) -> Dict[str, Any]:# changing realm_user_dict_fields to name the bot owner with# the less readable `bot_owner` (instead of `bot_owner_id`).user_row = model_to_dict(user_profile,- fields=realm_user_dict_fields + ['bot_owner'])+ fields=[*realm_user_dict_fields, 'bot_owner'])user_row['bot_owner_id'] = user_row['bot_owner']del user_row['bot_owner']return user_rowdiff --git a/zerver/management/commands/backup.py b/zerver/management/commands/backup.pyindex bc97f9e5a70..d9272e3a850 100644--- a/zerver/management/commands/backup.py+++ b/zerver/management/commands/backup.py@@ -117,10 +117,10 @@ class Command(ZulipBaseCommand):tarball_path = options["output"]run(- ["tar", "-C", tmp, "-cPzf", tarball_path]- + transform_args- + ["--"]- + members,+ ["tar", "-C", tmp, "-cPzf", tarball_path,+ *transform_args,+ "--",+ *members])print(f"Backup tarball written to {tarball_path}")except BaseException:diff --git a/zerver/openapi/markdown_extension.py b/zerver/openapi/markdown_extension.pyindex 467c2b8cc6f..c5ea1629474 100644--- a/zerver/openapi/markdown_extension.py+++ b/zerver/openapi/markdown_extension.py@@ -249,8 +249,8 @@ def generate_curl_example(endpoint: str, method: str,format_dict[param["name"]] = example_valueexample_endpoint = endpoint.format_map(format_dict)- curl_first_line_parts = ["curl"] + curl_method_arguments(example_endpoint, method,- api_url)+ curl_first_line_parts = ["curl", *curl_method_arguments(example_endpoint, method,+ api_url)]lines.append(" ".join(curl_first_line_parts))insecure_operations = ['/dev_fetch_api_key:post']@@ -386,7 +386,7 @@ class APICodeExamplesPreprocessor(Preprocessor):line_split = MACRO_REGEXP.split(line, maxsplit=0)preceding = line_split[0]following = line_split[-1]- text = [preceding] + text + [following]+ text = [preceding, *text, following]lines = lines[:loc] + text + lines[loc+1:]breakelse:@@ -429,7 +429,7 @@ class APIDescriptionPreprocessor(Preprocessor):line_split = MACRO_REGEXP_DESC.split(line, maxsplit=0)preceding = line_split[0]following = line_split[-1]- text = [preceding] + text + [following]+ text = [preceding, *text, following]lines = lines[:loc] + text + lines[loc+1:]breakelse:diff --git a/zerver/templatetags/app_filters.py b/zerver/templatetags/app_filters.pyindex b44f8d56581..dced2b0550e 100644--- a/zerver/templatetags/app_filters.py+++ b/zerver/templatetags/app_filters.py@@ -124,11 +124,11 @@ def render_markdown_path(markdown_file_path: str,## TODO: Convert this to something more efficient involving# passing the API URL as a direct parameter.- extensions = extensions + [zerver.openapi.markdown_extension.makeExtension(+ extensions = [*extensions, zerver.openapi.markdown_extension.makeExtension(api_url=context["api_url"],)]if not any(doc in markdown_file_path for doc in docs_without_macros):- extensions = [md_macro_extension] + extensions+ extensions = [md_macro_extension, *extensions]md_engine = markdown.Markdown(extensions=extensions)md_engine.reset()diff --git a/zerver/tests/test_auth_backends.py b/zerver/tests/test_auth_backends.pyindex e12b0c1a08a..514dabc7ecd 100644--- a/zerver/tests/test_auth_backends.py+++ b/zerver/tests/test_auth_backends.py@@ -4141,21 +4141,21 @@ class TestLDAP(ZulipLDAPTestCase):common_attrs = ['cn', 'userPassword', 'phoneNumber', 'birthDate']for key, value in ldap_dir.items():self.assertTrue(regex.match(key))- self.assertCountEqual(list(value.keys()), common_attrs + ['uid', 'thumbnailPhoto', 'userAccountControl'])+ self.assertCountEqual(list(value.keys()), [*common_attrs, 'uid', 'thumbnailPhoto', 'userAccountControl'])ldap_dir = generate_dev_ldap_dir('b', 9)self.assertEqual(len(ldap_dir), 9)regex = re.compile(r'(uid\=)+[a-zA-Z0-9_.+-]+(\,ou\=users\,dc\=zulip\,dc\=com)')for key, value in ldap_dir.items():self.assertTrue(regex.match(key))- self.assertCountEqual(list(value.keys()), common_attrs + ['uid', 'jpegPhoto'])+ self.assertCountEqual(list(value.keys()), [*common_attrs, 'uid', 'jpegPhoto'])ldap_dir = generate_dev_ldap_dir('c', 8)self.assertEqual(len(ldap_dir), 8)regex = re.compile(r'(uid\=)+[a-zA-Z0-9_.+-]+(\,ou\=users\,dc\=zulip\,dc\=com)')for key, value in ldap_dir.items():self.assertTrue(regex.match(key))- self.assertCountEqual(list(value.keys()), common_attrs + ['uid', 'email'])+ self.assertCountEqual(list(value.keys()), [*common_attrs, 'uid', 'email'])@override_settings(AUTHENTICATION_BACKENDS=('zproject.backends.ZulipLDAPAuthBackend',))def test_dev_ldap_fail_login(self) -> None:diff --git a/zerver/tests/test_events.py b/zerver/tests/test_events.pyindex bc20dacaa85..55b1dda3db2 100644--- a/zerver/tests/test_events.py+++ b/zerver/tests/test_events.py@@ -719,7 +719,7 @@ class NormalActionsTest(BaseAction):timezone_now(),UserPresence.ACTIVE),slim_presence=False)- schema_checker = check_events_dict(fields + [email_field])+ schema_checker = check_events_dict([*fields, email_field])schema_checker('events[0]', events[0])events = self.verify_action(diff --git a/zerver/tests/test_message_fetch.py b/zerver/tests/test_message_fetch.pyindex d80cc7554bd..9edb273e314 100644--- a/zerver/tests/test_message_fetch.py+++ b/zerver/tests/test_message_fetch.py@@ -1391,11 +1391,11 @@ class GetOldMessagesTest(ZulipTestCase):def dr_emails(dr: DisplayRecipientT) -> str:assert isinstance(dr, list)- return ','.join(sorted(set([r['email'] for r in dr] + [me.email])))+ return ','.join(sorted({*(r['email'] for r in dr), me.email}))def dr_ids(dr: DisplayRecipientT) -> List[int]:assert isinstance(dr, list)- return list(sorted(set([r['id'] for r in dr] + [self.example_user('hamlet').id])))+ return sorted({*(r['id'] for r in dr), self.example_user('hamlet').id})self.send_personal_message(me, self.example_user("iago"))@@ -2449,7 +2449,7 @@ class GetOldMessagesTest(ZulipTestCase):"""self.login('hamlet')- other_params = [("narrow", {}), ("anchor", 0)]+ other_params = {"narrow": {}, "anchor": 0}int_params = ["num_before", "num_after"]bad_types = (False, "", "-1", -1)@@ -2457,10 +2457,12 @@ class GetOldMessagesTest(ZulipTestCase):for type in bad_types:# Rotate through every bad type for every integer# parameter, one at a time.- post_params = dict(other_params + [(param, type)] +- [(other_param, 0) for other_param in- int_params[:idx] + int_params[idx + 1:]],- )+ post_params = {+ **other_params,+ param: type,+ **{other_param: 0 for other_param in+ int_params[:idx] + int_params[idx + 1:]},+ }result = self.client_get("/json/messages", post_params)self.assert_json_error(result,f"Bad value for '{param}': {type}")@@ -2471,14 +2473,14 @@ class GetOldMessagesTest(ZulipTestCase):"""self.login('hamlet')- other_params: List[Tuple[str, Union[int, str, bool]]] = [("anchor", 0), ("num_before", 0), ("num_after", 0)]+ other_params = {"anchor": 0, "num_before": 0, "num_after": 0}bad_types: Tuple[Union[int, str, bool], ...] = (False, 0, '', '{malformed json,','{foo: 3}', '[1,2]', '[["x","y","z"]]',)for type in bad_types:- post_params = dict(other_params + [("narrow", type)])+ post_params = {**other_params, "narrow": type}result = self.client_get("/json/messages", post_params)self.assert_json_error(result,f"Bad value for 'narrow': {type}")@@ -2538,10 +2540,9 @@ class GetOldMessagesTest(ZulipTestCase):def exercise_bad_narrow_operand(self, operator: str,operands: Sequence[Any],error_msg: str) -> None:- other_params: List[Tuple[str, Any]] = [("anchor", 0), ("num_before", 0), ("num_after", 0)]+ other_params = {"anchor": "0", "num_before": "0", "num_after": "0"}for operand in operands:- post_params = dict(other_params + [- ("narrow", orjson.dumps([[operator, operand]]).decode())])+ post_params = {**other_params, "narrow": orjson.dumps([[operator, operand]]).decode()}result = self.client_get("/json/messages", post_params)self.assert_json_error_contains(result, error_msg)diff --git a/zerver/tests/test_retention.py b/zerver/tests/test_retention.pyindex 702a6512d45..07d9b05fb5a 100644--- a/zerver/tests/test_retention.py+++ b/zerver/tests/test_retention.py@@ -320,7 +320,7 @@ class TestArchiveMessagesGeneral(ArchiveMessagesTestingBase):timezone_now() - timedelta(ZULIP_REALM_DAYS+1),)- expired_msg_ids = expired_mit_msg_ids + expired_zulip_msg_ids + [expired_crossrealm_msg_id]+ expired_msg_ids = [*expired_mit_msg_ids, *expired_zulip_msg_ids, expired_crossrealm_msg_id]expired_usermsg_ids = self._get_usermessage_ids(expired_msg_ids)archive_messages(chunk_size=2) # Specify low chunk_size to test batching.diff --git a/zerver/tests/test_soft_deactivation.py b/zerver/tests/test_soft_deactivation.pyindex fda71c5f655..745e5e0c232 100644--- a/zerver/tests/test_soft_deactivation.py+++ b/zerver/tests/test_soft_deactivation.py@@ -147,7 +147,7 @@ class UserSoftDeactivationTests(ZulipTestCase):self.example_user('iago'),self.example_user('cordelia'),]- all_users = users + [hamlet]+ all_users = [*users, hamlet]for user in all_users:self.subscribe(user, stream)@@ -182,7 +182,7 @@ class UserSoftDeactivationTests(ZulipTestCase):sender = self.example_user('hamlet')realm = get_realm('zulip')stream_name = 'announce'- for user in users + [sender]:+ for user in [*users, sender]:self.subscribe(user, stream_name)client, _ = Client.objects.get_or_create(name='website')diff --git a/zerver/tests/test_subs.py b/zerver/tests/test_subs.pyindex 937a1444d84..a2ced5c0e18 100644--- a/zerver/tests/test_subs.py+++ b/zerver/tests/test_subs.py@@ -2707,9 +2707,9 @@ class SubscriptionAPITest(ZulipTestCase):"""Subscribing to a stream name with non-ASCII characters succeeds."""- self.helper_check_subs_before_and_after_add(self.streams + ["hümbüǵ"], {},+ self.helper_check_subs_before_and_after_add([*self.streams, "hümbüǵ"], {},["hümbüǵ"], self.streams, self.test_email,- self.streams + ["hümbüǵ"], self.test_realm)+ [*self.streams, "hümbüǵ"], self.test_realm)def test_subscriptions_add_too_long(self) -> None:"""diff --git a/zproject/backends.py b/zproject/backends.pyindex 8c295405171..c6951c8ab33 100644--- a/zproject/backends.py+++ b/zproject/backends.py@@ -1367,7 +1367,7 @@ class SocialAuthMixin(ZulipAuthMixin, ExternalAuthMethod, BaseAuth):# it should be False.full_name_validated = False- standard_relay_params = settings.SOCIAL_AUTH_FIELDS_STORED_IN_SESSION + ['next']+ standard_relay_params = [*settings.SOCIAL_AUTH_FIELDS_STORED_IN_SESSION, 'next']def auth_complete(self, *args: Any, **kwargs: Any) -> Optional[HttpResponse]:"""This is a small wrapper around the core `auth_complete` method ofdiff --git a/zproject/computed_settings.py b/zproject/computed_settings.pyindex 63bdd1dcd63..b712b7d6648 100644--- a/zproject/computed_settings.py+++ b/zproject/computed_settings.py@@ -695,10 +695,10 @@ else:# This is disabled in a few tests.LOGGING_ENABLED = True-DEFAULT_ZULIP_HANDLERS = (- (['zulip_admins'] if ERROR_REPORTING else []) +- ['console', 'file', 'errors_file']-)+DEFAULT_ZULIP_HANDLERS = [+ *(['zulip_admins'] if ERROR_REPORTING else []),+ 'console', 'file', 'errors_file',+]LOGGING: Dict[str, Any] = {'version': 1,@@ -892,7 +892,7 @@ LOGGING: Dict[str, Any] = {},'zulip.auth': {'level': 'DEBUG',- 'handlers': DEFAULT_ZULIP_HANDLERS + ['auth_file'],+ 'handlers': [*DEFAULT_ZULIP_HANDLERS, 'auth_file'],'propagate': False,},'zulip.ldap': {