diff --git a/docs/create_plugin.rst b/docs/create_plugin.rst index 98d682eb..db3b4f0f 100644 --- a/docs/create_plugin.rst +++ b/docs/create_plugin.rst @@ -29,7 +29,7 @@ in the future. First Steps ----------- -Every plugin inherits from the class :mod:`base_plugin `, +Every plugin inherits from the class :mod:`BasePlugin `_ | `View original code `_ @@ -86,7 +86,7 @@ Updated Code "uri": self.url + "/" + message.user, "user" : message.user, "message" : message.text } for subscriberJID in self.backend.getSubscriberJIDs(message.user) : - self.xmpp.sendMessage(subscriberJID, body, mhtml=htmlBody) + self.xmpp.send_message(subscriberJID, body, mhtml=htmlBody) `View full source `_ | `View original code `_ @@ -145,7 +145,7 @@ Example 14-4. (Page 220) Like several previous examples, a needed change is to replace ``subscription["from"]`` with ``subscription["from"].jid`` because the -``BaseXMPP`` method ``makePresence`` requires the JID to be a string. +``BaseXMPP`` method ``make_presence`` requires the JID to be a string. A correction needs to be made in ``handleXMPPPresenceProbe`` because a line was left out of the original implementation; the variable ``user`` is undefined. The @@ -154,7 +154,7 @@ JID of the user can be extracted from the presence stanza's ``from`` attribute. Since this implementation of CheshiR uses an XMPP component, it must include a ``from`` attribute in all messages that it sends. Adding the ``from`` attribute is done by including ``mfrom=self.xmpp.jid`` in calls to -``self.xmpp.sendMessage``. +``self.xmpp.send_message``. Updated Code ~~~~~~~~~~~~ @@ -162,19 +162,19 @@ Updated Code .. code-block:: python def handleXMPPPresenceProbe(self, event) : - self.xmpp.sendPresence(pto = event["from"]) + self.xmpp.send_presence(pto = event["from"]) def handleXMPPPresenceSubscription(self, subscription) : if subscription["type"] == "subscribe" : userJID = subscription["from"].jid - self.xmpp.sendPresenceSubscription(pto=userJID, ptype="subscribed") - self.xmpp.sendPresence(pto = userJID) - self.xmpp.sendPresenceSubscription(pto=userJID, ptype="subscribe") + self.xmpp.send_presence_subscription(pto=userJID, ptype="subscribed") + self.xmpp.send_presence(pto = userJID) + self.xmpp.send_presence_subscription(pto=userJID, ptype="subscribe") def handleMessageAddedToBackend(self, message) : body = message.user + ": " + message.text for subscriberJID in self.backend.getSubscriberJIDs(message.user) : - self.xmpp.sendMessage(subscriberJID, body, mfrom=self.xmpp.jid) + self.xmpp.send_message(subscriberJID, body, mfrom=self.xmpp.jid) `View full source `_ | `View original code `_ @@ -239,7 +239,7 @@ Updated Code userJID = subscription["from"].jid user = self.backend.getUserFromJID(userJID) contactJID = subscription["to"] - self.xmpp.sendPresenceSubscription( + self.xmpp.send_presence_subscription( pfrom=contactJID, pto=userJID, ptype="subscribed", pnick=user) self.sendPresenceOfContactToUser(contactJID=contactJID, userJID=userJID) if contactJID == self.componentDomain : diff --git a/examples/echo_component.py b/examples/echo_component.py index ff379894..664fe311 100755 --- a/examples/echo_component.py +++ b/examples/echo_component.py @@ -95,10 +95,10 @@ if __name__ == '__main__': # may have interdependencies, the order in which you register them does # not matter. xmpp = EchoComponent(args.jid, args.password, args.server, args.port) - xmpp.registerPlugin('xep_0030') # Service Discovery - xmpp.registerPlugin('xep_0004') # Data Forms - xmpp.registerPlugin('xep_0060') # PubSub - xmpp.registerPlugin('xep_0199') # XMPP Ping + xmpp.register_plugin('xep_0030') # Service Discovery + xmpp.register_plugin('xep_0004') # Data Forms + xmpp.register_plugin('xep_0060') # PubSub + xmpp.register_plugin('xep_0199') # XMPP Ping # Connect to the XMPP server and start processing XMPP stanzas. xmpp.connect() diff --git a/slixmpp/basexmpp.py b/slixmpp/basexmpp.py index a3aa557a..f59c5c00 100644 --- a/slixmpp/basexmpp.py +++ b/slixmpp/basexmpp.py @@ -779,23 +779,3 @@ class BaseXMPP(XMLStream): pass else: log.exception(exception) - - -# Restore the old, lowercased name for backwards compatibility. -basexmpp = BaseXMPP - -# To comply with PEP8, method names now use underscores. -# Deprecated method names are re-mapped for backwards compatibility. -BaseXMPP.registerPlugin = BaseXMPP.register_plugin -BaseXMPP.makeIq = BaseXMPP.make_iq -BaseXMPP.makeIqGet = BaseXMPP.make_iq_get -BaseXMPP.makeIqResult = BaseXMPP.make_iq_result -BaseXMPP.makeIqSet = BaseXMPP.make_iq_set -BaseXMPP.makeIqError = BaseXMPP.make_iq_error -BaseXMPP.makeIqQuery = BaseXMPP.make_iq_query -BaseXMPP.makeQueryRoster = BaseXMPP.make_query_roster -BaseXMPP.makeMessage = BaseXMPP.make_message -BaseXMPP.makePresence = BaseXMPP.make_presence -BaseXMPP.sendMessage = BaseXMPP.send_message -BaseXMPP.sendPresence = BaseXMPP.send_presence -BaseXMPP.sendPresenceSubscription = BaseXMPP.send_presence_subscription diff --git a/slixmpp/clientxmpp.py b/slixmpp/clientxmpp.py index 86d764f4..9659c308 100644 --- a/slixmpp/clientxmpp.py +++ b/slixmpp/clientxmpp.py @@ -300,11 +300,3 @@ class ClientXMPP(BaseXMPP): dictated by the server. The same as :attr:`boundjid`. """ self.client_roster = self.roster[jid] - - -# To comply with PEP8, method names now use underscores. -# Deprecated method names are re-mapped for backwards compatibility. -ClientXMPP.updateRoster = ClientXMPP.update_roster -ClientXMPP.delRosterItem = ClientXMPP.del_roster_item -ClientXMPP.getRoster = ClientXMPP.get_roster -ClientXMPP.registerFeature = ClientXMPP.register_feature diff --git a/slixmpp/plugins/base.py b/slixmpp/plugins/base.py index d3f751fb..06be3789 100644 --- a/slixmpp/plugins/base.py +++ b/slixmpp/plugins/base.py @@ -351,6 +351,3 @@ class BasePlugin(object): Only needed if the plugin has circular dependencies. """ pass - - -base_plugin = BasePlugin diff --git a/slixmpp/plugins/gmail_notify.py b/slixmpp/plugins/gmail_notify.py index d40e932d..8071984c 100644 --- a/slixmpp/plugins/gmail_notify.py +++ b/slixmpp/plugins/gmail_notify.py @@ -7,10 +7,10 @@ """ import logging -from . import base +from slixmpp.plugins import BasePlugin from .. xmlstream.handler.callback import Callback from .. xmlstream.matcher.xpath import MatchXPath -from .. xmlstream.stanzabase import registerStanzaPlugin, ElementBase, ET, JID +from .. xmlstream.stanzabase import register_stanza_plugin, ElementBase, ET, JID from .. stanza.iq import Iq @@ -90,7 +90,7 @@ class NewMail(ElementBase): plugin_attrib = 'new-mail' -class gmail_notify(base.base_plugin): +class gmail_notify(BasePlugin): """ Google Talk: Gmail Notifications """ @@ -112,9 +112,9 @@ class gmail_notify(base.base_plugin): NewMail.name)), self.handle_new_mail)) - registerStanzaPlugin(Iq, GmailQuery) - registerStanzaPlugin(Iq, MailBox) - registerStanzaPlugin(Iq, NewMail) + register_stanza_plugin(Iq, GmailQuery) + register_stanza_plugin(Iq, MailBox) + register_stanza_plugin(Iq, NewMail) self.last_result_time = None diff --git a/slixmpp/plugins/xep_0004/stanza/form.py b/slixmpp/plugins/xep_0004/stanza/form.py index 95e47b4f..2f617e39 100644 --- a/slixmpp/plugins/xep_0004/stanza/form.py +++ b/slixmpp/plugins/xep_0004/stanza/form.py @@ -237,21 +237,16 @@ class Form(ElementBase): return new -Form.setType = Form.set_type Form.addField = Form.add_field -Form.addItem = Form.add_item Form.addReported = Form.add_reported Form.delFields = Form.del_fields Form.delInstructions = Form.del_instructions -Form.delItems = Form.del_items Form.delReported = Form.del_reported Form.getFields = Form.get_fields Form.getInstructions = Form.get_instructions -Form.getItems = Form.get_items Form.getReported = Form.get_reported Form.getValues = Form.get_values Form.setFields = Form.set_fields Form.setInstructions = Form.set_instructions -Form.setItems = Form.set_items Form.setReported = Form.set_reported Form.setValues = Form.set_values diff --git a/slixmpp/plugins/xep_0009/remote.py b/slixmpp/plugins/xep_0009/remote.py index 99df929a..b7612c03 100644 --- a/slixmpp/plugins/xep_0009/remote.py +++ b/slixmpp/plugins/xep_0009/remote.py @@ -453,7 +453,7 @@ class RemoteSession(object): def _notify(self, event): log.debug("RPC Session as %s started.", self._client.boundjid.full) - self._client.sendPresence() + self._client.send_presence() self._event.set() pass @@ -733,10 +733,10 @@ class Remote(object): ''' client = slixmpp.ClientXMPP(jid, password) #? Register plug-ins. - client.registerPlugin('xep_0004') # Data Forms - client.registerPlugin('xep_0009') # Jabber-RPC - client.registerPlugin('xep_0030') # Service Discovery - client.registerPlugin('xep_0060') # PubSub - client.registerPlugin('xep_0199') # XMPP Ping + client.register_plugin('xep_0004') # Data Forms + client.register_plugin('xep_0009') # Jabber-RPC + client.register_plugin('xep_0030') # Service Discovery + client.register_plugin('xep_0060') # PubSub + client.register_plugin('xep_0199') # XMPP Ping return cls.new_session_with_client(client, callback) diff --git a/slixmpp/plugins/xep_0009/rpc.py b/slixmpp/plugins/xep_0009/rpc.py index 05960981..5ed8b84c 100644 --- a/slixmpp/plugins/xep_0009/rpc.py +++ b/slixmpp/plugins/xep_0009/rpc.py @@ -55,7 +55,7 @@ class XEP_0009(BasePlugin): self.xmpp['xep_0030'].add_identity('automation','rpc') def make_iq_method_call(self, pto, pmethod, params): - iq = self.xmpp.makeIqSet() + iq = self.xmpp.make_iq_set() iq.attrib['to'] = pto iq.attrib['from'] = self.xmpp.boundjid.full iq.enable('rpc_query') @@ -64,7 +64,7 @@ class XEP_0009(BasePlugin): return iq def make_iq_method_response(self, pid, pto, params): - iq = self.xmpp.makeIqResult(pid) + iq = self.xmpp.make_iq_result(pid) iq.attrib['to'] = pto iq.attrib['from'] = self.xmpp.boundjid.full iq.enable('rpc_query') @@ -72,7 +72,7 @@ class XEP_0009(BasePlugin): return iq def make_iq_method_response_fault(self, pid, pto, params): - iq = self.xmpp.makeIqResult(pid) + iq = self.xmpp.make_iq_result(pid) iq.attrib['to'] = pto iq.attrib['from'] = self.xmpp.boundjid.full iq.enable('rpc_query') @@ -81,7 +81,7 @@ class XEP_0009(BasePlugin): return iq # def make_iq_method_error(self, pto, pid, pmethod, params, code, type, condition): -# iq = self.xmpp.makeIqError(pid) +# iq = self.xmpp.make_iq_error(pid) # iq.attrib['to'] = pto # iq.attrib['from'] = self.xmpp.boundjid.full # iq['error']['code'] = code diff --git a/slixmpp/plugins/xep_0030/__init__.py b/slixmpp/plugins/xep_0030/__init__.py index 7f8e52b1..1fc71069 100644 --- a/slixmpp/plugins/xep_0030/__init__.py +++ b/slixmpp/plugins/xep_0030/__init__.py @@ -19,5 +19,4 @@ register_plugin(XEP_0030) # Retain some backwards compatibility xep_0030 = XEP_0030 XEP_0030.getInfo = XEP_0030.get_info -XEP_0030.getItems = XEP_0030.get_items XEP_0030.make_static = XEP_0030.restore_defaults diff --git a/slixmpp/plugins/xep_0045.py b/slixmpp/plugins/xep_0045.py index 66693734..a9344a41 100644 --- a/slixmpp/plugins/xep_0045.py +++ b/slixmpp/plugins/xep_0045.py @@ -154,7 +154,7 @@ class XEP_0045(BasePlugin): got_online = False if pr['muc']['room'] not in self.rooms.keys(): return - entry = pr['muc'].getStanzaValues() + entry = pr['muc'].get_stanza_values() entry['show'] = pr['show'] entry['status'] = pr['status'] entry['alt_nick'] = pr['nick'] @@ -210,7 +210,7 @@ class XEP_0045(BasePlugin): def configureRoom(self, room, form=None, ifrom=None): if form is None: form = self.getRoomConfig(room, ifrom=ifrom) - iq = self.xmpp.makeIqSet() + iq = self.xmpp.make_iq_set() iq['to'] = room if ifrom is not None: iq['from'] = ifrom @@ -230,7 +230,7 @@ class XEP_0045(BasePlugin): def joinMUC(self, room, nick, maxhistory="0", password='', wait=False, pstatus=None, pshow=None, pfrom=None): """ Join the specified room, requesting 'maxhistory' lines of history. """ - stanza = self.xmpp.makePresence(pto="%s/%s" % (room, nick), pstatus=pstatus, pshow=pshow, pfrom=pfrom) + stanza = self.xmpp.make_presence(pto="%s/%s" % (room, nick), pstatus=pstatus, pshow=pshow, pfrom=pfrom) x = ET.Element('{http://jabber.org/protocol/muc}x') if password: passelement = ET.Element('{http://jabber.org/protocol/muc}password') @@ -254,7 +254,7 @@ class XEP_0045(BasePlugin): self.ourNicks[room] = nick def destroy(self, room, reason='', altroom = '', ifrom=None): - iq = self.xmpp.makeIqSet() + iq = self.xmpp.make_iq_set() if ifrom is not None: iq['from'] = ifrom iq['to'] = room @@ -286,7 +286,7 @@ class XEP_0045(BasePlugin): else: item = ET.Element('{http://jabber.org/protocol/muc#admin}item', {'affiliation':affiliation, 'jid':jid}) query.append(item) - iq = self.xmpp.makeIqSet(query) + iq = self.xmpp.make_iq_set(query) iq['to'] = room iq['from'] = ifrom # For now, swallow errors to preserve existing API @@ -309,7 +309,7 @@ class XEP_0045(BasePlugin): query = ET.Element('{http://jabber.org/protocol/muc#admin}query') item = ET.Element('item', {'role':role, 'nick':nick}) query.append(item) - iq = self.xmpp.makeIqSet(query) + iq = self.xmpp.make_iq_set(query) iq['to'] = room result = iq.send() if result is False or result['type'] != 'result': @@ -318,7 +318,7 @@ class XEP_0045(BasePlugin): def invite(self, room, jid, reason='', mfrom=''): """ Invite a jid to a room.""" - msg = self.xmpp.makeMessage(room) + msg = self.xmpp.make_message(room) msg['from'] = mfrom x = ET.Element('{http://jabber.org/protocol/muc#user}x') invite = ET.Element('{http://jabber.org/protocol/muc#user}invite', {'to': jid}) @@ -334,13 +334,13 @@ class XEP_0045(BasePlugin): """ Leave the specified room. """ if msg: - self.xmpp.sendPresence(pshow='unavailable', pto="%s/%s" % (room, nick), pstatus=msg, pfrom=pfrom) + self.xmpp.send_presence(pshow='unavailable', pto="%s/%s" % (room, nick), pstatus=msg, pfrom=pfrom) else: - self.xmpp.sendPresence(pshow='unavailable', pto="%s/%s" % (room, nick), pfrom=pfrom) + self.xmpp.send_presence(pshow='unavailable', pto="%s/%s" % (room, nick), pfrom=pfrom) del self.rooms[room] def getRoomConfig(self, room, ifrom=''): - iq = self.xmpp.makeIqGet('http://jabber.org/protocol/muc#owner') + iq = self.xmpp.make_iq_get('http://jabber.org/protocol/muc#owner') iq['to'] = room iq['from'] = ifrom # For now, swallow errors to preserve existing API @@ -359,7 +359,7 @@ class XEP_0045(BasePlugin): query = ET.Element('{http://jabber.org/protocol/muc#owner}query') x = ET.Element('{jabber:x:data}x', type='cancel') query.append(x) - iq = self.xmpp.makeIqSet(query) + iq = self.xmpp.make_iq_set(query) iq['to'] = room iq['from'] = ifrom iq.send() @@ -368,7 +368,7 @@ class XEP_0045(BasePlugin): query = ET.Element('{http://jabber.org/protocol/muc#owner}query') x = config.getXML('submit') query.append(x) - iq = self.xmpp.makeIqSet(query) + iq = self.xmpp.make_iq_set(query) iq['to'] = room iq['from'] = ifrom iq.send() diff --git a/slixmpp/plugins/xep_0050/adhoc.py b/slixmpp/plugins/xep_0050/adhoc.py index a948f74f..cb179a03 100644 --- a/slixmpp/plugins/xep_0050/adhoc.py +++ b/slixmpp/plugins/xep_0050/adhoc.py @@ -57,8 +57,8 @@ class XEP_0050(BasePlugin): relevant to a command's session. Methods: - plugin_init -- Overrides base_plugin.plugin_init - post_init -- Overrides base_plugin.post_init + plugin_init -- Overrides BasePlugin.plugin_init + post_init -- Overrides BasePlugin.post_init new_session -- Return a new session ID. prep_handlers -- Placeholder. May call with a list of handlers to prepare them for use with the session storage diff --git a/slixmpp/plugins/xep_0065/proxy.py b/slixmpp/plugins/xep_0065/proxy.py index 818b0cb2..cb6affde 100644 --- a/slixmpp/plugins/xep_0065/proxy.py +++ b/slixmpp/plugins/xep_0065/proxy.py @@ -12,7 +12,7 @@ from slixmpp.exceptions import XMPPError from slixmpp.xmlstream import register_stanza_plugin from slixmpp.xmlstream.handler import Callback from slixmpp.xmlstream.matcher import StanzaPath -from slixmpp.plugins.base import base_plugin +from slixmpp.plugins.base import BasePlugin from slixmpp.plugins.xep_0065 import stanza, Socks5 @@ -20,7 +20,7 @@ from slixmpp.plugins.xep_0065 import stanza, Socks5 log = logging.getLogger(__name__) -class XEP_0065(base_plugin): +class XEP_0065(BasePlugin): name = 'xep_0065' description = "Socks5 Bytestreams" diff --git a/slixmpp/plugins/xep_0323/sensordata.py b/slixmpp/plugins/xep_0323/sensordata.py index 0e7f7028..e032bb7b 100644 --- a/slixmpp/plugins/xep_0323/sensordata.py +++ b/slixmpp/plugins/xep_0323/sensordata.py @@ -83,9 +83,9 @@ class XEP_0323(BasePlugin): sequence number (unique between the client/sensor pair) Methods: - plugin_init -- Overrides base_plugin.plugin_init - post_init -- Overrides base_plugin.post_init - plugin_end -- Overrides base_plugin.plugin_end + plugin_init -- Overrides BasePlugin.plugin_init + post_init -- Overrides BasePlugin.post_init + plugin_end -- Overrides BasePlugin.plugin_end Sensor side ----------- diff --git a/slixmpp/plugins/xep_0325/control.py b/slixmpp/plugins/xep_0325/control.py index 83c52eae..e1c16d40 100644 --- a/slixmpp/plugins/xep_0325/control.py +++ b/slixmpp/plugins/xep_0325/control.py @@ -79,9 +79,9 @@ class XEP_0325(BasePlugin): sequence number (unique between the client/sensor pair) Methods: - plugin_init -- Overrides base_plugin.plugin_init - post_init -- Overrides base_plugin.post_init - plugin_end -- Overrides base_plugin.plugin_end + plugin_init -- Overrides BasePlugin.plugin_init + post_init -- Overrides BasePlugin.post_init + plugin_end -- Overrides BasePlugin.plugin_end Sensor side ----------- diff --git a/slixmpp/stanza/error.py b/slixmpp/stanza/error.py index efdcda0e..67f736c0 100644 --- a/slixmpp/stanza/error.py +++ b/slixmpp/stanza/error.py @@ -162,13 +162,3 @@ class Error(ElementBase): def del_redirect(self): self._del_sub('{%s}redirect' % self.condition_ns) - - -# To comply with PEP8, method names now use underscores. -# Deprecated method names are re-mapped for backwards compatibility. -Error.getCondition = Error.get_condition -Error.setCondition = Error.set_condition -Error.delCondition = Error.del_condition -Error.getText = Error.get_text -Error.setText = Error.set_text -Error.delText = Error.del_text diff --git a/slixmpp/stanza/htmlim.py b/slixmpp/stanza/htmlim.py index a2842a3b..a5a3e5f3 100644 --- a/slixmpp/stanza/htmlim.py +++ b/slixmpp/stanza/htmlim.py @@ -12,10 +12,3 @@ from slixmpp.plugins.xep_0071 import XHTML_IM as HTMLIM register_stanza_plugin(Message, HTMLIM) - - -# To comply with PEP8, method names now use underscores. -# Deprecated method names are re-mapped for backwards compatibility. -HTMLIM.setBody = HTMLIM.set_body -HTMLIM.getBody = HTMLIM.get_body -HTMLIM.delBody = HTMLIM.del_body diff --git a/slixmpp/stanza/iq.py b/slixmpp/stanza/iq.py index d247fc0e..e2b3c1f9 100644 --- a/slixmpp/stanza/iq.py +++ b/slixmpp/stanza/iq.py @@ -246,11 +246,3 @@ class Iq(RootStanza): else: StanzaBase._set_stanza_values(self, values) return self - - -# To comply with PEP8, method names now use underscores. -# Deprecated method names are re-mapped for backwards compatibility. -Iq.setPayload = Iq.set_payload -Iq.getQuery = Iq.get_query -Iq.setQuery = Iq.set_query -Iq.delQuery = Iq.del_query diff --git a/slixmpp/stanza/message.py b/slixmpp/stanza/message.py index 9495a629..09e44ad8 100644 --- a/slixmpp/stanza/message.py +++ b/slixmpp/stanza/message.py @@ -186,14 +186,3 @@ class Message(RootStanza): def del_mucnick(self): """Dummy method to prevent deletion.""" pass - - -# To comply with PEP8, method names now use underscores. -# Deprecated method names are re-mapped for backwards compatibility. -Message.getType = Message.get_type -Message.getMucroom = Message.get_mucroom -Message.setMucroom = Message.set_mucroom -Message.delMucroom = Message.del_mucroom -Message.getMucnick = Message.get_mucnick -Message.setMucnick = Message.set_mucnick -Message.delMucnick = Message.del_mucnick diff --git a/slixmpp/stanza/nick.py b/slixmpp/stanza/nick.py index bc7bf5ed..3bb7d63d 100644 --- a/slixmpp/stanza/nick.py +++ b/slixmpp/stanza/nick.py @@ -15,9 +15,3 @@ from slixmpp.plugins.xep_0172 import UserNick as Nick register_stanza_plugin(Message, Nick) register_stanza_plugin(Presence, Nick) - -# To comply with PEP8, method names now use underscores. -# Deprecated method names are re-mapped for backwards compatibility. -Nick.setNick = Nick.set_nick -Nick.getNick = Nick.get_nick -Nick.delNick = Nick.del_nick diff --git a/slixmpp/stanza/presence.py b/slixmpp/stanza/presence.py index 3da20b7d..2c77a878 100644 --- a/slixmpp/stanza/presence.py +++ b/slixmpp/stanza/presence.py @@ -179,13 +179,3 @@ class Presence(RootStanza): elif self['type'] == 'subscribe': self['type'] = 'subscribed' return StanzaBase.reply(self, clear) - - -# To comply with PEP8, method names now use underscores. -# Deprecated method names are re-mapped for backwards compatibility. -Presence.setShow = Presence.set_show -Presence.getType = Presence.get_type -Presence.setType = Presence.set_type -Presence.delType = Presence.get_type -Presence.getPriority = Presence.get_priority -Presence.setPriority = Presence.set_priority diff --git a/slixmpp/stanza/roster.py b/slixmpp/stanza/roster.py index 0cf11429..c017c33f 100644 --- a/slixmpp/stanza/roster.py +++ b/slixmpp/stanza/roster.py @@ -150,9 +150,3 @@ class RosterItem(ElementBase): register_stanza_plugin(Iq, Roster) register_stanza_plugin(Roster, RosterItem, iterable=True) - -# To comply with PEP8, method names now use underscores. -# Deprecated method names are re-mapped for backwards compatibility. -Roster.setItems = Roster.set_items -Roster.getItems = Roster.get_items -Roster.delItems = Roster.del_items diff --git a/slixmpp/xmlstream/handler/base.py b/slixmpp/xmlstream/handler/base.py index 36723597..b6bff096 100644 --- a/slixmpp/xmlstream/handler/base.py +++ b/slixmpp/xmlstream/handler/base.py @@ -77,8 +77,3 @@ class BaseHandler(object): of stream handlers. """ return self._destroy - - -# To comply with PEP8, method names now use underscores. -# Deprecated method names are re-mapped for backwards compatibility. -BaseHandler.checkDelete = BaseHandler.check_delete diff --git a/slixmpp/xmlstream/stanzabase.py b/slixmpp/xmlstream/stanzabase.py index 3f469153..a9b991f4 100644 --- a/slixmpp/xmlstream/stanzabase.py +++ b/slixmpp/xmlstream/stanzabase.py @@ -91,10 +91,6 @@ def register_stanza_plugin(stanza, plugin, iterable=False, overrides=False): stanza.plugin_overrides[interface] = plugin.plugin_attrib -# To maintain backwards compatibility for now, preserve the camel case name. -registerStanzaPlugin = register_stanza_plugin - - def multifactory(stanza, plugin_attrib): """ Returns a ElementBase class for handling reoccuring child stanzas @@ -1620,25 +1616,3 @@ class StanzaBase(ElementBase): #: Child stanzas are exposed as nested dictionaries. ElementBase.values = property(ElementBase._get_stanza_values, ElementBase._set_stanza_values) - - -# To comply with PEP8, method names now use underscores. -# Deprecated method names are re-mapped for backwards compatibility. -ElementBase.initPlugin = ElementBase.init_plugin -ElementBase._getAttr = ElementBase._get_attr -ElementBase._setAttr = ElementBase._set_attr -ElementBase._delAttr = ElementBase._del_attr -ElementBase._getSubText = ElementBase._get_sub_text -ElementBase._setSubText = ElementBase._set_sub_text -ElementBase._delSub = ElementBase._del_sub -ElementBase.getStanzaValues = ElementBase._get_stanza_values -ElementBase.setStanzaValues = ElementBase._set_stanza_values - -StanzaBase.setType = StanzaBase.set_type -StanzaBase.getTo = StanzaBase.get_to -StanzaBase.setTo = StanzaBase.set_to -StanzaBase.getFrom = StanzaBase.get_from -StanzaBase.setFrom = StanzaBase.set_from -StanzaBase.getPayload = StanzaBase.get_payload -StanzaBase.setPayload = StanzaBase.set_payload -StanzaBase.delPayload = StanzaBase.del_payload diff --git a/tests/test_stanza_element.py b/tests/test_stanza_element.py index 52ca87f0..eb5791fc 100644 --- a/tests/test_stanza_element.py +++ b/tests/test_stanza_element.py @@ -38,7 +38,7 @@ class TestElementBase(SlixTest): """) def testGetStanzaValues(self): - """Test getStanzaValues using plugins and substanzas.""" + """Test get_stanza_values using plugins and substanzas.""" class TestStanzaPlugin(ElementBase): name = "foo2" @@ -65,7 +65,7 @@ class TestElementBase(SlixTest): substanza['bar'] = 'c' stanza.append(substanza) - values = stanza.getStanzaValues() + values = stanza.get_stanza_values() expected = {'lang': '', 'bar': 'a', 'baz': '', @@ -85,7 +85,7 @@ class TestElementBase(SlixTest): def testSetStanzaValues(self): - """Test using setStanzaValues with substanzas and plugins.""" + """Test using set_stanza_values with substanzas and plugins.""" class TestStanzaPlugin(ElementBase): name = "pluginfoo" @@ -157,10 +157,10 @@ class TestElementBase(SlixTest): stanza = TestStanza() substanza = TestStanza() stanza.append(substanza) - stanza.setStanzaValues({'bar': 'a', - 'baz': 'b', - 'qux': 42, - 'foobar': {'fizz': 'c'}}) + stanza.set_stanza_values({'bar': 'a', + 'baz': 'b', + 'qux': 42, + 'foobar': {'fizz': 'c'}}) # Test non-plugin interfaces expected = {'substanzas': [substanza], diff --git a/tests/test_stanza_iq.py b/tests/test_stanza_iq.py index 26dbc295..f6921df8 100644 --- a/tests/test_stanza_iq.py +++ b/tests/test_stanza_iq.py @@ -19,7 +19,7 @@ class TestIqStanzas(SlixTest): def testPayload(self): """Test setting Iq stanza payload.""" iq = self.Iq() - iq.setPayload(ET.Element('{test}tester')) + iq.set_payload(ET.Element('{test}tester')) self.check(iq, """ diff --git a/tests/test_stanza_roster.py b/tests/test_stanza_roster.py index 762b8c4c..4496fc18 100644 --- a/tests/test_stanza_roster.py +++ b/tests/test_stanza_roster.py @@ -8,7 +8,7 @@ class TestRosterStanzas(SlixTest): def testAddItems(self): """Test adding items to a roster stanza.""" iq = self.Iq() - iq['roster'].setItems({ + iq['roster'].set_items({ 'user@example.com': { 'name': 'User', 'subscription': 'both',