From ed3bb878a75c84c2be74d1212226298967ee26e5 Mon Sep 17 00:00:00 2001 From: mathieui Date: Mon, 5 Jul 2021 22:28:38 +0200 Subject: handler: fix more types --- slixmpp/xmlstream/handler/base.py | 3 ++- slixmpp/xmlstream/handler/callback.py | 2 +- slixmpp/xmlstream/handler/coroutine_callback.py | 3 +-- slixmpp/xmlstream/handler/waiter.py | 3 ++- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/slixmpp/xmlstream/handler/base.py b/slixmpp/xmlstream/handler/base.py index e1edb249..0bae5674 100644 --- a/slixmpp/xmlstream/handler/base.py +++ b/slixmpp/xmlstream/handler/base.py @@ -8,8 +8,9 @@ from __future__ import annotations import weakref from weakref import ReferenceType -from typing import Optional, TYPE_CHECKING +from typing import Optional, TYPE_CHECKING, Union from slixmpp.xmlstream.matcher.base import MatcherBase +from xml.etree.ElementTree import Element if TYPE_CHECKING: from slixmpp.xmlstream import XMLStream, StanzaBase diff --git a/slixmpp/xmlstream/handler/callback.py b/slixmpp/xmlstream/handler/callback.py index 5d792bf9..50dd4c66 100644 --- a/slixmpp/xmlstream/handler/callback.py +++ b/slixmpp/xmlstream/handler/callback.py @@ -45,13 +45,13 @@ class Callback(BaseHandler): """ _once: bool _instream: bool - _pointer: Callable[[StanzaBase], Any] def __init__(self, name: str, matcher: MatcherBase, pointer: Callable[[StanzaBase], Any], once: bool = False, instream: bool = False, stream: Optional[XMLStream] = None): BaseHandler.__init__(self, name, matcher, stream) + self._pointer: Callable[[StanzaBase], Any] = pointer self._pointer = pointer self._once = once self._instream = instream diff --git a/slixmpp/xmlstream/handler/coroutine_callback.py b/slixmpp/xmlstream/handler/coroutine_callback.py index d41cd7ba..524cca54 100644 --- a/slixmpp/xmlstream/handler/coroutine_callback.py +++ b/slixmpp/xmlstream/handler/coroutine_callback.py @@ -47,7 +47,6 @@ class CoroutineCallback(BaseHandler): _once: bool _instream: bool - _pointer: CoroutineFunction def __init__(self, name: str, matcher: MatcherBase, pointer: CoroutineFunction, once: bool = False, @@ -62,7 +61,7 @@ class CoroutineCallback(BaseHandler): except Exception as e: stanza.exception(e) - self._pointer = pointer_wrapper + self._pointer: CoroutineFunction = pointer_wrapper self._once = once self._instream = instream diff --git a/slixmpp/xmlstream/handler/waiter.py b/slixmpp/xmlstream/handler/waiter.py index 684bd32f..dde49754 100644 --- a/slixmpp/xmlstream/handler/waiter.py +++ b/slixmpp/xmlstream/handler/waiter.py @@ -8,7 +8,8 @@ from __future__ import annotations import logging from asyncio import Event, wait_for, TimeoutError -from typing import Optional, TYPE_CHECKING +from typing import Optional, TYPE_CHECKING, Union +from xml.etree.ElementTree import Element import slixmpp from slixmpp.xmlstream.stanzabase import StanzaBase -- cgit v1.2.3