Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
ruff: Fix RUF021 Parenthesize when chaining `and` and `or` together.
Anders Kaseorg865febb30793
diff --git a/scripts/log-search b/scripts/log-searchindex fd63f6e716d..f9c900d9c34 100755--- a/scripts/log-search+++ b/scripts/log-search@@ -447,7 +447,7 @@ def print_line(date = convert_from_nginx_date(match["date"])else: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"]else:ts = match["time"]@@ -511,7 +511,7 @@ def print_line(print(f"------------ {gap_ms:>5}ms gap ------------")else: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)")else:print(logline_start.time().isoformat(timespec="milliseconds") + " (start)")diff --git a/tools/lib/provision.py b/tools/lib/provision.pyindex 23dafabb0a4..4107d78cb0d 100755--- a/tools/lib/provision.py+++ b/tools/lib/provision.py@@ -160,7 +160,7 @@ COMMON_YUM_DEPENDENCIES = [BUILD_GROONGA_FROM_SOURCE = FalseBUILD_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# from source.BUILD_PGROONGA_FROM_SOURCE = Truediff --git a/tools/lib/template_parser.py b/tools/lib/template_parser.pyindex fc1d35643a0..0b5b4e729df 100644--- a/tools/lib/template_parser.py+++ b/tools/lib/template_parser.py@@ -674,7 +674,7 @@ def get_html_tag(text: str, i: int) -> str:quote_count = 0end = i + 1unclosed_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] == '"':quote_count += 1if not unclosed_end and text[end] == "<":diff --git a/zerver/lib/cache.py b/zerver/lib/cache.pyindex 63d20e6044f..90dfdca49a1 100644--- a/zerver/lib/cache.py+++ b/zerver/lib/cache.py@@ -651,9 +651,8 @@ def flush_stream(stream = instance- if (- update_fields is None- or "name" in update_fields+ if update_fields is None or (+ "name" in update_fieldsand UserProfile.objects.filter(Q(default_sending_stream=stream) | Q(default_events_register_stream=stream)).exists()diff --git a/zerver/models/users.py b/zerver/models/users.pyindex 77e461e8687..b4b081a19e6 100644--- a/zerver/models/users.py+++ b/zerver/models/users.py@@ -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]:is_private_bot = (- user_profile.default_sending_stream- and user_profile.default_sending_stream.invite_only- or user_profile.default_events_register_stream+ user_profile.default_sending_stream and user_profile.default_sending_stream.invite_only+ ) or (+ user_profile.default_events_register_streamand user_profile.default_events_register_stream.invite_only)assert user_profile.bot_owner_id is not None