Skip to content

Commit 892e69b

Browse files
andersktimabbott
authored andcommitted
settings: Turn on mypy checking.
Signed-off-by: Anders Kaseorg <[email protected]>
1 parent ff1ef09 commit 892e69b

File tree

4 files changed

+11
-17
lines changed

4 files changed

+11
-17
lines changed

mypy.ini

-6
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,6 @@ warn_unreachable = True
4040
[mypy-conf] # For docs/conf.py.
4141
ignore_errors = True
4242

43-
[mypy-zproject.settings]
44-
ignore_errors = True
45-
46-
[mypy-zproject.test_settings]
47-
ignore_errors = True
48-
4943
# zerver.tornado.autoreload is a slightly-patched piece of upstream Tornado.
5044
[mypy-zerver.tornado.autoreload]
5145
ignore_errors = True

zproject/dev_settings.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@
150150
THUMBOR_URL = 'http://127.0.0.1:9995'
151151
THUMBNAIL_IMAGES = True
152152

153-
SEARCH_PILLS_ENABLED = os.getenv('SEARCH_PILLS_ENABLED', False)
153+
SEARCH_PILLS_ENABLED = bool(os.getenv('SEARCH_PILLS_ENABLED', False))
154154

155155
BILLING_ENABLED = True
156156

zproject/settings.py

+9-8
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import os
1515
import time
1616
import sys
17+
from typing import Any, Dict, List, Union
1718

1819
from zerver.lib.db import TimeTrackingConnection
1920
import zerver.lib.logging_util
@@ -147,7 +148,7 @@
147148

148149
from django.template.loaders import app_directories
149150
class TwoFactorLoader(app_directories.Loader):
150-
def get_dirs(self):
151+
def get_dirs(self) -> List[str]:
151152
dirs = super().get_dirs()
152153
return [d for d in dirs if 'two_factor' in d]
153154

@@ -211,8 +212,8 @@ def get_dirs(self):
211212
# Base URL of the Tornado server
212213
# We set it to None when running backend tests or populate_db.
213214
# We override the port number when running frontend tests.
214-
TORNADO_PROCESSES = int(get_config('application_server', 'tornado_processes', 1))
215-
TORNADO_SERVER = 'http://127.0.0.1:9993'
215+
TORNADO_PROCESSES = int(get_config('application_server', 'tornado_processes', '1'))
216+
TORNADO_SERVER = 'http://127.0.0.1:9993' # type: Optional[str]
216217
RUNNING_INSIDE_TORNADO = False
217218
AUTORELOAD = DEBUG
218219

@@ -270,7 +271,7 @@ def get_dirs(self):
270271
'OPTIONS': {
271272
'connection_factory': TimeTrackingConnection
272273
},
273-
}}
274+
}} # type: Dict[str, Dict[str, Any]]
274275

275276
if DEVELOPMENT:
276277
LOCAL_DATABASE_PASSWORD = get_secret("local_database_password")
@@ -449,7 +450,7 @@ def get_dirs(self):
449450
'name': 'Welcome Bot'}]
450451

451452
# Bots that are created for each realm like the reminder-bot goes here.
452-
REALM_INTERNAL_BOTS = []
453+
REALM_INTERNAL_BOTS = [] # type: List[Dict[str, str]]
453454
# These are realm-internal bots that may exist in some organizations,
454455
# so configure power the setting, but should not be auto-created at this time.
455456
DISABLED_REALM_INTERNAL_BOTS = [
@@ -545,7 +546,7 @@ def get_dirs(self):
545546
LOADERS = [
546547
'django.template.loaders.filesystem.Loader',
547548
'django.template.loaders.app_directories.Loader',
548-
]
549+
] # type: List[Union[str, Tuple[object, ...]]]
549550
if PRODUCTION:
550551
# Template caching is a significant performance win in production.
551552
LOADERS = [('django.template.loaders.cached.Loader', LOADERS)]
@@ -564,7 +565,7 @@ def get_dirs(self):
564565
'django.template.context_processors.i18n',
565566
],
566567
},
567-
}
568+
} # type: Dict[str, Any]
568569

569570
default_template_engine_settings = deepcopy(base_template_engine_settings)
570571
default_template_engine_settings.update({
@@ -874,7 +875,7 @@ def zulip_path(path: str) -> str:
874875
'propagate': False,
875876
},
876877
}
877-
}
878+
} # type: Dict[str, Any]
878879

879880
LOGIN_REDIRECT_URL = '/'
880881

zproject/test_settings.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@
119119
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'
120120
}
121121

122-
def set_loglevel(logger_name, level) -> None:
122+
def set_loglevel(logger_name: str, level: str) -> None:
123123
LOGGING['loggers'].setdefault(logger_name, {})['level'] = level
124124
set_loglevel('zulip.requests', 'CRITICAL')
125125
set_loglevel('zulip.management', 'CRITICAL')
@@ -215,6 +215,5 @@ def set_loglevel(logger_name, level) -> None:
215215
"attr_username": "email",
216216
"attr_email": "email",
217217
"display_name": "Test IdP",
218-
"display_icon": None,
219218
}
220219
}

0 commit comments

Comments
 (0)