6464from synapse .replication .tcp .streams import PresenceFederationStream , PresenceStream
6565from synapse .storage .databases .main import DataStore
6666from synapse .streams import EventSource
67- from synapse .types import JsonDict , StreamKeyType , UserID , get_domain_from_id
67+ from synapse .types import (
68+ JsonDict ,
69+ StrCollection ,
70+ StreamKeyType ,
71+ UserID ,
72+ get_domain_from_id ,
73+ )
6874from synapse .util .async_helpers import Linearizer
6975from synapse .util .metrics import Measure
7076from synapse .util .wheel_timer import WheelTimer
@@ -320,7 +326,7 @@ async def maybe_send_presence_to_interested_destinations(
320326 for destination , host_states in hosts_to_states .items ():
321327 self ._federation .send_presence_to_destinations (host_states , [destination ])
322328
323- async def send_full_presence_to_users (self , user_ids : Collection [ str ] ) -> None :
329+ async def send_full_presence_to_users (self , user_ids : StrCollection ) -> None :
324330 """
325331 Adds to the list of users who should receive a full snapshot of presence
326332 upon their next sync. Note that this only works for local users.
@@ -1601,7 +1607,7 @@ async def get_new_events(
16011607 # Having a default limit doesn't match the EventSource API, but some
16021608 # callers do not provide it. It is unused in this class.
16031609 limit : int = 0 ,
1604- room_ids : Optional [Collection [ str ] ] = None ,
1610+ room_ids : Optional [StrCollection ] = None ,
16051611 is_guest : bool = False ,
16061612 explicit_room_id : Optional [str ] = None ,
16071613 include_offline : bool = True ,
@@ -1688,7 +1694,7 @@ async def get_new_events(
16881694
16891695 # The set of users that we're interested in and that have had a presence update.
16901696 # We'll actually pull the presence updates for these users at the end.
1691- interested_and_updated_users : Collection [ str ]
1697+ interested_and_updated_users : StrCollection
16921698
16931699 if from_key is not None :
16941700 # First get all users that have had a presence update
@@ -2120,7 +2126,7 @@ def __init__(self, hs: "HomeServer", presence_handler: BasePresenceHandler):
21202126 # stream_id, destinations, user_ids)`. We don't store the full states
21212127 # for efficiency, and remote workers will already have the full states
21222128 # cached.
2123- self ._queue : List [Tuple [int , int , Collection [ str ] , Set [str ]]] = []
2129+ self ._queue : List [Tuple [int , int , StrCollection , Set [str ]]] = []
21242130
21252131 self ._next_id = 1
21262132
@@ -2142,7 +2148,7 @@ def _clear_queue(self) -> None:
21422148 self ._queue = self ._queue [index :]
21432149
21442150 def send_presence_to_destinations (
2145- self , states : Collection [UserPresenceState ], destinations : Collection [ str ]
2151+ self , states : Collection [UserPresenceState ], destinations : StrCollection
21462152 ) -> None :
21472153 """Send the presence states to the given destinations.
21482154
0 commit comments