From 35eafadb443d4e7276e39d4f177e68a3c8577566 Mon Sep 17 00:00:00 2001 From: mathieui Date: Mon, 5 Jul 2021 22:40:21 +0200 Subject: features: fix typing for an annoying mypy bug --- slixmpp/features/feature_bind/bind.py | 4 ++-- slixmpp/features/feature_mechanisms/mechanisms.py | 5 ++-- .../features/feature_mechanisms/stanza/abort.py | 4 ++-- .../features/feature_preapproval/preapproval.py | 4 ++-- slixmpp/features/feature_preapproval/stanza.py | 4 ++-- slixmpp/features/feature_rosterver/rosterver.py | 4 ++-- slixmpp/features/feature_rosterver/stanza.py | 4 ++-- slixmpp/features/feature_session/session.py | 3 ++- slixmpp/features/feature_starttls/stanza.py | 28 ++++++++++++++-------- slixmpp/features/feature_starttls/starttls.py | 4 +++- 10 files changed, 38 insertions(+), 26 deletions(-) diff --git a/slixmpp/features/feature_bind/bind.py b/slixmpp/features/feature_bind/bind.py index 6c30d9f2..75bbcfa2 100644 --- a/slixmpp/features/feature_bind/bind.py +++ b/slixmpp/features/feature_bind/bind.py @@ -1,4 +1,3 @@ - # Slixmpp: The Slick XMPP Library # Copyright (C) 2011 Nathanael C. Fritz # This file is part of Slixmpp. @@ -11,6 +10,7 @@ from slixmpp.stanza import Iq, StreamFeatures from slixmpp.features.feature_bind import stanza from slixmpp.xmlstream import register_stanza_plugin from slixmpp.plugins import BasePlugin +from typing import ClassVar, Set log = logging.getLogger(__name__) @@ -20,7 +20,7 @@ class FeatureBind(BasePlugin): name = 'feature_bind' description = 'RFC 6120: Stream Feature: Resource Binding' - dependencies = set() + dependencies: ClassVar[Set[str]] = set() stanza = stanza def plugin_init(self): diff --git a/slixmpp/features/feature_mechanisms/mechanisms.py b/slixmpp/features/feature_mechanisms/mechanisms.py index dfdca010..db2d73d0 100644 --- a/slixmpp/features/feature_mechanisms/mechanisms.py +++ b/slixmpp/features/feature_mechanisms/mechanisms.py @@ -1,4 +1,3 @@ - # Slixmpp: The Slick XMPP Library # Copyright (C) 2011 Nathanael C. Fritz # This file is part of Slixmpp. @@ -15,6 +14,8 @@ from slixmpp.xmlstream.matcher import MatchXPath from slixmpp.xmlstream.handler import Callback from slixmpp.features.feature_mechanisms import stanza +from typing import ClassVar, Set + log = logging.getLogger(__name__) @@ -23,7 +24,7 @@ class FeatureMechanisms(BasePlugin): name = 'feature_mechanisms' description = 'RFC 6120: Stream Feature: SASL' - dependencies = set() + dependencies: ClassVar[Set[str]] = set() stanza = stanza default_config = { 'use_mech': None, diff --git a/slixmpp/features/feature_mechanisms/stanza/abort.py b/slixmpp/features/feature_mechanisms/stanza/abort.py index afa75cde..a430fa0f 100644 --- a/slixmpp/features/feature_mechanisms/stanza/abort.py +++ b/slixmpp/features/feature_mechanisms/stanza/abort.py @@ -1,9 +1,9 @@ - # Slixmpp: The Slick XMPP Library # Copyright (C) 2011 Nathanael C. Fritz # This file is part of Slixmpp. # See the file LICENSE for copying permission. from slixmpp.xmlstream import StanzaBase +from typing import ClassVar, Set class Abort(StanzaBase): @@ -13,7 +13,7 @@ class Abort(StanzaBase): name = 'abort' namespace = 'urn:ietf:params:xml:ns:xmpp-sasl' - interfaces = set() + interfaces: ClassVar[Set[str]] = set() plugin_attrib = name def setup(self, xml): diff --git a/slixmpp/features/feature_preapproval/preapproval.py b/slixmpp/features/feature_preapproval/preapproval.py index 5dceeb06..46fbaeec 100644 --- a/slixmpp/features/feature_preapproval/preapproval.py +++ b/slixmpp/features/feature_preapproval/preapproval.py @@ -1,4 +1,3 @@ - # Slixmpp: The Slick XMPP Library # Copyright (C) 2012 Nathanael C. Fritz # This file is part of Slixmpp. @@ -9,6 +8,7 @@ from slixmpp.stanza import StreamFeatures from slixmpp.features.feature_preapproval import stanza from slixmpp.xmlstream import register_stanza_plugin from slixmpp.plugins.base import BasePlugin +from typing import ClassVar, Set log = logging.getLogger(__name__) @@ -18,7 +18,7 @@ class FeaturePreApproval(BasePlugin): name = 'feature_preapproval' description = 'RFC 6121: Stream Feature: Subscription Pre-Approval' - dependences = set() + dependencies: ClassVar[Set[str]] = set() stanza = stanza def plugin_init(self): diff --git a/slixmpp/features/feature_preapproval/stanza.py b/slixmpp/features/feature_preapproval/stanza.py index b5d68f8e..630a0b7e 100644 --- a/slixmpp/features/feature_preapproval/stanza.py +++ b/slixmpp/features/feature_preapproval/stanza.py @@ -1,14 +1,14 @@ - # Slixmpp: The Slick XMPP Library # Copyright (C) 2012 Nathanael C. Fritz # This file is part of Slixmpp. # See the file LICENSE for copying permission. from slixmpp.xmlstream import ElementBase +from typing import ClassVar, Set class PreApproval(ElementBase): name = 'sub' namespace = 'urn:xmpp:features:pre-approval' - interfaces = set() + interfaces: ClassVar[Set[str]] = set() plugin_attrib = 'preapproval' diff --git a/slixmpp/features/feature_rosterver/rosterver.py b/slixmpp/features/feature_rosterver/rosterver.py index ae980388..1dea6878 100644 --- a/slixmpp/features/feature_rosterver/rosterver.py +++ b/slixmpp/features/feature_rosterver/rosterver.py @@ -1,4 +1,3 @@ - # Slixmpp: The Slick XMPP Library # Copyright (C) 2012 Nathanael C. Fritz # This file is part of Slixmpp. @@ -9,6 +8,7 @@ from slixmpp.stanza import StreamFeatures from slixmpp.features.feature_rosterver import stanza from slixmpp.xmlstream import register_stanza_plugin from slixmpp.plugins.base import BasePlugin +from typing import ClassVar, Set log = logging.getLogger(__name__) @@ -18,7 +18,7 @@ class FeatureRosterVer(BasePlugin): name = 'feature_rosterver' description = 'RFC 6121: Stream Feature: Roster Versioning' - dependences = set() + dependences: ClassVar[Set[str]] = set() stanza = stanza def plugin_init(self): diff --git a/slixmpp/features/feature_rosterver/stanza.py b/slixmpp/features/feature_rosterver/stanza.py index 3696d89a..428dbb26 100644 --- a/slixmpp/features/feature_rosterver/stanza.py +++ b/slixmpp/features/feature_rosterver/stanza.py @@ -1,14 +1,14 @@ - # Slixmpp: The Slick XMPP Library # Copyright (C) 2012 Nathanael C. Fritz # This file is part of Slixmpp. # See the file LICENSE for copying permission. from slixmpp.xmlstream import ElementBase +from typing import Set, ClassVar class RosterVer(ElementBase): name = 'ver' namespace = 'urn:xmpp:features:rosterver' - interfaces = set() + interfaces: ClassVar[Set[str]] = set() plugin_attrib = 'rosterver' diff --git a/slixmpp/features/feature_session/session.py b/slixmpp/features/feature_session/session.py index 0f9b9dd7..83e6c220 100644 --- a/slixmpp/features/feature_session/session.py +++ b/slixmpp/features/feature_session/session.py @@ -11,6 +11,7 @@ from slixmpp.xmlstream import register_stanza_plugin from slixmpp.plugins import BasePlugin from slixmpp.features.feature_session import stanza +from typing import ClassVar, Set log = logging.getLogger(__name__) @@ -20,7 +21,7 @@ class FeatureSession(BasePlugin): name = 'feature_session' description = 'RFC 3920: Stream Feature: Start Session' - dependencies = set() + dependencies: ClassVar[Set[str]] = set() stanza = stanza def plugin_init(self): diff --git a/slixmpp/features/feature_starttls/stanza.py b/slixmpp/features/feature_starttls/stanza.py index 2f971723..70979402 100644 --- a/slixmpp/features/feature_starttls/stanza.py +++ b/slixmpp/features/feature_starttls/stanza.py @@ -4,39 +4,47 @@ # This file is part of Slixmpp. # See the file LICENSE for copying permission. from slixmpp.xmlstream import StanzaBase, ElementBase +from typing import Set, ClassVar class STARTTLS(StanzaBase): - - """ """ + .. code-block:: xml + + + + """ name = 'starttls' namespace = 'urn:ietf:params:xml:ns:xmpp-tls' interfaces = {'required'} plugin_attrib = name def get_required(self): - """ - """ return True class Proceed(StanzaBase): - - """ """ + .. code-block:: xml + + + + """ name = 'proceed' namespace = 'urn:ietf:params:xml:ns:xmpp-tls' - interfaces = set() + interfaces: ClassVar[Set[str]] = set() class Failure(StanzaBase): - - """ """ + .. code-block:: xml + + + + """ name = 'failure' namespace = 'urn:ietf:params:xml:ns:xmpp-tls' - interfaces = set() + interfaces: ClassVar[Set[str]] = set() diff --git a/slixmpp/features/feature_starttls/starttls.py b/slixmpp/features/feature_starttls/starttls.py index 89cbb6b2..318d4a5e 100644 --- a/slixmpp/features/feature_starttls/starttls.py +++ b/slixmpp/features/feature_starttls/starttls.py @@ -12,6 +12,8 @@ from slixmpp.xmlstream.matcher import MatchXPath from slixmpp.xmlstream.handler import CoroutineCallback from slixmpp.features.feature_starttls import stanza +from typing import ClassVar, Set + log = logging.getLogger(__name__) @@ -20,7 +22,7 @@ class FeatureSTARTTLS(BasePlugin): name = 'feature_starttls' description = 'RFC 6120: Stream Feature: STARTTLS' - dependencies = set() + dependencies: ClassVar[Set[str]] = set() stanza = stanza def plugin_init(self): -- cgit v1.2.3