mirror of https://github.com/zulip/zulip.git
ruff: Fix RUF021 Parenthesize when chaining `and` and `or` together.
This is a preview rule, not yet enabled by default. Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
f618971668
commit
865febb307
|
@ -447,7 +447,7 @@ def print_line(
|
||||||
date = convert_from_nginx_date(match["date"])
|
date = convert_from_nginx_date(match["date"])
|
||||||
else:
|
else:
|
||||||
date = match["date"]
|
date = match["date"]
|
||||||
if args.all_logs or args.log_files is not None and args.log_files > 1:
|
if args.all_logs or (args.log_files is not None and args.log_files > 1):
|
||||||
ts = date + " " + match["time"]
|
ts = date + " " + match["time"]
|
||||||
else:
|
else:
|
||||||
ts = match["time"]
|
ts = match["time"]
|
||||||
|
@ -511,7 +511,7 @@ def print_line(
|
||||||
print(f"------------ {gap_ms:>5}ms gap ------------")
|
print(f"------------ {gap_ms:>5}ms gap ------------")
|
||||||
else:
|
else:
|
||||||
print(f"!!!!!!!!!! {abs(gap_ms):>5}ms overlap !!!!!!!!!!")
|
print(f"!!!!!!!!!! {abs(gap_ms):>5}ms overlap !!!!!!!!!!")
|
||||||
if args.all_logs or args.log_files is not None and args.log_files > 1:
|
if args.all_logs or (args.log_files is not None and args.log_files > 1):
|
||||||
print(logline_start.isoformat(" ", timespec="milliseconds") + " (start)")
|
print(logline_start.isoformat(" ", timespec="milliseconds") + " (start)")
|
||||||
else:
|
else:
|
||||||
print(logline_start.time().isoformat(timespec="milliseconds") + " (start)")
|
print(logline_start.time().isoformat(timespec="milliseconds") + " (start)")
|
||||||
|
|
|
@ -160,7 +160,7 @@ COMMON_YUM_DEPENDENCIES = [
|
||||||
|
|
||||||
BUILD_GROONGA_FROM_SOURCE = False
|
BUILD_GROONGA_FROM_SOURCE = False
|
||||||
BUILD_PGROONGA_FROM_SOURCE = False
|
BUILD_PGROONGA_FROM_SOURCE = False
|
||||||
if vendor == "debian" and os_version in [] or vendor == "ubuntu" and os_version in []:
|
if (vendor == "debian" and os_version in []) or (vendor == "ubuntu" and os_version in []):
|
||||||
# For platforms without a PGroonga release, we need to build it
|
# For platforms without a PGroonga release, we need to build it
|
||||||
# from source.
|
# from source.
|
||||||
BUILD_PGROONGA_FROM_SOURCE = True
|
BUILD_PGROONGA_FROM_SOURCE = True
|
||||||
|
|
|
@ -674,7 +674,7 @@ def get_html_tag(text: str, i: int) -> str:
|
||||||
quote_count = 0
|
quote_count = 0
|
||||||
end = i + 1
|
end = i + 1
|
||||||
unclosed_end = 0
|
unclosed_end = 0
|
||||||
while end < len(text) and (text[end] != ">" or quote_count % 2 != 0 and text[end] != "<"):
|
while end < len(text) and (text[end] != ">" or (quote_count % 2 != 0 and text[end] != "<")):
|
||||||
if text[end] == '"':
|
if text[end] == '"':
|
||||||
quote_count += 1
|
quote_count += 1
|
||||||
if not unclosed_end and text[end] == "<":
|
if not unclosed_end and text[end] == "<":
|
||||||
|
|
|
@ -651,9 +651,8 @@ def flush_stream(
|
||||||
|
|
||||||
stream = instance
|
stream = instance
|
||||||
|
|
||||||
if (
|
if update_fields is None or (
|
||||||
update_fields is None
|
"name" in update_fields
|
||||||
or "name" in update_fields
|
|
||||||
and UserProfile.objects.filter(
|
and UserProfile.objects.filter(
|
||||||
Q(default_sending_stream=stream) | Q(default_events_register_stream=stream)
|
Q(default_sending_stream=stream) | Q(default_events_register_stream=stream)
|
||||||
).exists()
|
).exists()
|
||||||
|
|
|
@ -1047,9 +1047,9 @@ def active_non_guest_user_ids(realm_id: int) -> List[int]:
|
||||||
|
|
||||||
def bot_owner_user_ids(user_profile: UserProfile) -> Set[int]:
|
def bot_owner_user_ids(user_profile: UserProfile) -> Set[int]:
|
||||||
is_private_bot = (
|
is_private_bot = (
|
||||||
user_profile.default_sending_stream
|
user_profile.default_sending_stream and user_profile.default_sending_stream.invite_only
|
||||||
and user_profile.default_sending_stream.invite_only
|
) or (
|
||||||
or user_profile.default_events_register_stream
|
user_profile.default_events_register_stream
|
||||||
and user_profile.default_events_register_stream.invite_only
|
and user_profile.default_events_register_stream.invite_only
|
||||||
)
|
)
|
||||||
assert user_profile.bot_owner_id is not None
|
assert user_profile.bot_owner_id is not None
|
||||||
|
|
Loading…
Reference in New Issue