typing: add a bunch of type ignores

because this is too smart for mypy and I do not want to rewrite those
things right now.
This commit is contained in:
mathieui 2021-07-05 22:25:38 +02:00
parent fe1a325aa7
commit f2d7e86fc7
6 changed files with 9 additions and 8 deletions

View file

@ -264,9 +264,9 @@ class BaseXMPP(XMLStream):
if not pconfig: if not pconfig:
pconfig = self.plugin_config.get(plugin, {}) pconfig = self.plugin_config.get(plugin, {})
if not self.plugin.registered(plugin): if not self.plugin.registered(plugin): # type: ignore
load_plugin(plugin, module) load_plugin(plugin, module)
self.plugin.enable(plugin, pconfig) self.plugin.enable(plugin, pconfig) # type: ignore
def register_plugins(self): def register_plugins(self):
"""Register and initialize all built-in plugins. """Register and initialize all built-in plugins.

View file

@ -133,8 +133,9 @@ class ClientXMPP(BaseXMPP):
def password(self, value: str) -> None: def password(self, value: str) -> None:
self.credentials['password'] = value self.credentials['password'] = value
def connect(self, address: Optional[Tuple[str, int]] = None, use_ssl: bool = False, def connect(self, address: Optional[Tuple[str, int]] = None, # type: ignore
force_starttls: bool = True, disable_starttls: bool = False) -> None: use_ssl: bool = False, force_starttls: bool = True,
disable_starttls: bool = False) -> None:
"""Connect to the XMPP server. """Connect to the XMPP server.
When no address is given, a SRV lookup for the server will When no address is given, a SRV lookup for the server will

View file

@ -11,7 +11,7 @@ except ImportError:
# Python < 3.8 # Python < 3.8
# just to make sure the imports do not break, but # just to make sure the imports do not break, but
# not usable. # not usable.
from unittest import TestCase as IsolatedAsyncioTestCase from unittest import TestCase as IsolatedAsyncioTestCase # type: ignore
from typing import ( from typing import (
Dict, Dict,
List, List,

View file

@ -31,4 +31,4 @@ class XMLCallback(Callback):
stream processing. Used only by prerun. stream processing. Used only by prerun.
Defaults to False. Defaults to False.
""" """
Callback.run(self, payload.xml, instream) Callback.run(self, payload.xml, instream) # type: ignore

View file

@ -28,4 +28,4 @@ class XMLWaiter(Waiter):
Arguments: Arguments:
payload -- The matched stanza object. payload -- The matched stanza object.
""" """
Waiter.prerun(self, payload.xml) Waiter.prerun(self, payload.xml) # type: ignore

View file

@ -1183,7 +1183,7 @@ class XMLStream(asyncio.BaseProtocol):
if filter in already_used: if filter in already_used:
continue continue
if iscoroutinefunction(filter): if iscoroutinefunction(filter):
data = await filter(data) data = await filter(data) # type: ignore
else: else:
filter = cast(SyncFilter, filter) filter = cast(SyncFilter, filter)
data = filter(data) data = filter(data)