diff --git a/scripts/log-search b/scripts/log-search index 3ed1341980..344a39942a 100755 --- a/scripts/log-search +++ b/scripts/log-search @@ -19,8 +19,9 @@ setup_path() os.environ["DJANGO_SETTINGS_MODULE"] = "zproject.settings" +from typing import Protocol + from django.conf import settings -from typing_extensions import Protocol from scripts.lib.zulip_tools import BOLD, CYAN, ENDC, FAIL, GRAY, OKBLUE @@ -96,7 +97,7 @@ def parser() -> argparse.ArgumentParser: def maybe_gzip(logfile_name: str) -> TextIO: if logfile_name.endswith(".gz"): return gzip.open(logfile_name, "rt") - return open(logfile_name, "r") + return open(logfile_name) NGINX_LOG_LINE_RE = re.compile( diff --git a/zerver/tests/test_subs.py b/zerver/tests/test_subs.py index be21433f9f..6bd8dc7905 100644 --- a/zerver/tests/test_subs.py +++ b/zerver/tests/test_subs.py @@ -220,16 +220,14 @@ class TestMiscStuff(ZulipTestCase): expected_fields -= {"id"} stream_dict_fields = set(APIStreamDict.__annotations__.keys()) - computed_fields = set(["is_announcement_only", "is_default"]) + computed_fields = {"is_announcement_only", "is_default"} self.assertEqual(stream_dict_fields - computed_fields, expected_fields) expected_fields = set(Subscription.API_FIELDS) subscription_dict_fields = set(APISubscriptionDict.__annotations__.keys()) - computed_fields = set( - ["in_home_view", "email_address", "stream_weekly_traffic", "subscribers"] - ) + computed_fields = {"in_home_view", "email_address", "stream_weekly_traffic", "subscribers"} # `APISubscriptionDict` is a subclass of `APIStreamDict`, therefore having all the # fields in addition to the computed fields and `Subscription.API_FIELDS` that # need to be excluded here.