mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-08 00:52:11 -04:00
Use inline type hints in http/federation/
, storage/
and util/
(#10381)
This commit is contained in:
parent
3acf85c85f
commit
bdfde6dca1
38 changed files with 149 additions and 161 deletions
|
@ -112,7 +112,7 @@ class StreamIdGenerator:
|
|||
# insertion ordering will ensure its in the correct ordering.
|
||||
#
|
||||
# The key and values are the same, but we never look at the values.
|
||||
self._unfinished_ids = OrderedDict() # type: OrderedDict[int, int]
|
||||
self._unfinished_ids: OrderedDict[int, int] = OrderedDict()
|
||||
|
||||
def get_next(self):
|
||||
"""
|
||||
|
@ -236,15 +236,15 @@ class MultiWriterIdGenerator:
|
|||
# Note: If we are a negative stream then we still store all the IDs as
|
||||
# positive to make life easier for us, and simply negate the IDs when we
|
||||
# return them.
|
||||
self._current_positions = {} # type: Dict[str, int]
|
||||
self._current_positions: Dict[str, int] = {}
|
||||
|
||||
# Set of local IDs that we're still processing. The current position
|
||||
# should be less than the minimum of this set (if not empty).
|
||||
self._unfinished_ids = set() # type: Set[int]
|
||||
self._unfinished_ids: Set[int] = set()
|
||||
|
||||
# Set of local IDs that we've processed that are larger than the current
|
||||
# position, due to there being smaller unpersisted IDs.
|
||||
self._finished_ids = set() # type: Set[int]
|
||||
self._finished_ids: Set[int] = set()
|
||||
|
||||
# We track the max position where we know everything before has been
|
||||
# persisted. This is done by a) looking at the min across all instances
|
||||
|
@ -265,7 +265,7 @@ class MultiWriterIdGenerator:
|
|||
self._persisted_upto_position = (
|
||||
min(self._current_positions.values()) if self._current_positions else 1
|
||||
)
|
||||
self._known_persisted_positions = [] # type: List[int]
|
||||
self._known_persisted_positions: List[int] = []
|
||||
|
||||
self._sequence_gen = PostgresSequenceGenerator(sequence_name)
|
||||
|
||||
|
@ -465,7 +465,7 @@ class MultiWriterIdGenerator:
|
|||
self._unfinished_ids.discard(next_id)
|
||||
self._finished_ids.add(next_id)
|
||||
|
||||
new_cur = None # type: Optional[int]
|
||||
new_cur: Optional[int] = None
|
||||
|
||||
if self._unfinished_ids:
|
||||
# If there are unfinished IDs then the new position will be the
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue