mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-06 13:04:21 -04:00
Require type hints in the handlers module. (#10831)
Adds missing type hints to methods in the synapse.handlers module and requires all methods to have type hints there. This also removes the unused construct_auth_difference method from the FederationHandler.
This commit is contained in:
parent
437961744c
commit
b3590614da
35 changed files with 194 additions and 295 deletions
|
@ -14,7 +14,7 @@
|
|||
|
||||
import logging
|
||||
from collections import namedtuple
|
||||
from typing import TYPE_CHECKING, Optional, Tuple
|
||||
from typing import TYPE_CHECKING, Any, Optional, Tuple
|
||||
|
||||
import msgpack
|
||||
from unpaddedbase64 import decode_base64, encode_base64
|
||||
|
@ -33,7 +33,7 @@ from synapse.api.errors import (
|
|||
SynapseError,
|
||||
)
|
||||
from synapse.types import JsonDict, ThirdPartyInstanceID
|
||||
from synapse.util.caches.descriptors import cached
|
||||
from synapse.util.caches.descriptors import _CacheContext, cached
|
||||
from synapse.util.caches.response_cache import ResponseCache
|
||||
|
||||
from ._base import BaseHandler
|
||||
|
@ -169,7 +169,7 @@ class RoomListHandler(BaseHandler):
|
|||
ignore_non_federatable=from_federation,
|
||||
)
|
||||
|
||||
def build_room_entry(room):
|
||||
def build_room_entry(room: JsonDict) -> JsonDict:
|
||||
entry = {
|
||||
"room_id": room["room_id"],
|
||||
"name": room["name"],
|
||||
|
@ -249,10 +249,10 @@ class RoomListHandler(BaseHandler):
|
|||
self,
|
||||
room_id: str,
|
||||
num_joined_users: int,
|
||||
cache_context,
|
||||
cache_context: _CacheContext,
|
||||
with_alias: bool = True,
|
||||
allow_private: bool = False,
|
||||
) -> Optional[dict]:
|
||||
) -> Optional[JsonDict]:
|
||||
"""Returns the entry for a room
|
||||
|
||||
Args:
|
||||
|
@ -507,7 +507,7 @@ class RoomListNextBatch(
|
|||
)
|
||||
)
|
||||
|
||||
def copy_and_replace(self, **kwds) -> "RoomListNextBatch":
|
||||
def copy_and_replace(self, **kwds: Any) -> "RoomListNextBatch":
|
||||
return self._replace(**kwds)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue