diff --git a/synapse/handlers/sync.py b/synapse/handlers/sync.py index d83b58adb9..bec53e6a4c 100644 --- a/synapse/handlers/sync.py +++ b/synapse/handlers/sync.py @@ -1536,11 +1536,15 @@ class SyncHandler: await_full_state=await_full_state, ) - state_at_previous_sync_start = {} if since_token.prev_batch is None else await self._state_storage_controller.get_state_ids_at( - room_id, - stream_position=since_token.prev_batch, - state_filter=state_filter, - await_full_state=await_full_state, + state_at_previous_sync_start = ( + {} + if since_token.prev_batch is None + else await self._state_storage_controller.get_state_ids_at( + room_id, + stream_position=since_token.prev_batch, + state_filter=state_filter, + await_full_state=await_full_state, + ) ) state_at_timeline_end = await self._state_storage_controller.get_state_ids_at( diff --git a/synapse/types/__init__.py b/synapse/types/__init__.py index 454da2b815..531aa29d9d 100644 --- a/synapse/types/__init__.py +++ b/synapse/types/__init__.py @@ -988,7 +988,9 @@ class StreamToken: @classmethod @cancellable - async def from_string(cls, store: "DataStore", string: str, prev_batch: Optional["StreamToken"] = None) -> "StreamToken": + async def from_string( + cls, store: "DataStore", string: str, prev_batch: Optional["StreamToken"] = None + ) -> "StreamToken": """ Creates a RoomStreamToken from its textual representation. """ @@ -997,7 +999,9 @@ class StreamToken: # We have a prev_token batches = string.split(cls._BATCH_SEPARATOR) prev_batch = await StreamToken.from_string(store, batches[1]) - batch = await StreamToken.from_string(store, batches[0], prev_batch=prev_batch) + batch = await StreamToken.from_string( + store, batches[0], prev_batch=prev_batch + ) return batch keys = string.split(cls._SEPARATOR) @@ -1036,12 +1040,16 @@ class StreamToken: except Exception: raise SynapseError(400, "Invalid stream token") - async def to_string(self, store: "DataStore", include_prev_batch: bool = True) -> str: + async def to_string( + self, store: "DataStore", include_prev_batch: bool = True + ) -> str: if include_prev_batch and self.prev_batch: - return self._BATCH_SEPARATOR.join([ - await self.to_string(store, include_prev_batch=False), - await self.prev_batch.to_string(store, include_prev_batch=False), - ]) + return self._BATCH_SEPARATOR.join( + [ + await self.to_string(store, include_prev_batch=False), + await self.prev_batch.to_string(store, include_prev_batch=False), + ] + ) else: return self._SEPARATOR.join( [