From a16792e9905014d8c6e57c614483c321cc99a9b0 Mon Sep 17 00:00:00 2001 From: mathieui Date: Wed, 3 Feb 2021 21:45:58 +0100 Subject: basexmpp: type self.plugins in a more useful manner --- slixmpp/basexmpp.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'slixmpp/basexmpp.py') diff --git a/slixmpp/basexmpp.py b/slixmpp/basexmpp.py index 02c0b21c..47633d8f 100644 --- a/slixmpp/basexmpp.py +++ b/slixmpp/basexmpp.py @@ -11,10 +11,15 @@ :copyright: (c) 2011 Nathanael C. Fritz :license: MIT, see LICENSE for more details """ +from __future__ import annotations import asyncio import logging +from typing import ( + TYPE_CHECKING, +) + from slixmpp import plugins, roster, stanza from slixmpp.api import APIRegistry from slixmpp.exceptions import IqError, IqTimeout @@ -33,6 +38,11 @@ from slixmpp.plugins import PluginManager, load_plugin log = logging.getLogger(__name__) + +if TYPE_CHECKING: + from slixmpp.types import PluginsDict + + class BaseXMPP(XMLStream): """ @@ -44,6 +54,10 @@ class BaseXMPP(XMLStream): is used during initialization. """ + # This is technically not correct, but much more useful to typecheck + # than the internal use of the PluginManager API + plugin: PluginsDict + def __init__(self, jid='', default_ns='jabber:client', **kwargs): XMLStream.__init__(self, **kwargs) -- cgit v1.2.3