From 700fcad88225178a049198b53410c74b23e552cb Mon Sep 17 00:00:00 2001 From: Patrick Cloke Date: Mon, 27 Feb 2023 09:28:17 -0500 Subject: [PATCH 1/3] Add missing type hints to InsecureInterceptableContextFactory. --- mypy.ini | 3 --- synapse/http/client.py | 6 ++++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/mypy.ini b/mypy.ini index 94562d0bce10..572734f8e7cf 100644 --- a/mypy.ini +++ b/mypy.ini @@ -36,9 +36,6 @@ exclude = (?x) [mypy-synapse.federation.transport.client] disallow_untyped_defs = False -[mypy-synapse.http.client] -disallow_untyped_defs = False - [mypy-synapse.http.matrixfederationclient] disallow_untyped_defs = False diff --git a/synapse/http/client.py b/synapse/http/client.py index a05f297933ca..89f689f3dc24 100644 --- a/synapse/http/client.py +++ b/synapse/http/client.py @@ -44,6 +44,8 @@ IAddress, IDelayedCall, IHostResolution, + IOpenSSLClientConnectionCreator, + IOpenSSLContextFactory, IReactorCore, IReactorPluggableNameResolver, IReactorTime, @@ -958,8 +960,8 @@ def __init__(self) -> None: self._context = SSL.Context(SSL.SSLv23_METHOD) self._context.set_verify(VERIFY_NONE, lambda *_: False) - def getContext(self, hostname=None, port=None): + def getContext(self) -> SSL.Context: return self._context - def creatorForNetloc(self, hostname: bytes, port: int): + def creatorForNetloc(self, hostname: bytes, port: int) -> IOpenSSLContextFactory: return self From 00ed20b8cd9d8c1801f507ad9415b019e9c003d8 Mon Sep 17 00:00:00 2001 From: Patrick Cloke Date: Mon, 27 Feb 2023 09:38:36 -0500 Subject: [PATCH 2/3] Newsfragment --- changelog.d/15164.misc | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/15164.misc diff --git a/changelog.d/15164.misc b/changelog.d/15164.misc new file mode 100644 index 000000000000..93ceaeafc9b9 --- /dev/null +++ b/changelog.d/15164.misc @@ -0,0 +1 @@ +Improve type hints. From db034fde8ee3a5b93dc2a5af057886a9e4cb55a1 Mon Sep 17 00:00:00 2001 From: Patrick Cloke Date: Mon, 27 Feb 2023 10:07:44 -0500 Subject: [PATCH 3/3] Remove unused import. --- synapse/http/client.py | 1 - 1 file changed, 1 deletion(-) diff --git a/synapse/http/client.py b/synapse/http/client.py index 89f689f3dc24..ae48e7c3f004 100644 --- a/synapse/http/client.py +++ b/synapse/http/client.py @@ -44,7 +44,6 @@ IAddress, IDelayedCall, IHostResolution, - IOpenSSLClientConnectionCreator, IOpenSSLContextFactory, IReactorCore, IReactorPluggableNameResolver,