mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-05 12:34:58 -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
|
@ -86,7 +86,7 @@ class FederationClient(FederationBase):
|
|||
def __init__(self, hs: "HomeServer"):
|
||||
super().__init__(hs)
|
||||
|
||||
self.pdu_destination_tried = {} # type: Dict[str, Dict[str, int]]
|
||||
self.pdu_destination_tried: Dict[str, Dict[str, int]] = {}
|
||||
self._clock.looping_call(self._clear_tried_cache, 60 * 1000)
|
||||
self.state = hs.get_state_handler()
|
||||
self.transport_layer = hs.get_federation_transport_client()
|
||||
|
@ -94,13 +94,13 @@ class FederationClient(FederationBase):
|
|||
self.hostname = hs.hostname
|
||||
self.signing_key = hs.signing_key
|
||||
|
||||
self._get_pdu_cache = ExpiringCache(
|
||||
self._get_pdu_cache: ExpiringCache[str, EventBase] = ExpiringCache(
|
||||
cache_name="get_pdu_cache",
|
||||
clock=self._clock,
|
||||
max_len=1000,
|
||||
expiry_ms=120 * 1000,
|
||||
reset_expiry_on_get=False,
|
||||
) # type: ExpiringCache[str, EventBase]
|
||||
)
|
||||
|
||||
def _clear_tried_cache(self):
|
||||
"""Clear pdu_destination_tried cache"""
|
||||
|
@ -293,10 +293,10 @@ class FederationClient(FederationBase):
|
|||
transaction_data,
|
||||
)
|
||||
|
||||
pdu_list = [
|
||||
pdu_list: List[EventBase] = [
|
||||
event_from_pdu_json(p, room_version, outlier=outlier)
|
||||
for p in transaction_data["pdus"]
|
||||
] # type: List[EventBase]
|
||||
]
|
||||
|
||||
if pdu_list and pdu_list[0]:
|
||||
pdu = pdu_list[0]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue