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/__init__.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 'synapse/rest/__init__.py')
-rw-r--r-- | synapse/rest/__init__.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/synapse/rest/__init__.py b/synapse/rest/__init__.py index 3adc576124..e04af705eb 100644 --- a/synapse/rest/__init__.py +++ b/synapse/rest/__init__.py @@ -12,7 +12,9 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from synapse.http.server import JsonResource +from typing import TYPE_CHECKING + +from synapse.http.server import HttpServer, JsonResource from synapse.rest import admin from synapse.rest.client import ( account, @@ -57,6 +59,9 @@ from synapse.rest.client import ( voip, ) +if TYPE_CHECKING: + from synapse.server import HomeServer + class ClientRestResource(JsonResource): """Matrix Client API REST resource. @@ -68,12 +73,12 @@ class ClientRestResource(JsonResource): * etc """ - def __init__(self, hs): + def __init__(self, hs: "HomeServer"): JsonResource.__init__(self, hs, canonical_json=False) self.register_servlets(self, hs) @staticmethod - def register_servlets(client_resource, hs): + def register_servlets(client_resource: HttpServer, hs: "HomeServer") -> None: versions.register_servlets(hs, client_resource) # Deprecated in r0 |