mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-06 11:55:04 -04:00
Convert all namedtuples to attrs. (#11665)
To improve type hints throughout the code.
This commit is contained in:
parent
07a3b5daba
commit
cbd82d0b2d
22 changed files with 231 additions and 206 deletions
|
@ -14,7 +14,6 @@
|
|||
# limitations under the License.
|
||||
import collections.abc
|
||||
import logging
|
||||
from collections import namedtuple
|
||||
from typing import TYPE_CHECKING, Iterable, Optional, Set
|
||||
|
||||
from synapse.api.constants import EventTypes, Membership
|
||||
|
@ -43,19 +42,6 @@ logger = logging.getLogger(__name__)
|
|||
MAX_STATE_DELTA_HOPS = 100
|
||||
|
||||
|
||||
class _GetStateGroupDelta(
|
||||
namedtuple("_GetStateGroupDelta", ("prev_group", "delta_ids"))
|
||||
):
|
||||
"""Return type of get_state_group_delta that implements __len__, which lets
|
||||
us use the itrable flag when caching
|
||||
"""
|
||||
|
||||
__slots__ = []
|
||||
|
||||
def __len__(self):
|
||||
return len(self.delta_ids) if self.delta_ids else 0
|
||||
|
||||
|
||||
# this inherits from EventsWorkerStore because it calls self.get_events
|
||||
class StateGroupWorkerStore(EventsWorkerStore, SQLBaseStore):
|
||||
"""The parts of StateGroupStore that can be called from workers."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue