Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
erikjohnston committed Jun 27, 2022
1 parent ad94c6b commit 7603dcd
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
3 changes: 1 addition & 2 deletions synapse/storage/databases/main/event_push_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
LoggingDatabaseConnection,
LoggingTransaction,
)
from synapse.storage.databases.main.events_worker import EventsWorkerStore
from synapse.storage.databases.main.receipts import ReceiptsWorkerStore
from synapse.storage.databases.main.stream import StreamWorkerStore
from synapse.util import json_encoder
Expand Down Expand Up @@ -219,7 +218,7 @@ def _get_unread_counts_by_receipt_txn(
retcol="event_id",
)

stream_ordering = self.get_stream_id_for_event_txn(txn, event_id) # type: ignore[attr-defined]
stream_ordering = self.get_stream_id_for_event_txn(txn, event_id)

return self._get_unread_counts_by_pos_txn(
txn, room_id, user_id, stream_ordering
Expand Down
28 changes: 28 additions & 0 deletions synapse/storage/databases/main/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,12 @@
Collection,
Dict,
List,
Literal,
Optional,
Set,
Tuple,
cast,
overload,
)

import attr
Expand Down Expand Up @@ -795,6 +797,32 @@ async def get_current_room_stream_token_for_room_id(
)
return RoomStreamToken(topo, stream_ordering)

@overload
def get_stream_id_for_event_txn(
self,
txn: LoggingTransaction,
event_id: str,
allow_none: Literal[True],
) -> int:
...

@overload
def get_stream_id_for_event_txn(
self,
txn: LoggingTransaction,
event_id: str,
) -> int:
...

@overload
def get_stream_id_for_event_txn(
self,
txn: LoggingTransaction,
event_id: str,
allow_none: bool = False,
) -> Optional[int]:
...

def get_stream_id_for_event_txn(
self,
txn: LoggingTransaction,
Expand Down

0 comments on commit 7603dcd

Please sign in to comment.