diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2021-09-21 13:34:26 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-21 13:34:26 -0400 |
commit | 4054dfa409fa17b45ab8f265813994956ed97bae (patch) | |
tree | 8a2c2a5700dcd62f1b8ad8593d0b25c9c7b32e55 /synapse/handlers/presence.py | |
parent | Add types to http.site (#10867) (diff) | |
download | synapse-4054dfa409fa17b45ab8f265813994956ed97bae.tar.xz |
Add type hints for event streams. (#10856)
Diffstat (limited to 'synapse/handlers/presence.py')
-rw-r--r-- | synapse/handlers/presence.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/synapse/handlers/presence.py b/synapse/handlers/presence.py index 841c8815b0..983c837c66 100644 --- a/synapse/handlers/presence.py +++ b/synapse/handlers/presence.py @@ -65,6 +65,7 @@ from synapse.replication.http.streams import ReplicationGetStreamUpdates from synapse.replication.tcp.commands import ClearUserSyncsCommand from synapse.replication.tcp.streams import PresenceFederationStream, PresenceStream from synapse.storage.databases.main import DataStore +from synapse.streams import EventSource from synapse.types import JsonDict, UserID, get_domain_from_id from synapse.util.async_helpers import Linearizer from synapse.util.caches.descriptors import _CacheContext, cached @@ -1500,7 +1501,7 @@ def format_user_presence_state( return content -class PresenceEventSource: +class PresenceEventSource(EventSource[int, UserPresenceState]): def __init__(self, hs: "HomeServer"): # We can't call get_presence_handler here because there's a cycle: # @@ -1519,10 +1520,11 @@ class PresenceEventSource: self, user: UserID, from_key: Optional[int], + limit: Optional[int] = None, room_ids: Optional[List[str]] = None, - include_offline: bool = True, + is_guest: bool = False, explicit_room_id: Optional[str] = None, - **kwargs: Any, + include_offline: bool = True, ) -> Tuple[List[UserPresenceState], int]: # The process for getting presence events are: # 1. Get the rooms the user is in. |