mirror of
https://github.com/zulip/zulip.git
synced 2025-11-09 08:26:11 +00:00
settings: Turn on mypy checking.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
committed by
Tim Abbott
parent
ff1ef097a6
commit
892e69b7ad
6
mypy.ini
6
mypy.ini
@@ -40,12 +40,6 @@ warn_unreachable = True
|
|||||||
[mypy-conf] # For docs/conf.py.
|
[mypy-conf] # For docs/conf.py.
|
||||||
ignore_errors = True
|
ignore_errors = True
|
||||||
|
|
||||||
[mypy-zproject.settings]
|
|
||||||
ignore_errors = True
|
|
||||||
|
|
||||||
[mypy-zproject.test_settings]
|
|
||||||
ignore_errors = True
|
|
||||||
|
|
||||||
# zerver.tornado.autoreload is a slightly-patched piece of upstream Tornado.
|
# zerver.tornado.autoreload is a slightly-patched piece of upstream Tornado.
|
||||||
[mypy-zerver.tornado.autoreload]
|
[mypy-zerver.tornado.autoreload]
|
||||||
ignore_errors = True
|
ignore_errors = True
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ if FAKE_LDAP_MODE:
|
|||||||
THUMBOR_URL = 'http://127.0.0.1:9995'
|
THUMBOR_URL = 'http://127.0.0.1:9995'
|
||||||
THUMBNAIL_IMAGES = True
|
THUMBNAIL_IMAGES = True
|
||||||
|
|
||||||
SEARCH_PILLS_ENABLED = os.getenv('SEARCH_PILLS_ENABLED', False)
|
SEARCH_PILLS_ENABLED = bool(os.getenv('SEARCH_PILLS_ENABLED', False))
|
||||||
|
|
||||||
BILLING_ENABLED = True
|
BILLING_ENABLED = True
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ from copy import deepcopy
|
|||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
import sys
|
import sys
|
||||||
|
from typing import Any, Dict, List, Union
|
||||||
|
|
||||||
from zerver.lib.db import TimeTrackingConnection
|
from zerver.lib.db import TimeTrackingConnection
|
||||||
import zerver.lib.logging_util
|
import zerver.lib.logging_util
|
||||||
@@ -147,7 +148,7 @@ ALLOWED_HOSTS += REALM_HOSTS.values()
|
|||||||
|
|
||||||
from django.template.loaders import app_directories
|
from django.template.loaders import app_directories
|
||||||
class TwoFactorLoader(app_directories.Loader):
|
class TwoFactorLoader(app_directories.Loader):
|
||||||
def get_dirs(self):
|
def get_dirs(self) -> List[str]:
|
||||||
dirs = super().get_dirs()
|
dirs = super().get_dirs()
|
||||||
return [d for d in dirs if 'two_factor' in d]
|
return [d for d in dirs if 'two_factor' in d]
|
||||||
|
|
||||||
@@ -211,8 +212,8 @@ CORPORATE_ENABLED = 'corporate' in INSTALLED_APPS
|
|||||||
# Base URL of the Tornado server
|
# Base URL of the Tornado server
|
||||||
# We set it to None when running backend tests or populate_db.
|
# We set it to None when running backend tests or populate_db.
|
||||||
# We override the port number when running frontend tests.
|
# We override the port number when running frontend tests.
|
||||||
TORNADO_PROCESSES = int(get_config('application_server', 'tornado_processes', 1))
|
TORNADO_PROCESSES = int(get_config('application_server', 'tornado_processes', '1'))
|
||||||
TORNADO_SERVER = 'http://127.0.0.1:9993'
|
TORNADO_SERVER = 'http://127.0.0.1:9993' # type: Optional[str]
|
||||||
RUNNING_INSIDE_TORNADO = False
|
RUNNING_INSIDE_TORNADO = False
|
||||||
AUTORELOAD = DEBUG
|
AUTORELOAD = DEBUG
|
||||||
|
|
||||||
@@ -270,7 +271,7 @@ DATABASES = {"default": {
|
|||||||
'OPTIONS': {
|
'OPTIONS': {
|
||||||
'connection_factory': TimeTrackingConnection
|
'connection_factory': TimeTrackingConnection
|
||||||
},
|
},
|
||||||
}}
|
}} # type: Dict[str, Dict[str, Any]]
|
||||||
|
|
||||||
if DEVELOPMENT:
|
if DEVELOPMENT:
|
||||||
LOCAL_DATABASE_PASSWORD = get_secret("local_database_password")
|
LOCAL_DATABASE_PASSWORD = get_secret("local_database_password")
|
||||||
@@ -449,7 +450,7 @@ INTERNAL_BOTS = [{'var_name': 'NOTIFICATION_BOT',
|
|||||||
'name': 'Welcome Bot'}]
|
'name': 'Welcome Bot'}]
|
||||||
|
|
||||||
# Bots that are created for each realm like the reminder-bot goes here.
|
# Bots that are created for each realm like the reminder-bot goes here.
|
||||||
REALM_INTERNAL_BOTS = []
|
REALM_INTERNAL_BOTS = [] # type: List[Dict[str, str]]
|
||||||
# These are realm-internal bots that may exist in some organizations,
|
# These are realm-internal bots that may exist in some organizations,
|
||||||
# so configure power the setting, but should not be auto-created at this time.
|
# so configure power the setting, but should not be auto-created at this time.
|
||||||
DISABLED_REALM_INTERNAL_BOTS = [
|
DISABLED_REALM_INTERNAL_BOTS = [
|
||||||
@@ -545,7 +546,7 @@ WEBPACK_LOADER = {
|
|||||||
LOADERS = [
|
LOADERS = [
|
||||||
'django.template.loaders.filesystem.Loader',
|
'django.template.loaders.filesystem.Loader',
|
||||||
'django.template.loaders.app_directories.Loader',
|
'django.template.loaders.app_directories.Loader',
|
||||||
]
|
] # type: List[Union[str, Tuple[object, ...]]]
|
||||||
if PRODUCTION:
|
if PRODUCTION:
|
||||||
# Template caching is a significant performance win in production.
|
# Template caching is a significant performance win in production.
|
||||||
LOADERS = [('django.template.loaders.cached.Loader', LOADERS)]
|
LOADERS = [('django.template.loaders.cached.Loader', LOADERS)]
|
||||||
@@ -564,7 +565,7 @@ base_template_engine_settings = {
|
|||||||
'django.template.context_processors.i18n',
|
'django.template.context_processors.i18n',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
}
|
} # type: Dict[str, Any]
|
||||||
|
|
||||||
default_template_engine_settings = deepcopy(base_template_engine_settings)
|
default_template_engine_settings = deepcopy(base_template_engine_settings)
|
||||||
default_template_engine_settings.update({
|
default_template_engine_settings.update({
|
||||||
@@ -874,7 +875,7 @@ LOGGING = {
|
|||||||
'propagate': False,
|
'propagate': False,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
} # type: Dict[str, Any]
|
||||||
|
|
||||||
LOGIN_REDIRECT_URL = '/'
|
LOGIN_REDIRECT_URL = '/'
|
||||||
|
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ if not CASPER_TESTS:
|
|||||||
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'
|
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'
|
||||||
}
|
}
|
||||||
|
|
||||||
def set_loglevel(logger_name, level) -> None:
|
def set_loglevel(logger_name: str, level: str) -> None:
|
||||||
LOGGING['loggers'].setdefault(logger_name, {})['level'] = level
|
LOGGING['loggers'].setdefault(logger_name, {})['level'] = level
|
||||||
set_loglevel('zulip.requests', 'CRITICAL')
|
set_loglevel('zulip.requests', 'CRITICAL')
|
||||||
set_loglevel('zulip.management', 'CRITICAL')
|
set_loglevel('zulip.management', 'CRITICAL')
|
||||||
@@ -215,6 +215,5 @@ SOCIAL_AUTH_SAML_ENABLED_IDPS = {
|
|||||||
"attr_username": "email",
|
"attr_username": "email",
|
||||||
"attr_email": "email",
|
"attr_email": "email",
|
||||||
"display_name": "Test IdP",
|
"display_name": "Test IdP",
|
||||||
"display_icon": None,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user