Commit ed3bb878 authored by mathieui's avatar mathieui

handler: fix more types

parent f2d7e86f
...@@ -8,8 +8,9 @@ from __future__ import annotations ...@@ -8,8 +8,9 @@ from __future__ import annotations
import weakref import weakref
from weakref import ReferenceType 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 slixmpp.xmlstream.matcher.base import MatcherBase
from xml.etree.ElementTree import Element
if TYPE_CHECKING: if TYPE_CHECKING:
from slixmpp.xmlstream import XMLStream, StanzaBase from slixmpp.xmlstream import XMLStream, StanzaBase
......
...@@ -45,13 +45,13 @@ class Callback(BaseHandler): ...@@ -45,13 +45,13 @@ class Callback(BaseHandler):
""" """
_once: bool _once: bool
_instream: bool _instream: bool
_pointer: Callable[[StanzaBase], Any]
def __init__(self, name: str, matcher: MatcherBase, def __init__(self, name: str, matcher: MatcherBase,
pointer: Callable[[StanzaBase], Any], pointer: Callable[[StanzaBase], Any],
once: bool = False, instream: bool = False, once: bool = False, instream: bool = False,
stream: Optional[XMLStream] = None): stream: Optional[XMLStream] = None):
BaseHandler.__init__(self, name, matcher, stream) BaseHandler.__init__(self, name, matcher, stream)
self._pointer: Callable[[StanzaBase], Any] = pointer
self._pointer = pointer self._pointer = pointer
self._once = once self._once = once
self._instream = instream self._instream = instream
......
...@@ -47,7 +47,6 @@ class CoroutineCallback(BaseHandler): ...@@ -47,7 +47,6 @@ class CoroutineCallback(BaseHandler):
_once: bool _once: bool
_instream: bool _instream: bool
_pointer: CoroutineFunction
def __init__(self, name: str, matcher: MatcherBase, def __init__(self, name: str, matcher: MatcherBase,
pointer: CoroutineFunction, once: bool = False, pointer: CoroutineFunction, once: bool = False,
...@@ -62,7 +61,7 @@ class CoroutineCallback(BaseHandler): ...@@ -62,7 +61,7 @@ class CoroutineCallback(BaseHandler):
except Exception as e: except Exception as e:
stanza.exception(e) stanza.exception(e)
self._pointer = pointer_wrapper self._pointer: CoroutineFunction = pointer_wrapper
self._once = once self._once = once
self._instream = instream self._instream = instream
......
...@@ -8,7 +8,8 @@ from __future__ import annotations ...@@ -8,7 +8,8 @@ from __future__ import annotations
import logging import logging
from asyncio import Event, wait_for, TimeoutError 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 import slixmpp
from slixmpp.xmlstream.stanzabase import StanzaBase from slixmpp.xmlstream.stanzabase import StanzaBase
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment