summary refs log tree commit diff
path: root/synapse/http/additional_resource.py
diff options
context:
space:
mode:
authorDirk Klimpel <5740567+dklimpel@users.noreply.github.com>2021-08-18 19:53:20 +0200
committerGitHub <noreply@github.com>2021-08-18 13:53:20 -0400
commit0c3565da4cdbe53646ae0bc737900526a1d3df67 (patch)
tree2daef7c6b7db3a336f7b7dd187981ac46f68dbec /synapse/http/additional_resource.py
parentMerge branch 'release-v1.41' into develop (diff)
downloadsynapse-0c3565da4cdbe53646ae0bc737900526a1d3df67.tar.xz
Additional type hints for the proxy agent and SRV resolver modules. (#10608)
Diffstat (limited to 'synapse/http/additional_resource.py')
-rw-r--r--synapse/http/additional_resource.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/synapse/http/additional_resource.py b/synapse/http/additional_resource.py
index 55ea97a07f..9a2684aca4 100644
--- a/synapse/http/additional_resource.py
+++ b/synapse/http/additional_resource.py
@@ -12,8 +12,15 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+from typing import TYPE_CHECKING
+
+from twisted.web.server import Request
+
 from synapse.http.server import DirectServeJsonResource
 
+if TYPE_CHECKING:
+    from synapse.server import HomeServer
+
 
 class AdditionalResource(DirectServeJsonResource):
     """Resource wrapper for additional_resources
@@ -25,7 +32,7 @@ class AdditionalResource(DirectServeJsonResource):
     and exception handling.
     """
 
-    def __init__(self, hs, handler):
+    def __init__(self, hs: "HomeServer", handler):
         """Initialise AdditionalResource
 
         The ``handler`` should return a deferred which completes when it has
@@ -33,14 +40,14 @@ class AdditionalResource(DirectServeJsonResource):
         ``request.write()``, and call ``request.finish()``.
 
         Args:
-            hs (synapse.server.HomeServer): homeserver
+            hs: homeserver
             handler ((twisted.web.server.Request) -> twisted.internet.defer.Deferred):
                 function to be called to handle the request.
         """
         super().__init__()
         self._handler = handler
 
-    def _async_render(self, request):
+    def _async_render(self, request: Request):
         # Cheekily pass the result straight through, so we don't need to worry
         # if its an awaitable or not.
         return self._handler(request)