mirror of
https://github.com/element-hq/synapse.git
synced 2024-12-03 16:33:30 +03:00
Lint
This commit is contained in:
parent
70d166e7b5
commit
98c27ab824
2 changed files with 24 additions and 12 deletions
|
@ -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(
|
||||
|
|
|
@ -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(
|
||||
[
|
||||
|
|
Loading…
Reference in a new issue