mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 21:44:52 -04:00
Use inline type hints in various other places (in synapse/
) (#10380)
This commit is contained in:
parent
c7603af1d0
commit
bf72d10dbf
79 changed files with 329 additions and 336 deletions
|
@ -63,9 +63,9 @@ class Auth:
|
|||
self.store = hs.get_datastore()
|
||||
self.state = hs.get_state_handler()
|
||||
|
||||
self.token_cache = LruCache(
|
||||
self.token_cache: LruCache[str, Tuple[str, bool]] = LruCache(
|
||||
10000, "token_cache"
|
||||
) # type: LruCache[str, Tuple[str, bool]]
|
||||
)
|
||||
|
||||
self._auth_blocking = AuthBlocking(self.hs)
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ class RedirectException(CodeMessageException):
|
|||
super().__init__(code=http_code, msg=msg)
|
||||
self.location = location
|
||||
|
||||
self.cookies = [] # type: List[bytes]
|
||||
self.cookies: List[bytes] = []
|
||||
|
||||
|
||||
class SynapseError(CodeMessageException):
|
||||
|
@ -160,7 +160,7 @@ class ProxiedRequestError(SynapseError):
|
|||
):
|
||||
super().__init__(code, msg, errcode)
|
||||
if additional_fields is None:
|
||||
self._additional_fields = {} # type: Dict
|
||||
self._additional_fields: Dict = {}
|
||||
else:
|
||||
self._additional_fields = dict(additional_fields)
|
||||
|
||||
|
|
|
@ -289,7 +289,7 @@ class Filter:
|
|||
room_id = None
|
||||
ev_type = "m.presence"
|
||||
contains_url = False
|
||||
labels = [] # type: List[str]
|
||||
labels: List[str] = []
|
||||
else:
|
||||
sender = event.get("sender", None)
|
||||
if not sender:
|
||||
|
|
|
@ -46,9 +46,7 @@ class Ratelimiter:
|
|||
# * How many times an action has occurred since a point in time
|
||||
# * The point in time
|
||||
# * The rate_hz of this particular entry. This can vary per request
|
||||
self.actions = (
|
||||
OrderedDict()
|
||||
) # type: OrderedDict[Hashable, Tuple[float, int, float]]
|
||||
self.actions: OrderedDict[Hashable, Tuple[float, int, float]] = OrderedDict()
|
||||
|
||||
async def can_do_action(
|
||||
self,
|
||||
|
|
|
@ -195,7 +195,7 @@ class RoomVersions:
|
|||
)
|
||||
|
||||
|
||||
KNOWN_ROOM_VERSIONS = {
|
||||
KNOWN_ROOM_VERSIONS: Dict[str, RoomVersion] = {
|
||||
v.identifier: v
|
||||
for v in (
|
||||
RoomVersions.V1,
|
||||
|
@ -209,4 +209,4 @@ KNOWN_ROOM_VERSIONS = {
|
|||
RoomVersions.V7,
|
||||
)
|
||||
# Note that we do not include MSC2043 here unless it is enabled in the config.
|
||||
} # type: Dict[str, RoomVersion]
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue