Upgrade mypy to version 0.931 (#12030)

Upgrade mypy to 0.931, mypy-zope to 0.3.5 and fix new complaints.
This commit is contained in:
Sean Quah 2022-02-18 15:57:26 +00:00 committed by GitHub
parent eb609c65d0
commit e6acd3cf4f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 33 additions and 19 deletions

View file

@ -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()