diff options
author | Will Hunt <will@half-shot.uk> | 2020-10-01 14:50:29 +0100 |
---|---|---|
committer | Will Hunt <will@half-shot.uk> | 2020-10-01 15:00:14 +0100 |
commit | 97d173991098ea6221c21fbe2b044f5173b182e4 (patch) | |
tree | 801c62cfbb77de9fdafcbe1407e26f56333a2b40 /synapse/storage | |
parent | changelog (diff) | |
download | synapse-97d173991098ea6221c21fbe2b044f5173b182e4.tar.xz |
Fixup types
Diffstat (limited to 'synapse/storage')
-rw-r--r-- | synapse/storage/databases/main/appservice.py | 17 | ||||
-rw-r--r-- | synapse/storage/databases/main/receipts.py | 4 |
2 files changed, 16 insertions, 5 deletions
diff --git a/synapse/storage/databases/main/appservice.py b/synapse/storage/databases/main/appservice.py index b29ce1d1be..a1d3f4be16 100644 --- a/synapse/storage/databases/main/appservice.py +++ b/synapse/storage/databases/main/appservice.py @@ -15,9 +15,11 @@ # limitations under the License. import logging import re +from typing import Any, List, Optional -from synapse.appservice import AppServiceTransaction +from synapse.appservice import ApplicationService, AppServiceTransaction from synapse.config.appservice import load_appservices +from synapse.events import EventBase from synapse.storage._base import SQLBaseStore, db_to_json from synapse.storage.database import DatabasePool from synapse.storage.databases.main.events_worker import EventsWorkerStore @@ -172,7 +174,12 @@ class ApplicationServiceTransactionWorkerStore( "application_services_state", {"as_id": service.id}, {"state": state} ) - async def create_appservice_txn(self, service, events, ephemeral=None): + async def create_appservice_txn( + self, + service: ApplicationService, + events: List[EventBase], + ephemeral: Optional[Any] = None, + ): """Atomically creates a new transaction for this application service with the given list of events. @@ -353,7 +360,9 @@ class ApplicationServiceTransactionWorkerStore( return upper_bound, events - async def get_type_stream_id_for_appservice(self, service, type: str) -> int: + async def get_type_stream_id_for_appservice( + self, service: ApplicationService, type: str + ) -> int: def get_type_stream_id_for_appservice_txn(txn): stream_id_type = "%s_stream_id" % type txn.execute( @@ -371,7 +380,7 @@ class ApplicationServiceTransactionWorkerStore( ) async def set_type_stream_id_for_appservice( - self, service, type: str, pos: int + self, service: ApplicationService, type: str, pos: int ) -> None: def set_type_stream_id_for_appservice_txn(txn): stream_id_type = "%s_stream_id" % type diff --git a/synapse/storage/databases/main/receipts.py b/synapse/storage/databases/main/receipts.py index d26c315ed4..66862acb7d 100644 --- a/synapse/storage/databases/main/receipts.py +++ b/synapse/storage/databases/main/receipts.py @@ -284,7 +284,9 @@ class ReceiptsWorkerStore(SQLBaseStore, metaclass=abc.ABCMeta): return results @cached(num_args=2,) - async def _get_linearized_receipts_for_all_rooms(self, to_key, from_key=None): + async def _get_linearized_receipts_for_all_rooms( + self, to_key: int, from_key: Optional[int] = None + ): def f(txn): if from_key: sql = """ |