mirror of https://github.com/zulip/zulip.git
python: Apply changes from pyupgrade.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
412e90f601
commit
443b974b3e
|
@ -19,8 +19,9 @@ setup_path()
|
||||||
|
|
||||||
os.environ["DJANGO_SETTINGS_MODULE"] = "zproject.settings"
|
os.environ["DJANGO_SETTINGS_MODULE"] = "zproject.settings"
|
||||||
|
|
||||||
|
from typing import Protocol
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from typing_extensions import Protocol
|
|
||||||
|
|
||||||
from scripts.lib.zulip_tools import BOLD, CYAN, ENDC, FAIL, GRAY, OKBLUE
|
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:
|
def maybe_gzip(logfile_name: str) -> TextIO:
|
||||||
if logfile_name.endswith(".gz"):
|
if logfile_name.endswith(".gz"):
|
||||||
return gzip.open(logfile_name, "rt")
|
return gzip.open(logfile_name, "rt")
|
||||||
return open(logfile_name, "r")
|
return open(logfile_name)
|
||||||
|
|
||||||
|
|
||||||
NGINX_LOG_LINE_RE = re.compile(
|
NGINX_LOG_LINE_RE = re.compile(
|
||||||
|
|
|
@ -220,16 +220,14 @@ class TestMiscStuff(ZulipTestCase):
|
||||||
expected_fields -= {"id"}
|
expected_fields -= {"id"}
|
||||||
|
|
||||||
stream_dict_fields = set(APIStreamDict.__annotations__.keys())
|
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)
|
self.assertEqual(stream_dict_fields - computed_fields, expected_fields)
|
||||||
|
|
||||||
expected_fields = set(Subscription.API_FIELDS)
|
expected_fields = set(Subscription.API_FIELDS)
|
||||||
|
|
||||||
subscription_dict_fields = set(APISubscriptionDict.__annotations__.keys())
|
subscription_dict_fields = set(APISubscriptionDict.__annotations__.keys())
|
||||||
computed_fields = set(
|
computed_fields = {"in_home_view", "email_address", "stream_weekly_traffic", "subscribers"}
|
||||||
["in_home_view", "email_address", "stream_weekly_traffic", "subscribers"]
|
|
||||||
)
|
|
||||||
# `APISubscriptionDict` is a subclass of `APIStreamDict`, therefore having all the
|
# `APISubscriptionDict` is a subclass of `APIStreamDict`, therefore having all the
|
||||||
# fields in addition to the computed fields and `Subscription.API_FIELDS` that
|
# fields in addition to the computed fields and `Subscription.API_FIELDS` that
|
||||||
# need to be excluded here.
|
# need to be excluded here.
|
||||||
|
|
Loading…
Reference in New Issue