features: fix typing

for an annoying mypy bug
This commit is contained in:
mathieui 2021-07-05 22:40:21 +02:00
parent af958fd1fe
commit 35eafadb44
10 changed files with 38 additions and 26 deletions

View file

@ -1,4 +1,3 @@
# Slixmpp: The Slick XMPP Library # Slixmpp: The Slick XMPP Library
# Copyright (C) 2011 Nathanael C. Fritz # Copyright (C) 2011 Nathanael C. Fritz
# This file is part of Slixmpp. # 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.features.feature_bind import stanza
from slixmpp.xmlstream import register_stanza_plugin from slixmpp.xmlstream import register_stanza_plugin
from slixmpp.plugins import BasePlugin from slixmpp.plugins import BasePlugin
from typing import ClassVar, Set
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -20,7 +20,7 @@ class FeatureBind(BasePlugin):
name = 'feature_bind' name = 'feature_bind'
description = 'RFC 6120: Stream Feature: Resource Binding' description = 'RFC 6120: Stream Feature: Resource Binding'
dependencies = set() dependencies: ClassVar[Set[str]] = set()
stanza = stanza stanza = stanza
def plugin_init(self): def plugin_init(self):

View file

@ -1,4 +1,3 @@
# Slixmpp: The Slick XMPP Library # Slixmpp: The Slick XMPP Library
# Copyright (C) 2011 Nathanael C. Fritz # Copyright (C) 2011 Nathanael C. Fritz
# This file is part of Slixmpp. # This file is part of Slixmpp.
@ -15,6 +14,8 @@ from slixmpp.xmlstream.matcher import MatchXPath
from slixmpp.xmlstream.handler import Callback from slixmpp.xmlstream.handler import Callback
from slixmpp.features.feature_mechanisms import stanza from slixmpp.features.feature_mechanisms import stanza
from typing import ClassVar, Set
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -23,7 +24,7 @@ class FeatureMechanisms(BasePlugin):
name = 'feature_mechanisms' name = 'feature_mechanisms'
description = 'RFC 6120: Stream Feature: SASL' description = 'RFC 6120: Stream Feature: SASL'
dependencies = set() dependencies: ClassVar[Set[str]] = set()
stanza = stanza stanza = stanza
default_config = { default_config = {
'use_mech': None, 'use_mech': None,

View file

@ -1,9 +1,9 @@
# Slixmpp: The Slick XMPP Library # Slixmpp: The Slick XMPP Library
# Copyright (C) 2011 Nathanael C. Fritz # Copyright (C) 2011 Nathanael C. Fritz
# This file is part of Slixmpp. # This file is part of Slixmpp.
# See the file LICENSE for copying permission. # See the file LICENSE for copying permission.
from slixmpp.xmlstream import StanzaBase from slixmpp.xmlstream import StanzaBase
from typing import ClassVar, Set
class Abort(StanzaBase): class Abort(StanzaBase):
@ -13,7 +13,7 @@ class Abort(StanzaBase):
name = 'abort' name = 'abort'
namespace = 'urn:ietf:params:xml:ns:xmpp-sasl' namespace = 'urn:ietf:params:xml:ns:xmpp-sasl'
interfaces = set() interfaces: ClassVar[Set[str]] = set()
plugin_attrib = name plugin_attrib = name
def setup(self, xml): def setup(self, xml):

View file

@ -1,4 +1,3 @@
# Slixmpp: The Slick XMPP Library # Slixmpp: The Slick XMPP Library
# Copyright (C) 2012 Nathanael C. Fritz # Copyright (C) 2012 Nathanael C. Fritz
# This file is part of Slixmpp. # This file is part of Slixmpp.
@ -9,6 +8,7 @@ from slixmpp.stanza import StreamFeatures
from slixmpp.features.feature_preapproval import stanza from slixmpp.features.feature_preapproval import stanza
from slixmpp.xmlstream import register_stanza_plugin from slixmpp.xmlstream import register_stanza_plugin
from slixmpp.plugins.base import BasePlugin from slixmpp.plugins.base import BasePlugin
from typing import ClassVar, Set
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -18,7 +18,7 @@ class FeaturePreApproval(BasePlugin):
name = 'feature_preapproval' name = 'feature_preapproval'
description = 'RFC 6121: Stream Feature: Subscription Pre-Approval' description = 'RFC 6121: Stream Feature: Subscription Pre-Approval'
dependences = set() dependencies: ClassVar[Set[str]] = set()
stanza = stanza stanza = stanza
def plugin_init(self): def plugin_init(self):

View file

@ -1,14 +1,14 @@
# Slixmpp: The Slick XMPP Library # Slixmpp: The Slick XMPP Library
# Copyright (C) 2012 Nathanael C. Fritz # Copyright (C) 2012 Nathanael C. Fritz
# This file is part of Slixmpp. # This file is part of Slixmpp.
# See the file LICENSE for copying permission. # See the file LICENSE for copying permission.
from slixmpp.xmlstream import ElementBase from slixmpp.xmlstream import ElementBase
from typing import ClassVar, Set
class PreApproval(ElementBase): class PreApproval(ElementBase):
name = 'sub' name = 'sub'
namespace = 'urn:xmpp:features:pre-approval' namespace = 'urn:xmpp:features:pre-approval'
interfaces = set() interfaces: ClassVar[Set[str]] = set()
plugin_attrib = 'preapproval' plugin_attrib = 'preapproval'

View file

@ -1,4 +1,3 @@
# Slixmpp: The Slick XMPP Library # Slixmpp: The Slick XMPP Library
# Copyright (C) 2012 Nathanael C. Fritz # Copyright (C) 2012 Nathanael C. Fritz
# This file is part of Slixmpp. # This file is part of Slixmpp.
@ -9,6 +8,7 @@ from slixmpp.stanza import StreamFeatures
from slixmpp.features.feature_rosterver import stanza from slixmpp.features.feature_rosterver import stanza
from slixmpp.xmlstream import register_stanza_plugin from slixmpp.xmlstream import register_stanza_plugin
from slixmpp.plugins.base import BasePlugin from slixmpp.plugins.base import BasePlugin
from typing import ClassVar, Set
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -18,7 +18,7 @@ class FeatureRosterVer(BasePlugin):
name = 'feature_rosterver' name = 'feature_rosterver'
description = 'RFC 6121: Stream Feature: Roster Versioning' description = 'RFC 6121: Stream Feature: Roster Versioning'
dependences = set() dependences: ClassVar[Set[str]] = set()
stanza = stanza stanza = stanza
def plugin_init(self): def plugin_init(self):

View file

@ -1,14 +1,14 @@
# Slixmpp: The Slick XMPP Library # Slixmpp: The Slick XMPP Library
# Copyright (C) 2012 Nathanael C. Fritz # Copyright (C) 2012 Nathanael C. Fritz
# This file is part of Slixmpp. # This file is part of Slixmpp.
# See the file LICENSE for copying permission. # See the file LICENSE for copying permission.
from slixmpp.xmlstream import ElementBase from slixmpp.xmlstream import ElementBase
from typing import Set, ClassVar
class RosterVer(ElementBase): class RosterVer(ElementBase):
name = 'ver' name = 'ver'
namespace = 'urn:xmpp:features:rosterver' namespace = 'urn:xmpp:features:rosterver'
interfaces = set() interfaces: ClassVar[Set[str]] = set()
plugin_attrib = 'rosterver' plugin_attrib = 'rosterver'

View file

@ -11,6 +11,7 @@ from slixmpp.xmlstream import register_stanza_plugin
from slixmpp.plugins import BasePlugin from slixmpp.plugins import BasePlugin
from slixmpp.features.feature_session import stanza from slixmpp.features.feature_session import stanza
from typing import ClassVar, Set
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -20,7 +21,7 @@ class FeatureSession(BasePlugin):
name = 'feature_session' name = 'feature_session'
description = 'RFC 3920: Stream Feature: Start Session' description = 'RFC 3920: Stream Feature: Start Session'
dependencies = set() dependencies: ClassVar[Set[str]] = set()
stanza = stanza stanza = stanza
def plugin_init(self): def plugin_init(self):

View file

@ -4,39 +4,47 @@
# This file is part of Slixmpp. # This file is part of Slixmpp.
# See the file LICENSE for copying permission. # See the file LICENSE for copying permission.
from slixmpp.xmlstream import StanzaBase, ElementBase from slixmpp.xmlstream import StanzaBase, ElementBase
from typing import Set, ClassVar
class STARTTLS(StanzaBase): class STARTTLS(StanzaBase):
"""
""" """
.. code-block:: xml
<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
"""
name = 'starttls' name = 'starttls'
namespace = 'urn:ietf:params:xml:ns:xmpp-tls' namespace = 'urn:ietf:params:xml:ns:xmpp-tls'
interfaces = {'required'} interfaces = {'required'}
plugin_attrib = name plugin_attrib = name
def get_required(self): def get_required(self):
"""
"""
return True return True
class Proceed(StanzaBase): class Proceed(StanzaBase):
"""
""" """
.. code-block:: xml
<proceed xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
"""
name = 'proceed' name = 'proceed'
namespace = 'urn:ietf:params:xml:ns:xmpp-tls' namespace = 'urn:ietf:params:xml:ns:xmpp-tls'
interfaces = set() interfaces: ClassVar[Set[str]] = set()
class Failure(StanzaBase): class Failure(StanzaBase):
"""
""" """
.. code-block:: xml
<failure xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
"""
name = 'failure' name = 'failure'
namespace = 'urn:ietf:params:xml:ns:xmpp-tls' namespace = 'urn:ietf:params:xml:ns:xmpp-tls'
interfaces = set() interfaces: ClassVar[Set[str]] = set()

View file

@ -12,6 +12,8 @@ from slixmpp.xmlstream.matcher import MatchXPath
from slixmpp.xmlstream.handler import CoroutineCallback from slixmpp.xmlstream.handler import CoroutineCallback
from slixmpp.features.feature_starttls import stanza from slixmpp.features.feature_starttls import stanza
from typing import ClassVar, Set
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -20,7 +22,7 @@ class FeatureSTARTTLS(BasePlugin):
name = 'feature_starttls' name = 'feature_starttls'
description = 'RFC 6120: Stream Feature: STARTTLS' description = 'RFC 6120: Stream Feature: STARTTLS'
dependencies = set() dependencies: ClassVar[Set[str]] = set()
stanza = stanza stanza = stanza
def plugin_init(self): def plugin_init(self):