mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-06 07:54:59 -04:00
Improve type hints in storage classes. (#11652)
By using cast and making ignores more specific.
This commit is contained in:
parent
f58b300d27
commit
f82d38ed2e
10 changed files with 44 additions and 34 deletions
|
@ -14,7 +14,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
import logging
|
||||
from typing import TYPE_CHECKING, List, Optional, Tuple
|
||||
from typing import TYPE_CHECKING, List, Optional, Tuple, cast
|
||||
|
||||
from synapse.logging import issue9533_logger
|
||||
from synapse.logging.opentracing import log_kv, set_tag, trace
|
||||
|
@ -673,7 +673,7 @@ class DeviceInboxBackgroundUpdateStore(SQLBaseStore):
|
|||
# There's a type mismatch here between how we want to type the row and
|
||||
# what fetchone says it returns, but we silence it because we know that
|
||||
# res can't be None.
|
||||
res: Tuple[Optional[int]] = txn.fetchone() # type: ignore[assignment]
|
||||
res = cast(Tuple[Optional[int]], txn.fetchone())
|
||||
if res[0] is None:
|
||||
# this can only happen if the `device_inbox` table is empty, in which
|
||||
# case we have no work to do.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue