diff options
author | Dirk Klimpel <5740567+dklimpel@users.noreply.github.com> | 2021-12-29 14:04:28 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-29 13:04:28 +0000 |
commit | f82d38ed2e8e07c81a0d60f31401e3edecd5e57f (patch) | |
tree | 0dd17fb84983341a160d7ed6d189f52ef63006bb /synapse/storage/databases/main/registration.py | |
parent | Do not attempt to bundled aggregations for /members and /state. (#11623) (diff) | |
download | synapse-f82d38ed2e8e07c81a0d60f31401e3edecd5e57f.tar.xz |
Improve type hints in storage classes. (#11652)
By using cast and making ignores more specific.
Diffstat (limited to 'synapse/storage/databases/main/registration.py')
-rw-r--r-- | synapse/storage/databases/main/registration.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/synapse/storage/databases/main/registration.py b/synapse/storage/databases/main/registration.py index 29d9d4de96..4175c82a25 100644 --- a/synapse/storage/databases/main/registration.py +++ b/synapse/storage/databases/main/registration.py @@ -16,7 +16,7 @@ import logging import random import re -from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union +from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union, cast import attr @@ -1357,12 +1357,15 @@ class RegistrationWorkerStore(CacheInvalidationWorkerStore): # Override type because the return type is only optional if # allow_none is True, and we don't want mypy throwing errors # about None not being indexable. - res: Dict[str, Any] = self.db_pool.simple_select_one_txn( - txn, - "registration_tokens", - keyvalues={"token": token}, - retcols=["pending", "completed"], - ) # type: ignore + res = cast( + Dict[str, Any], + self.db_pool.simple_select_one_txn( + txn, + "registration_tokens", + keyvalues={"token": token}, + retcols=["pending", "completed"], + ), + ) # Decrement pending and increment completed self.db_pool.simple_update_one_txn( |