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/receipts.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/receipts.py')
-rw-r--r-- | synapse/handlers/receipts.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/synapse/handlers/receipts.py b/synapse/handlers/receipts.py index c7567ac05f..5881f09ebd 100644 --- a/synapse/handlers/receipts.py +++ b/synapse/handlers/receipts.py @@ -12,11 +12,12 @@ # See the License for the specific language governing permissions and # limitations under the License. import logging -from typing import TYPE_CHECKING, Any, List, Optional, Tuple +from typing import TYPE_CHECKING, Iterable, List, Optional, Tuple from synapse.api.constants import ReadReceiptEventFields from synapse.appservice import ApplicationService from synapse.handlers._base import BaseHandler +from synapse.streams import EventSource from synapse.types import JsonDict, ReadReceipt, UserID, get_domain_from_id if TYPE_CHECKING: @@ -162,7 +163,7 @@ class ReceiptsHandler(BaseHandler): await self.federation_sender.send_read_receipt(receipt) -class ReceiptEventSource: +class ReceiptEventSource(EventSource[int, JsonDict]): def __init__(self, hs: "HomeServer"): self.store = hs.get_datastore() self.config = hs.config @@ -216,7 +217,13 @@ class ReceiptEventSource: return visible_events async def get_new_events( - self, from_key: int, room_ids: List[str], user: UserID, **kwargs: Any + self, + user: UserID, + from_key: int, + limit: Optional[int], + room_ids: Iterable[str], + is_guest: bool, + explicit_room_id: Optional[str] = None, ) -> Tuple[List[JsonDict], int]: from_key = int(from_key) to_key = self.get_current_key() |