Bump version of mypy
This commit is contained in:
parent
c965253e4b
commit
495005360c
|
@ -21,6 +21,7 @@ from __future__ import print_function
|
||||||
import email.utils
|
import email.utils
|
||||||
import os
|
import os
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
|
|
||||||
|
@ -101,7 +102,7 @@ class EmailConfig(Config):
|
||||||
# both in RegistrationConfig and here. We should factor this bit out
|
# both in RegistrationConfig and here. We should factor this bit out
|
||||||
self.account_threepid_delegate_email = self.trusted_third_party_id_servers[
|
self.account_threepid_delegate_email = self.trusted_third_party_id_servers[
|
||||||
0
|
0
|
||||||
]
|
] # type: Optional[str]
|
||||||
self.using_identity_server_from_trusted_list = True
|
self.using_identity_server_from_trusted_list = True
|
||||||
else:
|
else:
|
||||||
raise ConfigError(
|
raise ConfigError(
|
||||||
|
|
|
@ -83,10 +83,9 @@ class RatelimitConfig(Config):
|
||||||
)
|
)
|
||||||
|
|
||||||
rc_admin_redaction = config.get("rc_admin_redaction")
|
rc_admin_redaction = config.get("rc_admin_redaction")
|
||||||
|
self.rc_admin_redaction = None
|
||||||
if rc_admin_redaction:
|
if rc_admin_redaction:
|
||||||
self.rc_admin_redaction = RateLimitConfig(rc_admin_redaction)
|
self.rc_admin_redaction = RateLimitConfig(rc_admin_redaction)
|
||||||
else:
|
|
||||||
self.rc_admin_redaction = None
|
|
||||||
|
|
||||||
def generate_config_section(self, **kwargs):
|
def generate_config_section(self, **kwargs):
|
||||||
return """\
|
return """\
|
||||||
|
|
|
@ -200,7 +200,7 @@ class ServerConfig(Config):
|
||||||
self.admin_contact = config.get("admin_contact", None)
|
self.admin_contact = config.get("admin_contact", None)
|
||||||
|
|
||||||
# FIXME: federation_domain_whitelist needs sytests
|
# FIXME: federation_domain_whitelist needs sytests
|
||||||
self.federation_domain_whitelist = None
|
self.federation_domain_whitelist = None # type: Optional[dict]
|
||||||
federation_domain_whitelist = config.get("federation_domain_whitelist", None)
|
federation_domain_whitelist = config.get("federation_domain_whitelist", None)
|
||||||
|
|
||||||
if federation_domain_whitelist is not None:
|
if federation_domain_whitelist is not None:
|
||||||
|
|
|
@ -171,7 +171,7 @@ class LogProducer(object):
|
||||||
|
|
||||||
def stopProducing(self):
|
def stopProducing(self):
|
||||||
self._paused = True
|
self._paused = True
|
||||||
self._buffer = None
|
self._buffer = deque()
|
||||||
|
|
||||||
def resumeProducing(self):
|
def resumeProducing(self):
|
||||||
self._paused = False
|
self._paused = False
|
||||||
|
|
|
@ -405,6 +405,9 @@ class LoggingContext(object):
|
||||||
"""
|
"""
|
||||||
current = get_thread_resource_usage()
|
current = get_thread_resource_usage()
|
||||||
|
|
||||||
|
# Indicate to mypy that we know that self.usage_start is None.
|
||||||
|
assert self.usage_start is not None
|
||||||
|
|
||||||
utime_delta = current.ru_utime - self.usage_start.ru_utime
|
utime_delta = current.ru_utime - self.usage_start.ru_utime
|
||||||
stime_delta = current.ru_stime - self.usage_start.ru_stime
|
stime_delta = current.ru_stime - self.usage_start.ru_stime
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,8 @@
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
from typing import Any, Dict
|
||||||
|
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer
|
||||||
|
|
||||||
from synapse.handlers.account_data import AccountDataEventSource
|
from synapse.handlers.account_data import AccountDataEventSource
|
||||||
|
@ -35,7 +37,7 @@ class EventSources(object):
|
||||||
def __init__(self, hs):
|
def __init__(self, hs):
|
||||||
self.sources = {
|
self.sources = {
|
||||||
name: cls(hs) for name, cls in EventSources.SOURCE_TYPES.items()
|
name: cls(hs) for name, cls in EventSources.SOURCE_TYPES.items()
|
||||||
}
|
} # type: Dict[str, Any]
|
||||||
self.store = hs.get_datastore()
|
self.store = hs.get_datastore()
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
|
|
Loading…
Reference in New Issue