Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

python: Apply changes from pyupgrade.

Anders Kaseorg443b974b3e73
diff --git a/scripts/log-search b/scripts/log-search
index 3ed1341980f..344a39942aa 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 be21433f9fb..6bd8dc79053 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.