summary refs log tree commit diff
path: root/synapse/streams/events.py
diff options
context:
space:
mode:
authorSean Quah <8349537+squahtx@users.noreply.github.com>2022-02-18 15:57:26 +0000
committerGitHub <noreply@github.com>2022-02-18 15:57:26 +0000
commite6acd3cf4fe6910e99683c2ebe3dd917f0a3ae14 (patch)
treea65f548f8ba5e67a20149d805770166e169a0397 /synapse/streams/events.py
parentFix bug in `StateFilter.return_expanded()` and add some tests. (#12016) (diff)
downloadsynapse-e6acd3cf4fe6910e99683c2ebe3dd917f0a3ae14.tar.xz
Upgrade mypy to version 0.931 (#12030)
Upgrade mypy to 0.931, mypy-zope to 0.3.5 and fix new complaints.
Diffstat (limited to 'synapse/streams/events.py')
-rw-r--r--synapse/streams/events.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/synapse/streams/events.py b/synapse/streams/events.py
index 21591d0bfd..4ec2a713cf 100644
--- a/synapse/streams/events.py
+++ b/synapse/streams/events.py
@@ -37,14 +37,16 @@ class _EventSourcesInner:
     account_data: AccountDataEventSource
 
     def get_sources(self) -> Iterator[Tuple[str, EventSource]]:
-        for attribute in _EventSourcesInner.__attrs_attrs__:  # type: ignore[attr-defined]
+        for attribute in attr.fields(_EventSourcesInner):
             yield attribute.name, getattr(self, attribute.name)
 
 
 class EventSources:
     def __init__(self, hs: "HomeServer"):
         self.sources = _EventSourcesInner(
-            *(attribute.type(hs) for attribute in _EventSourcesInner.__attrs_attrs__)  # type: ignore[attr-defined]
+            # mypy thinks attribute.type is `Optional`, but we know it's never `None` here since
+            # all the attributes of `_EventSourcesInner` are annotated.
+            *(attribute.type(hs) for attribute in attr.fields(_EventSourcesInner))  # type: ignore[misc]
         )
         self.store = hs.get_datastore()