settings: Convert variable type annotations to Python 3.6 style.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2020-07-06 17:05:02 -07:00
committed by Anders Kaseorg
parent ebf7f4d0f6
commit 5693f63bf8
4 changed files with 20 additions and 20 deletions

View File

@@ -335,9 +335,7 @@ python_rules = RuleList(
'exclude': {'scripts/lib/hash_reqs.py', 'exclude': {'scripts/lib/hash_reqs.py',
'scripts/lib/setup_venv.py', 'scripts/lib/setup_venv.py',
'scripts/lib/zulip_tools.py', 'scripts/lib/zulip_tools.py',
'tools/lib/provision.py', 'tools/lib/provision.py'},
'zproject/dev_settings.py',
'zproject/prod_settings_template.py'},
'description': 'Comment-style variable type annotation. Use Python 3.6 style annotations instead.', 'description': 'Comment-style variable type annotation. Use Python 3.6 style annotations instead.',
'good_lines': ['a: List[int] = []'], 'good_lines': ['a: List[int] = []'],
'bad_lines': ['a = [] # type: List[int]']}, 'bad_lines': ['a = [] # type: List[int]']},

View File

@@ -39,6 +39,7 @@ EMAIL_HOST: Optional[str] = None
# LDAP auth # LDAP auth
AUTH_LDAP_SERVER_URI = "" AUTH_LDAP_SERVER_URI = ""
LDAP_APPEND_DOMAIN: Optional[str] = None
LDAP_EMAIL_ATTR: Optional[str] = None LDAP_EMAIL_ATTR: Optional[str] = None
AUTH_LDAP_USERNAME_ATTR: Optional[str] = None AUTH_LDAP_USERNAME_ATTR: Optional[str] = None
AUTH_LDAP_REVERSE_EMAIL_SEARCH: Optional["LDAPSearch"] = None AUTH_LDAP_REVERSE_EMAIL_SEARCH: Optional["LDAPSearch"] = None

View File

@@ -45,7 +45,7 @@ ALLOWED_HOSTS = ['*']
# Uncomment extra backends if you want to test with them. Note that # Uncomment extra backends if you want to test with them. Note that
# for Google and GitHub auth you'll need to do some pre-setup. # for Google and GitHub auth you'll need to do some pre-setup.
AUTHENTICATION_BACKENDS = ( AUTHENTICATION_BACKENDS: Tuple[str, ...] = (
'zproject.backends.DevAuthBackend', 'zproject.backends.DevAuthBackend',
'zproject.backends.EmailAuthBackend', 'zproject.backends.EmailAuthBackend',
'zproject.backends.GitHubAuthBackend', 'zproject.backends.GitHubAuthBackend',
@@ -54,7 +54,7 @@ AUTHENTICATION_BACKENDS = (
# 'zproject.backends.AzureADAuthBackend', # 'zproject.backends.AzureADAuthBackend',
'zproject.backends.GitLabAuthBackend', 'zproject.backends.GitLabAuthBackend',
'zproject.backends.AppleAuthBackend', 'zproject.backends.AppleAuthBackend',
) # type: Tuple[str, ...] )
EXTERNAL_URI_SCHEME = "http://" EXTERNAL_URI_SCHEME = "http://"
EMAIL_GATEWAY_PATTERN = "%s@" + EXTERNAL_HOST_WITHOUT_PORT EMAIL_GATEWAY_PATTERN = "%s@" + EXTERNAL_HOST_WITHOUT_PORT
@@ -76,10 +76,10 @@ SAVE_FRONTEND_STACKTRACES = True
EVENT_LOGS_ENABLED = True EVENT_LOGS_ENABLED = True
STAGING_ERROR_NOTIFICATIONS = True STAGING_ERROR_NOTIFICATIONS = True
SYSTEM_ONLY_REALMS = set() # type: Set[str] SYSTEM_ONLY_REALMS: Set[str] = set()
USING_PGROONGA = True USING_PGROONGA = True
# Flush cache after migration. # Flush cache after migration.
POST_MIGRATION_CACHE_FLUSHING = True # type: bool POST_MIGRATION_CACHE_FLUSHING = True
# Don't require anything about password strength in development # Don't require anything about password strength in development
PASSWORD_MIN_LENGTH = 0 PASSWORD_MIN_LENGTH = 0
@@ -98,7 +98,7 @@ TWO_FACTOR_SMS_GATEWAY = 'two_factor.gateways.fake.Fake'
SENDFILE_BACKEND = 'django_sendfile.backends.development' SENDFILE_BACKEND = 'django_sendfile.backends.development'
# Set this True to send all hotspots in development # Set this True to send all hotspots in development
ALWAYS_SEND_ALL_HOTSPOTS = False # type: bool ALWAYS_SEND_ALL_HOTSPOTS = False
# FAKE_LDAP_MODE supports using a fake LDAP database in the # FAKE_LDAP_MODE supports using a fake LDAP database in the
# development environment, without needing an LDAP server! # development environment, without needing an LDAP server!
@@ -112,7 +112,7 @@ ALWAYS_SEND_ALL_HOTSPOTS = False # type: bool
# (C) If LDAP usernames are completely unrelated to email addresses. # (C) If LDAP usernames are completely unrelated to email addresses.
# #
# Fake LDAP data has e.g. ("ldapuser1", "ldapuser1@zulip.com") for username/email. # Fake LDAP data has e.g. ("ldapuser1", "ldapuser1@zulip.com") for username/email.
FAKE_LDAP_MODE = None # type: Optional[str] FAKE_LDAP_MODE: Optional[str] = None
# FAKE_LDAP_NUM_USERS = 8 # FAKE_LDAP_NUM_USERS = 8
if FAKE_LDAP_MODE: if FAKE_LDAP_MODE:

View File

@@ -1,4 +1,4 @@
from typing import Any, Dict, Optional, Tuple from typing import Any, Dict, Tuple
################################################################ ################################################################
# Zulip Server settings. # Zulip Server settings.
@@ -115,7 +115,7 @@ EXTERNAL_HOST = 'zulip.example.com'
# The install process requires EmailAuthBackend (the default) to be # The install process requires EmailAuthBackend (the default) to be
# enabled. If you want to disable it, do so after creating the # enabled. If you want to disable it, do so after creating the
# initial realm and user. # initial realm and user.
AUTHENTICATION_BACKENDS = ( AUTHENTICATION_BACKENDS: Tuple[str, ...] = (
'zproject.backends.EmailAuthBackend', # Email and password; just requires SMTP setup 'zproject.backends.EmailAuthBackend', # Email and password; just requires SMTP setup
# 'zproject.backends.GoogleAuthBackend', # Google auth, setup below # 'zproject.backends.GoogleAuthBackend', # Google auth, setup below
# 'zproject.backends.GitHubAuthBackend', # GitHub auth, setup below # 'zproject.backends.GitHubAuthBackend', # GitHub auth, setup below
@@ -125,7 +125,7 @@ AUTHENTICATION_BACKENDS = (
# 'zproject.backends.SAMLAuthBackend', # SAML, setup below # 'zproject.backends.SAMLAuthBackend', # SAML, setup below
# 'zproject.backends.ZulipLDAPAuthBackend', # LDAP, setup below # 'zproject.backends.ZulipLDAPAuthBackend', # LDAP, setup below
# 'zproject.backends.ZulipRemoteUserBackend', # Local SSO, setup docs on readthedocs # 'zproject.backends.ZulipRemoteUserBackend', # Local SSO, setup docs on readthedocs
) # type: Tuple[str, ...] )
######## ########
# Google OAuth. # Google OAuth.
@@ -267,12 +267,12 @@ SOCIAL_AUTH_SAML_ENABLED_IDPS = {
}, },
} }
SOCIAL_AUTH_SAML_SECURITY_CONFIG = { SOCIAL_AUTH_SAML_SECURITY_CONFIG: Dict[str, Any] = {
# If you've set up the optional private and public server keys, # If you've set up the optional private and public server keys,
# set this to True to enable signing of SAMLRequests using the # set this to True to enable signing of SAMLRequests using the
# private key. # private key.
"authnRequestsSigned": False, "authnRequestsSigned": False,
} # type: Dict[str, Any] }
# These SAML settings you likely won't need to modify. # These SAML settings you likely won't need to modify.
SOCIAL_AUTH_SAML_SP_ENTITY_ID = 'https://' + EXTERNAL_HOST SOCIAL_AUTH_SAML_SP_ENTITY_ID = 'https://' + EXTERNAL_HOST
@@ -317,10 +317,11 @@ SOCIAL_AUTH_SAML_SUPPORT_CONTACT = {
# SSO via REMOTE_USER. # SSO via REMOTE_USER.
# #
# If you are using the ZulipRemoteUserBackend authentication backend, # If you are using the ZulipRemoteUserBackend authentication backend,
# set this to your domain (e.g. if REMOTE_USER is "username" and the # and REMOTE_USER does not already include a domain, set this to your
# corresponding email address is "username@example.com", set # domain (e.g. if REMOTE_USER is "username" and the corresponding
# SSO_APPEND_DOMAIN = "example.com") # email address is "username@example.com", set SSO_APPEND_DOMAIN =
SSO_APPEND_DOMAIN = None # type: Optional[str] # "example.com"), otherwise leave this as None.
#SSO_APPEND_DOMAIN = None
################ ################
# Miscellaneous settings. # Miscellaneous settings.
@@ -548,13 +549,13 @@ AUTH_LDAP_USER_SEARCH = LDAPSearch("ou=users,dc=example,dc=com",
# their email address is "sam@example.com", set LDAP_APPEND_DOMAIN to # their email address is "sam@example.com", set LDAP_APPEND_DOMAIN to
# "example.com". Otherwise, leave LDAP_APPEND_DOMAIN=None and set # "example.com". Otherwise, leave LDAP_APPEND_DOMAIN=None and set
# AUTH_LDAP_REVERSE_EMAIL_SEARCH and AUTH_LDAP_USERNAME_ATTR below. # AUTH_LDAP_REVERSE_EMAIL_SEARCH and AUTH_LDAP_USERNAME_ATTR below.
LDAP_APPEND_DOMAIN = None # type: Optional[str] #LDAP_APPEND_DOMAIN = None
# LDAP attribute to find a user's email address. # LDAP attribute to find a user's email address.
# #
# Leave as None if users log in with their email addresses, # Leave as None if users log in with their email addresses,
# or if using LDAP_APPEND_DOMAIN. # or if using LDAP_APPEND_DOMAIN.
LDAP_EMAIL_ATTR = None # type: Optional[str] #LDAP_EMAIL_ATTR = None
# AUTH_LDAP_REVERSE_EMAIL_SEARCH works like AUTH_LDAP_USER_SEARCH and # AUTH_LDAP_REVERSE_EMAIL_SEARCH works like AUTH_LDAP_USER_SEARCH and
# should query an LDAP user given their email address. It and # should query an LDAP user given their email address. It and