mypy: Change type annotation to Set[bytes].

also fix unicode
This commit is contained in:
umkay 2017-05-22 16:34:29 -07:00 committed by Eklavya Sharma
parent ad25f27853
commit 5252626095

View file

@ -14,7 +14,7 @@ import zulip
from typing import Set from typing import Set
def fetch_public_streams(): def fetch_public_streams():
# type: () -> Set[str] # type: () -> Set[bytes]
public_streams = set() public_streams = set()
try: try:
@ -33,9 +33,9 @@ def fetch_public_streams():
# Zephyr class names are canonicalized by first applying NFKC # Zephyr class names are canonicalized by first applying NFKC
# normalization and then lower-casing server-side # normalization and then lower-casing server-side
canonical_cls = unicodedata.normalize("NFKC", stream_name).lower().encode("utf-8") canonical_cls = unicodedata.normalize("NFKC", stream_name).lower().encode("utf-8")
if canonical_cls in ['security', 'login', 'network', 'ops', 'user_locate', if canonical_cls in [b'security', b'login', b'network', b'ops', b'user_locate',
'mit', 'moof', 'wsmonitor', 'wg_ctl', 'winlogger', b'mit', b'moof', b'wsmonitor', b'wg_ctl', b'winlogger',
'hm_ctl', 'hm_stat', 'zephyr_admin', 'zephyr_ctl']: b'hm_ctl', b'hm_stat', b'zephyr_admin', b'zephyr_ctl']:
# These zephyr classes cannot be subscribed to by us, due # These zephyr classes cannot be subscribed to by us, due
# to MIT's Zephyr access control settings # to MIT's Zephyr access control settings
continue continue