diff options
author | lovetox <philipp@hoerist.com> | 2021-11-03 02:45:16 +0300 |
---|---|---|
committer | lovetox <philipp@hoerist.com> | 2021-11-03 02:45:16 +0300 |
commit | c3eb064b7f55881c6490c053643f0cf5f7db0153 (patch) | |
tree | c673c33ad9955279abcadb8e601e0995f0dae89b | |
parent | 0c23dfbce9cfcfac850db4d8540e175ceff10ed1 (diff) |
BaseModule: Add annotations
-rw-r--r-- | nbxmpp/modules/base.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/nbxmpp/modules/base.py b/nbxmpp/modules/base.py index 4ea6bc6..428400d 100644 --- a/nbxmpp/modules/base.py +++ b/nbxmpp/modules/base.py @@ -15,21 +15,29 @@ # You should have received a copy of the GNU General Public License # along with this program; If not, see <http://www.gnu.org/licenses/>. +from __future__ import annotations + +from typing import TYPE_CHECKING +from typing import Any + import logging from nbxmpp.util import LogAdapter +if TYPE_CHECKING: + from nbxmpp.client import Client + class BaseModule: - _depends = {} + _depends: dict[str, str] = {} - def __init__(self, client): + def __init__(self, client: Client): logger_name = 'nbxmpp.m.%s' % self.__class__.__name__.lower() self._log = LogAdapter(logging.getLogger(logger_name), {'context': client.log_context}) - def __getattr__(self, name): + def __getattr__(self, name: str) -> Any: if name not in self._depends: raise AttributeError('Unknown method: %s' % name) |