Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 539e441

Browse files
authored
Use auto_attribs for RefreshTokenLookupResult (#11386)
1 parent 4bd54b2 commit 539e441

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

changelog.d/11386.misc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Use `auto_attribs` on the `attrs` class `RefreshTokenLookupResult`.

synapse/storage/databases/main/registration.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -84,26 +84,26 @@ def _default_token_owner(self):
8484
return self.user_id
8585

8686

87-
@attr.s(frozen=True, slots=True)
87+
@attr.s(auto_attribs=True, frozen=True, slots=True)
8888
class RefreshTokenLookupResult:
8989
"""Result of looking up a refresh token."""
9090

91-
user_id = attr.ib(type=str)
91+
user_id: str
9292
"""The user this token belongs to."""
9393

94-
device_id = attr.ib(type=str)
94+
device_id: str
9595
"""The device associated with this refresh token."""
9696

97-
token_id = attr.ib(type=int)
97+
token_id: int
9898
"""The ID of this refresh token."""
9999

100-
next_token_id = attr.ib(type=Optional[int])
100+
next_token_id: Optional[int]
101101
"""The ID of the refresh token which replaced this one."""
102102

103-
has_next_refresh_token_been_refreshed = attr.ib(type=bool)
103+
has_next_refresh_token_been_refreshed: bool
104104
"""True if the next refresh token was used for another refresh."""
105105

106-
has_next_access_token_been_used = attr.ib(type=bool)
106+
has_next_access_token_been_used: bool
107107
"""True if the next access token was already used at least once."""
108108

109109

0 commit comments

Comments
 (0)