mirror of https://github.com/zulip/zulip.git
ruff: Fix PIE810 Call `startswith` once with a `tuple`.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
b9fc5da350
commit
6992d3297a
|
@ -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)
|
||||
)
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -264,7 +264,7 @@ Output:
|
|||
extensive test coverage of corner cases in the API to ensure that we've properly
|
||||
documented those corner cases.
|
||||
"""
|
||||
if not (url.startswith("/json") or url.startswith("/api/v1")):
|
||||
if not url.startswith(("/json", "/api/v1")):
|
||||
return
|
||||
try:
|
||||
content = orjson.loads(result.content)
|
||||
|
|
|
@ -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("."):
|
||||
continue
|
||||
with open(os.path.join(dirpath, filename)) as reader:
|
||||
|
|
|
@ -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 >= 5
|
||||
if "webathena_kerberos" in path:
|
||||
|
|
|
@ -458,7 +458,7 @@ def get_subject_based_on_event(
|
|||
if use_merge_request_title
|
||||
else "",
|
||||
)
|
||||
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",
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue