mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-06 13:34:58 -04:00
Use auto_attribs/native type hints for attrs classes. (#11692)
This commit is contained in:
parent
b92a2ff797
commit
10a88ba91c
40 changed files with 300 additions and 307 deletions
|
@ -1177,18 +1177,18 @@ class RoomMemberStore(RoomMemberWorkerStore, RoomMemberBackgroundUpdateStore):
|
|||
await self.db_pool.runInteraction("forget_membership", f)
|
||||
|
||||
|
||||
@attr.s(slots=True)
|
||||
@attr.s(slots=True, auto_attribs=True)
|
||||
class _JoinedHostsCache:
|
||||
"""The cached data used by the `_get_joined_hosts_cache`."""
|
||||
|
||||
# Dict of host to the set of their users in the room at the state group.
|
||||
hosts_to_joined_users = attr.ib(type=Dict[str, Set[str]], factory=dict)
|
||||
hosts_to_joined_users: Dict[str, Set[str]] = attr.Factory(dict)
|
||||
|
||||
# The state group `hosts_to_joined_users` is derived from. Will be an object
|
||||
# if the instance is newly created or if the state is not based on a state
|
||||
# group. (An object is used as a sentinel value to ensure that it never is
|
||||
# equal to anything else).
|
||||
state_group = attr.ib(type=Union[object, int], factory=object)
|
||||
state_group: Union[object, int] = attr.Factory(object)
|
||||
|
||||
def __len__(self):
|
||||
return sum(len(v) for v in self.hosts_to_joined_users.values())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue