Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
ruff: Fix PIE810 Call `startswith` once with a `tuple`.
Anders Kaseorg6992d3297a2e
diff --git a/tools/documentation_crawler/documentation_crawler/spiders/check_help_documentation.py b/tools/documentation_crawler/documentation_crawler/spiders/check_help_documentation.pyindex 949b72e0bd3..3eaf50b0bb6 100644--- a/tools/documentation_crawler/documentation_crawler/spiders/check_help_documentation.py+++ b/tools/documentation_crawler/documentation_crawler/spiders/check_help_documentation.py@@ -58,8 +58,7 @@ class PorticoDocumentationSpider(BaseDocumentationSpider):def _is_external_url(self, url: str) -> bool:return (not url.startswith("http://localhost:9981")- or url.startswith("http://localhost:9981/help")- or url.startswith("http://localhost:9981/api")+ or url.startswith(("http://localhost:9981/help", "http://localhost:9981/api"))or self._has_extension(url))diff --git a/zerver/lib/export.py b/zerver/lib/export.pyindex 6083a92d761..a9cd7d1d242 100644--- a/zerver/lib/export.py+++ b/zerver/lib/export.py@@ -1157,7 +1157,7 @@ def export_usermessages_batch(management command).See write_message_partial_for_query for more context."""- assert input_path.endswith(".partial") or input_path.endswith(".locked")+ assert input_path.endswith((".partial", ".locked"))assert output_path.endswith(".json")with open(input_path, "rb") as input_file:diff --git a/zerver/lib/test_classes.py b/zerver/lib/test_classes.pyindex 464e8d7f6db..59a4acdff4f 100644--- a/zerver/lib/test_classes.py+++ b/zerver/lib/test_classes.py@@ -264,7 +264,7 @@ Output:extensive test coverage of corner cases in the API to ensure that we've properlydocumented those corner cases."""- if not (url.startswith("/json") or url.startswith("/api/v1")):+ if not url.startswith(("/json", "/api/v1")):returntry:content = orjson.loads(result.content)diff --git a/zerver/management/commands/makemessages.py b/zerver/management/commands/makemessages.pyindex b2d9b5519c1..073eed94de6 100644--- a/zerver/management/commands/makemessages.py+++ b/zerver/management/commands/makemessages.py@@ -192,7 +192,7 @@ class Command(makemessages.Command):for dirpath, dirnames, filenames in itertools.chain(os.walk("static/js"), os.walk("static/shared/js")):- for filename in [f for f in filenames if f.endswith(".js") or f.endswith(".ts")]:+ for filename in [f for f in filenames if f.endswith((".js", ".ts"))]:if filename.startswith("."):continuewith open(os.path.join(dirpath, filename)) as reader:diff --git a/zerver/middleware.py b/zerver/middleware.pyindex da64558faf4..eb0266c067c 100644--- a/zerver/middleware.py+++ b/zerver/middleware.py@@ -113,11 +113,11 @@ def format_timedelta(timedelta: float) -> str:def is_slow_query(time_delta: float, path: str) -> bool:if time_delta < 1.2:return False- is_exempt = (- path in ["/activity", "/json/report/error", "/api/v1/deployments/report_error"]- or path.startswith("/realm_activity/")- or path.startswith("/user_activity/")- )+ is_exempt = path in [+ "/activity",+ "/json/report/error",+ "/api/v1/deployments/report_error",+ ] or path.startswith(("/realm_activity/", "/user_activity/"))if is_exempt:return time_delta >= 5if "webathena_kerberos" in path:diff --git a/zerver/webhooks/gitlab/view.py b/zerver/webhooks/gitlab/view.pyindex 6f47adc952a..d961b89b2d3 100644--- a/zerver/webhooks/gitlab/view.py+++ b/zerver/webhooks/gitlab/view.py@@ -458,7 +458,7 @@ def get_subject_based_on_event(if use_merge_request_titleelse "",)- elif event.startswith("Issue Hook") or event.startswith("Confidential Issue Hook"):+ elif event.startswith(("Issue Hook", "Confidential Issue Hook")):return TOPIC_WITH_PR_OR_ISSUE_INFO_TEMPLATE.format(repo=get_repo_name(payload),type="issue",diff --git a/zilencer/management/commands/rundjangoserver.py b/zilencer/management/commands/rundjangoserver.pyindex 084be4a6363..e3fb2d12f59 100644--- a/zilencer/management/commands/rundjangoserver.py+++ b/zilencer/management/commands/rundjangoserver.py@@ -12,10 +12,8 @@ def output_styler(style_func: Callable[[str], str]) -> Callable[[str], str]:@wraps(style_func)def _wrapped_style_func(message: str) -> str:- if (- message == "Performing system checks...\n\n"- or message.startswith("System check identified no issues")- or message.startswith(date_prefix)+ if message == "Performing system checks...\n\n" or message.startswith(+ ("System check identified no issues", date_prefix)):message = ""elif "Quit the server with " in message: