diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2021-09-15 08:45:32 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-15 08:45:32 -0400 |
commit | b93259082c7d8d3fe8376a646e130213d90069dc (patch) | |
tree | fe80e790a3f3680a0738523645ac696ee8a92133 /synapse/rest/well_known.py | |
parent | Use direct references for some configuration variables (part 2) (#10812) (diff) | |
download | synapse-b93259082c7d8d3fe8376a646e130213d90069dc.tar.xz |
Add missing type hints to non-client REST servlets. (#10817)
Including admin, consent, key, synapse, and media. All REST servlets (the synapse.rest module) now require typed method definitions.
Diffstat (limited to '')
-rw-r--r-- | synapse/rest/well_known.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/synapse/rest/well_known.py b/synapse/rest/well_known.py index 6a66a88c53..c80a3a99aa 100644 --- a/synapse/rest/well_known.py +++ b/synapse/rest/well_known.py @@ -13,26 +13,26 @@ # limitations under the License. import logging +from typing import TYPE_CHECKING, Optional from twisted.web.resource import Resource +from twisted.web.server import Request from synapse.http.server import set_cors_headers +from synapse.types import JsonDict from synapse.util import json_encoder +if TYPE_CHECKING: + from synapse.server import HomeServer + logger = logging.getLogger(__name__) class WellKnownBuilder: - """Utility to construct the well-known response - - Args: - hs (synapse.server.HomeServer): - """ - - def __init__(self, hs): + def __init__(self, hs: "HomeServer"): self._config = hs.config - def get_well_known(self): + def get_well_known(self) -> Optional[JsonDict]: # if we don't have a public_baseurl, we can't help much here. if self._config.server.public_baseurl is None: return None @@ -52,11 +52,11 @@ class WellKnownResource(Resource): isLeaf = 1 - def __init__(self, hs): + def __init__(self, hs: "HomeServer"): Resource.__init__(self) self._well_known_builder = WellKnownBuilder(hs) - def render_GET(self, request): + def render_GET(self, request: Request) -> bytes: set_cors_headers(request) r = self._well_known_builder.get_well_known() if not r: |