From f2d7e86fc7426d6bdda244a4f399c7930b5624cc Mon Sep 17 00:00:00 2001 From: mathieui Date: Mon, 5 Jul 2021 22:25:38 +0200 Subject: [PATCH] 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. --- slixmpp/basexmpp.py | 4 ++-- slixmpp/clientxmpp.py | 5 +++-- slixmpp/test/integration.py | 2 +- slixmpp/xmlstream/handler/xmlcallback.py | 2 +- slixmpp/xmlstream/handler/xmlwaiter.py | 2 +- slixmpp/xmlstream/xmlstream.py | 2 +- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/slixmpp/basexmpp.py b/slixmpp/basexmpp.py index b1115292..a74db5ac 100644 --- a/slixmpp/basexmpp.py +++ b/slixmpp/basexmpp.py @@ -264,9 +264,9 @@ class BaseXMPP(XMLStream): if not pconfig: pconfig = self.plugin_config.get(plugin, {}) - if not self.plugin.registered(plugin): + if not self.plugin.registered(plugin): # type: ignore load_plugin(plugin, module) - self.plugin.enable(plugin, pconfig) + self.plugin.enable(plugin, pconfig) # type: ignore def register_plugins(self): """Register and initialize all built-in plugins. diff --git a/slixmpp/clientxmpp.py b/slixmpp/clientxmpp.py index 6bfb34c8..f0a7d83e 100644 --- a/slixmpp/clientxmpp.py +++ b/slixmpp/clientxmpp.py @@ -133,8 +133,9 @@ class ClientXMPP(BaseXMPP): def password(self, value: str) -> None: self.credentials['password'] = value - def connect(self, address: Optional[Tuple[str, int]] = None, use_ssl: bool = False, - force_starttls: bool = True, disable_starttls: bool = False) -> None: + def connect(self, address: Optional[Tuple[str, int]] = None, # type: ignore + use_ssl: bool = False, force_starttls: bool = True, + disable_starttls: bool = False) -> None: """Connect to the XMPP server. When no address is given, a SRV lookup for the server will diff --git a/slixmpp/test/integration.py b/slixmpp/test/integration.py index e8093107..fe33fa57 100644 --- a/slixmpp/test/integration.py +++ b/slixmpp/test/integration.py @@ -11,7 +11,7 @@ except ImportError: # Python < 3.8 # just to make sure the imports do not break, but # not usable. - from unittest import TestCase as IsolatedAsyncioTestCase + from unittest import TestCase as IsolatedAsyncioTestCase # type: ignore from typing import ( Dict, List, diff --git a/slixmpp/xmlstream/handler/xmlcallback.py b/slixmpp/xmlstream/handler/xmlcallback.py index 31534033..c1adc815 100644 --- a/slixmpp/xmlstream/handler/xmlcallback.py +++ b/slixmpp/xmlstream/handler/xmlcallback.py @@ -31,4 +31,4 @@ class XMLCallback(Callback): stream processing. Used only by prerun. Defaults to False. """ - Callback.run(self, payload.xml, instream) + Callback.run(self, payload.xml, instream) # type: ignore diff --git a/slixmpp/xmlstream/handler/xmlwaiter.py b/slixmpp/xmlstream/handler/xmlwaiter.py index 65185a5f..f730efec 100644 --- a/slixmpp/xmlstream/handler/xmlwaiter.py +++ b/slixmpp/xmlstream/handler/xmlwaiter.py @@ -28,4 +28,4 @@ class XMLWaiter(Waiter): Arguments: payload -- The matched stanza object. """ - Waiter.prerun(self, payload.xml) + Waiter.prerun(self, payload.xml) # type: ignore diff --git a/slixmpp/xmlstream/xmlstream.py b/slixmpp/xmlstream/xmlstream.py index aa68903e..c21cc954 100644 --- a/slixmpp/xmlstream/xmlstream.py +++ b/slixmpp/xmlstream/xmlstream.py @@ -1183,7 +1183,7 @@ class XMLStream(asyncio.BaseProtocol): if filter in already_used: continue if iscoroutinefunction(filter): - data = await filter(data) + data = await filter(data) # type: ignore else: filter = cast(SyncFilter, filter) data = filter(data)