mirror of
https://github.com/element-hq/synapse.git
synced 2024-11-25 19:15:51 +03:00
Fix and hush Mypy errors
This commit is contained in:
parent
48bac0db0d
commit
a301c63426
4 changed files with 6 additions and 4 deletions
|
@ -64,7 +64,7 @@ HOP_BY_HOP_HEADERS = {
|
||||||
|
|
||||||
if hasattr(Headers, "_canonicalNameCaps"):
|
if hasattr(Headers, "_canonicalNameCaps"):
|
||||||
# Twisted < 24.7.0rc1
|
# Twisted < 24.7.0rc1
|
||||||
_canonicalHeaderName = Headers()._canonicalNameCaps
|
_canonicalHeaderName = Headers()._canonicalNameCaps # type: ignore[attr-defined]
|
||||||
else:
|
else:
|
||||||
# Twisted >= 24.7.0rc1
|
# Twisted >= 24.7.0rc1
|
||||||
# But note that `_encodeName` still exists on prior versions,
|
# But note that `_encodeName` still exists on prior versions,
|
||||||
|
|
|
@ -74,6 +74,7 @@ from synapse.api.errors import (
|
||||||
from synapse.config.homeserver import HomeServerConfig
|
from synapse.config.homeserver import HomeServerConfig
|
||||||
from synapse.logging.context import defer_to_thread, preserve_fn, run_in_background
|
from synapse.logging.context import defer_to_thread, preserve_fn, run_in_background
|
||||||
from synapse.logging.opentracing import active_span, start_active_span, trace_servlet
|
from synapse.logging.opentracing import active_span, start_active_span, trace_servlet
|
||||||
|
from synapse.types import ISynapseReactor
|
||||||
from synapse.util import json_encoder
|
from synapse.util import json_encoder
|
||||||
from synapse.util.caches import intern_dict
|
from synapse.util.caches import intern_dict
|
||||||
from synapse.util.cancellation import is_function_cancellable
|
from synapse.util.cancellation import is_function_cancellable
|
||||||
|
@ -868,7 +869,8 @@ async def _async_write_json_to_request_in_thread(
|
||||||
|
|
||||||
with start_active_span("encode_json_response"):
|
with start_active_span("encode_json_response"):
|
||||||
span = active_span()
|
span = active_span()
|
||||||
json_str = await defer_to_thread(request.reactor, encode, span)
|
reactor: ISynapseReactor = request.reactor # type: ignore
|
||||||
|
json_str = await defer_to_thread(reactor, encode, span)
|
||||||
|
|
||||||
_write_bytes_to_request(request, json_str)
|
_write_bytes_to_request(request, json_str)
|
||||||
|
|
||||||
|
|
|
@ -683,7 +683,7 @@ class SynapseSite(ProxySite):
|
||||||
self.access_logger = logging.getLogger(logger_name)
|
self.access_logger = logging.getLogger(logger_name)
|
||||||
self.server_version_string = server_version_string.encode("ascii")
|
self.server_version_string = server_version_string.encode("ascii")
|
||||||
|
|
||||||
def log(self, request: SynapseRequest) -> None:
|
def log(self, request: SynapseRequest) -> None: # type: ignore[override]
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -969,7 +969,7 @@ class CASTestCase(unittest.HomeserverTestCase):
|
||||||
# Test that the response is HTML.
|
# Test that the response is HTML.
|
||||||
self.assertEqual(channel.code, 200, channel.result)
|
self.assertEqual(channel.code, 200, channel.result)
|
||||||
content_type_header_value = ""
|
content_type_header_value = ""
|
||||||
for header in channel.headers.getRawHeaders("Content-Type"):
|
for header in channel.headers.getRawHeaders("Content-Type", []):
|
||||||
content_type_header_value = header
|
content_type_header_value = header
|
||||||
|
|
||||||
self.assertTrue(content_type_header_value.startswith("text/html"))
|
self.assertTrue(content_type_header_value.startswith("text/html"))
|
||||||
|
|
Loading…
Reference in a new issue