diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2022-11-22 14:08:04 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-22 14:08:04 -0500 |
commit | 6d47b7e32589e816eb766446cc1ff19ea73fc7c1 (patch) | |
tree | 3990c590d8fe0d442233790779b7fa62816ca2b2 /synapse/handlers/set_password.py | |
parent | Apply correct editorconfig to .pyi files (#14526) (diff) | |
download | synapse-6d47b7e32589e816eb766446cc1ff19ea73fc7c1.tar.xz |
Add a type hint for `get_device_handler()` and fix incorrect types. (#14055)
This was the last untyped handler from the HomeServer object. Since it was being treated as Any (and thus unchecked) it was being used incorrectly in a few places.
Diffstat (limited to 'synapse/handlers/set_password.py')
-rw-r--r-- | synapse/handlers/set_password.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/synapse/handlers/set_password.py b/synapse/handlers/set_password.py index 73861bbd40..bd9d0bb34b 100644 --- a/synapse/handlers/set_password.py +++ b/synapse/handlers/set_password.py @@ -15,6 +15,7 @@ import logging from typing import TYPE_CHECKING, Optional from synapse.api.errors import Codes, StoreError, SynapseError +from synapse.handlers.device import DeviceHandler from synapse.types import Requester if TYPE_CHECKING: @@ -29,7 +30,10 @@ class SetPasswordHandler: def __init__(self, hs: "HomeServer"): self.store = hs.get_datastores().main self._auth_handler = hs.get_auth_handler() - self._device_handler = hs.get_device_handler() + # This can only be instantiated on the main process. + device_handler = hs.get_device_handler() + assert isinstance(device_handler, DeviceHandler) + self._device_handler = device_handler async def set_password( self, |