Improve type hints in storage classes. (#11652)

By using cast and making ignores more specific.
This commit is contained in:
Dirk Klimpel 2021-12-29 14:04:28 +01:00 committed by GitHub
parent f58b300d27
commit f82d38ed2e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 44 additions and 34 deletions

View file

@ -23,6 +23,7 @@ from typing import (
Optional,
Tuple,
Union,
cast,
)
from synapse.storage._base import SQLBaseStore
@ -220,7 +221,7 @@ class MediaRepositoryStore(MediaRepositoryBackgroundUpdateStore):
WHERE user_id = ?
"""
txn.execute(sql, args)
count = txn.fetchone()[0] # type: ignore[index]
count = cast(Tuple[int], txn.fetchone())[0]
sql = """
SELECT