Skip to content
Snippets Groups Projects
Commit 1987c330 authored by Daniel Brötzmann's avatar Daniel Brötzmann
Browse files

chore: Iq: Add type annotations

parent 20b33a7e
No related branches found
No related tags found
No related merge requests found
......@@ -14,10 +14,15 @@
# Iq handler
from __future__ import annotations
import nbxmpp
from nbxmpp.protocol import Iq
from nbxmpp.structs import IqProperties
from nbxmpp.structs import StanzaHandler
from gajim.common import app
from gajim.common import types
from gajim.common.events import FileRequestError
from gajim.common.events import FileSendError
from gajim.common.helpers import to_user_string
......@@ -26,7 +31,7 @@
class Iq(BaseModule):
def __init__(self, con):
def __init__(self, con: types.Client) -> None:
BaseModule.__init__(self, con)
self.handlers = [
......@@ -36,7 +41,11 @@ def __init__(self, con):
priority=51),
]
def _iq_error_received(self, _con, _stanza, properties):
def _iq_error_received(self,
_con: types.xmppClient,
_stanza: Iq,
properties: IqProperties
) -> None:
self._log.info('Error: %s', properties.error)
if properties.error.condition in ('jid-malformed',
'forbidden',
......@@ -78,7 +87,7 @@ def _iq_error_received(self, _con, _stanza, properties):
raise nbxmpp.NodeProcessed
@staticmethod
def _get_sid(id_):
def _get_sid(id_: str) -> str:
sid = id_
if len(id_) > 3 and id_[2] == '_':
sid = id_[3:]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment