summary refs log tree commit diff
path: root/synapse/storage/relations.py
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2022-01-19 10:59:51 +0000
committerAndrew Morgan <andrew@amorgan.xyz>2022-01-19 10:59:51 +0000
commit20d441848571384622a573f749f9772becf855e7 (patch)
tree82d7fc5028740641eb2bcc52d564a132ed3357cc /synapse/storage/relations.py
parentMerge branch 'release-v1.50' into matrix-org-hotfixes (diff)
parentFix preview of imgur and Tenor URLs. (#11669) (diff)
downloadsynapse-20d441848571384622a573f749f9772becf855e7.tar.xz
Merge branch 'develop' of github.com:matrix-org/synapse into matrix-org-hotfixes
Diffstat (limited to 'synapse/storage/relations.py')
-rw-r--r--synapse/storage/relations.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/synapse/storage/relations.py b/synapse/storage/relations.py

index 10a46b5e82..b1536c1ca4 100644 --- a/synapse/storage/relations.py +++ b/synapse/storage/relations.py
@@ -23,7 +23,7 @@ from synapse.types import JsonDict logger = logging.getLogger(__name__) -@attr.s(slots=True) +@attr.s(slots=True, auto_attribs=True) class PaginationChunk: """Returned by relation pagination APIs. @@ -35,9 +35,9 @@ class PaginationChunk: None then there are no previous results. """ - chunk = attr.ib(type=List[JsonDict]) - next_batch = attr.ib(type=Optional[Any], default=None) - prev_batch = attr.ib(type=Optional[Any], default=None) + chunk: List[JsonDict] + next_batch: Optional[Any] = None + prev_batch: Optional[Any] = None def to_dict(self) -> Dict[str, Any]: d = {"chunk": self.chunk} @@ -51,7 +51,7 @@ class PaginationChunk: return d -@attr.s(frozen=True, slots=True) +@attr.s(frozen=True, slots=True, auto_attribs=True) class RelationPaginationToken: """Pagination token for relation pagination API. @@ -64,8 +64,8 @@ class RelationPaginationToken: stream: The stream ordering of the boundary event. """ - topological = attr.ib(type=int) - stream = attr.ib(type=int) + topological: int + stream: int @staticmethod def from_string(string: str) -> "RelationPaginationToken": @@ -82,7 +82,7 @@ class RelationPaginationToken: return attr.astuple(self) -@attr.s(frozen=True, slots=True) +@attr.s(frozen=True, slots=True, auto_attribs=True) class AggregationPaginationToken: """Pagination token for relation aggregation pagination API. @@ -94,8 +94,8 @@ class AggregationPaginationToken: stream: The MAX stream ordering in the boundary group. """ - count = attr.ib(type=int) - stream = attr.ib(type=int) + count: int + stream: int @staticmethod def from_string(string: str) -> "AggregationPaginationToken":