From 46a90749f839c3d64aa05458cef825f56e9c702d Mon Sep 17 00:00:00 2001 From: mathieui Date: Fri, 30 Sep 2016 21:25:36 +0200 Subject: Fix uses of super() in the codebase MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix #3165, we don’t need to use the long form to get the superobject in our supported python versions. --- docs/getting_started/echobot.rst | 6 +++--- docs/getting_started/sendlogout.rst | 2 +- examples/pubsub_client.py | 2 +- examples/pubsub_events.py | 2 +- examples/user_location.py | 2 +- examples/user_tune.py | 2 +- slixmpp/exceptions.py | 4 ++-- slixmpp/plugins/base.py | 2 +- slixmpp/plugins/xep_0054/stanza.py | 2 +- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/getting_started/echobot.rst b/docs/getting_started/echobot.rst index 0137985c..63915ca4 100644 --- a/docs/getting_started/echobot.rst +++ b/docs/getting_started/echobot.rst @@ -70,7 +70,7 @@ as well. class EchoBot(slixmpp.ClientXMPP): def __init__(self, jid, password): - super(EchoBot, self).__init__(jid, password) + super().__init__(jid, password) Handling Session Start ~~~~~~~~~~~~~~~~~~~~~~ @@ -83,7 +83,7 @@ started. To do that, we will register an event handler for the :term:`session_st .. code-block:: python def __init__(self, jid, password): - super(EchoBot, self).__init__(jid, password) + super().__init__(jid, password) self.add_event_handler('session_start', self.start) @@ -153,7 +153,7 @@ whenever a messsage is received. .. code-block:: python def __init__(self, jid, password): - super(EchoBot, self).__init__(jid, password) + super().__init__(jid, password) self.add_event_handler('session_start', self.start) self.add_event_handler('message', self.message) diff --git a/docs/getting_started/sendlogout.rst b/docs/getting_started/sendlogout.rst index d5882c42..a27976c5 100644 --- a/docs/getting_started/sendlogout.rst +++ b/docs/getting_started/sendlogout.rst @@ -24,7 +24,7 @@ for the JID that will receive our message, and the string content of the message class SendMsgBot(slixmpp.ClientXMPP): def __init__(self, jid, password, recipient, msg): - super(SendMsgBot, self).__init__(jid, password) + super().__init__(jid, password) self.recipient = recipient self.msg = msg diff --git a/examples/pubsub_client.py b/examples/pubsub_client.py index c5688750..d9733036 100755 --- a/examples/pubsub_client.py +++ b/examples/pubsub_client.py @@ -15,7 +15,7 @@ class PubsubClient(slixmpp.ClientXMPP): def __init__(self, jid, password, server, node=None, action='nodes', data=''): - super(PubsubClient, self).__init__(jid, password) + super().__init__(jid, password) self.register_plugin('xep_0030') self.register_plugin('xep_0059') diff --git a/examples/pubsub_events.py b/examples/pubsub_events.py index 369d7114..e2fdc9cf 100755 --- a/examples/pubsub_events.py +++ b/examples/pubsub_events.py @@ -14,7 +14,7 @@ from slixmpp.xmlstream.handler import Callback class PubsubEvents(slixmpp.ClientXMPP): def __init__(self, jid, password): - super(PubsubEvents, self).__init__(jid, password) + super().__init__(jid, password) self.register_plugin('xep_0030') self.register_plugin('xep_0059') diff --git a/examples/user_location.py b/examples/user_location.py index 5a30f7af..7edbeabb 100755 --- a/examples/user_location.py +++ b/examples/user_location.py @@ -22,7 +22,7 @@ from slixmpp import ClientXMPP class LocationBot(ClientXMPP): def __init__(self, jid, password): - super(LocationBot, self).__init__(jid, password) + super().__init__(jid, password) self.add_event_handler('session_start', self.start) self.add_event_handler('user_location_publish', diff --git a/examples/user_tune.py b/examples/user_tune.py index 3f5e1c9e..6aa0da8e 100755 --- a/examples/user_tune.py +++ b/examples/user_tune.py @@ -17,7 +17,7 @@ from slixmpp import ClientXMPP class TuneBot(ClientXMPP): def __init__(self, jid, password): - super(TuneBot, self).__init__(jid, password) + super().__init__(jid, password) # Check for the current song every 5 seconds. self.schedule('Check Current Tune', 5, self._update_tune, repeat=True) diff --git a/slixmpp/exceptions.py b/slixmpp/exceptions.py index a6c09a0b..0486666e 100644 --- a/slixmpp/exceptions.py +++ b/slixmpp/exceptions.py @@ -77,7 +77,7 @@ class IqTimeout(XMPPError): """ def __init__(self, iq): - super(IqTimeout, self).__init__( + super().__init__( condition='remote-server-timeout', etype='cancel') @@ -94,7 +94,7 @@ class IqError(XMPPError): """ def __init__(self, iq): - super(IqError, self).__init__( + super().__init__( condition=iq['error']['condition'], text=iq['error']['text'], etype=iq['error']['type']) diff --git a/slixmpp/plugins/base.py b/slixmpp/plugins/base.py index 0fe083bc..3196e0ea 100644 --- a/slixmpp/plugins/base.py +++ b/slixmpp/plugins/base.py @@ -308,7 +308,7 @@ class BasePlugin(object): if key in self.default_config: self.config[key] = value else: - super(BasePlugin, self).__setattr__(key, value) + super().__setattr__(key, value) def _init(self): """Initialize plugin state, such as registering event handlers. diff --git a/slixmpp/plugins/xep_0054/stanza.py b/slixmpp/plugins/xep_0054/stanza.py index 48a41432..e7647184 100644 --- a/slixmpp/plugins/xep_0054/stanza.py +++ b/slixmpp/plugins/xep_0054/stanza.py @@ -127,7 +127,7 @@ class Telephone(ElementBase): 'ISDN', 'PCS', 'PREF']) def setup(self, xml=None): - super(Telephone, self).setup(xml=xml) + super().setup(xml=xml) ## this blanks out numbers received from server ##self._set_sub_text('NUMBER', '', keep=True) -- cgit v1.2.3