diff --git a/scripts/log-search b/scripts/log-search index fd63f6e716..f9c900d9c3 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.py index 23dafabb0a..4107d78cb0 100755 --- a/tools/lib/provision.py +++ b/tools/lib/provision.py @@ -160,7 +160,7 @@ COMMON_YUM_DEPENDENCIES = [ BUILD_GROONGA_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 # from source. BUILD_PGROONGA_FROM_SOURCE = True diff --git a/tools/lib/template_parser.py b/tools/lib/template_parser.py index fc1d35643a..0b5b4e729d 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 = 0 end = i + 1 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] == '"': quote_count += 1 if not unclosed_end and text[end] == "<": diff --git a/zerver/lib/cache.py b/zerver/lib/cache.py index 63d20e6044..90dfdca49a 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_fields and 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.py index 77e461e868..b4b081a19e 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_stream and user_profile.default_events_register_stream.invite_only ) assert user_profile.bot_owner_id is not None