From c4285961df7004f6c54d6d38960c4c075d0877b6 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sat, 22 Oct 2016 13:20:27 +0100 Subject: [PATCH] sed -i 's/set((\(.*\)))$/{\1}/g' **/*.py --- examples/custom_stanzas/stanza.py | 2 +- slixmpp/features/feature_bind/stanza.py | 2 +- .../feature_mechanisms/stanza/auth.py | 2 +- .../feature_mechanisms/stanza/failure.py | 2 +- .../feature_mechanisms/stanza/mechanisms.py | 2 +- slixmpp/plugins/gmail_notify.py | 6 +-- slixmpp/plugins/xep_0004/stanza/field.py | 8 ++-- slixmpp/plugins/xep_0004/stanza/form.py | 2 +- slixmpp/plugins/xep_0009/stanza/RPC.py | 12 +++--- slixmpp/plugins/xep_0012/stanza.py | 2 +- slixmpp/plugins/xep_0030/stanza/info.py | 2 +- slixmpp/plugins/xep_0030/stanza/items.py | 4 +- slixmpp/plugins/xep_0033/stanza.py | 2 +- slixmpp/plugins/xep_0045.py | 6 +-- slixmpp/plugins/xep_0047/stanza.py | 4 +- slixmpp/plugins/xep_0050/stanza.py | 6 +-- slixmpp/plugins/xep_0060/stanza/pubsub.py | 20 ++++----- .../plugins/xep_0060/stanza/pubsub_errors.py | 2 +- .../plugins/xep_0060/stanza/pubsub_event.py | 6 +-- .../plugins/xep_0060/stanza/pubsub_owner.py | 8 ++-- slixmpp/plugins/xep_0066/stanza.py | 6 +-- slixmpp/plugins/xep_0078/stanza.py | 4 +- slixmpp/plugins/xep_0085/stanza.py | 2 +- slixmpp/plugins/xep_0091/stanza.py | 2 +- slixmpp/plugins/xep_0092/stanza.py | 2 +- slixmpp/plugins/xep_0115/stanza.py | 2 +- slixmpp/plugins/xep_0202/stanza.py | 2 +- slixmpp/plugins/xep_0203/stanza.py | 2 +- slixmpp/plugins/xep_0231/stanza.py | 2 +- slixmpp/stanza/atom.py | 6 +-- slixmpp/stanza/error.py | 2 +- slixmpp/stanza/iq.py | 4 +- slixmpp/stanza/roster.py | 2 +- slixmpp/stanza/stream_error.py | 2 +- slixmpp/stanza/stream_features.py | 2 +- slixmpp/xmlstream/stanzabase.py | 10 ++--- tests/test_stanza_element.py | 42 +++++++++---------- tests/test_stream_presence.py | 6 +-- 38 files changed, 100 insertions(+), 100 deletions(-) diff --git a/examples/custom_stanzas/stanza.py b/examples/custom_stanzas/stanza.py index b2c6f766..17b7c7de 100644 --- a/examples/custom_stanzas/stanza.py +++ b/examples/custom_stanzas/stanza.py @@ -41,7 +41,7 @@ class Action(ElementBase): #: del action['status'] #: #: to set, get, or remove its values. - interfaces = set(('method', 'param', 'status')) + interfaces = {'method', 'param', 'status'} #: By default, values in the `interfaces` set are mapped to #: attribute values. This can be changed such that an interface diff --git a/slixmpp/features/feature_bind/stanza.py b/slixmpp/features/feature_bind/stanza.py index b9ecd97c..96c3e757 100644 --- a/slixmpp/features/feature_bind/stanza.py +++ b/slixmpp/features/feature_bind/stanza.py @@ -16,6 +16,6 @@ class Bind(ElementBase): name = 'bind' namespace = 'urn:ietf:params:xml:ns:xmpp-bind' - interfaces = set(('resource', 'jid')) + interfaces = {'resource', 'jid'} sub_interfaces = interfaces plugin_attrib = 'bind' diff --git a/slixmpp/features/feature_mechanisms/stanza/auth.py b/slixmpp/features/feature_mechanisms/stanza/auth.py index c32069ec..e024ef22 100644 --- a/slixmpp/features/feature_mechanisms/stanza/auth.py +++ b/slixmpp/features/feature_mechanisms/stanza/auth.py @@ -19,7 +19,7 @@ class Auth(StanzaBase): name = 'auth' namespace = 'urn:ietf:params:xml:ns:xmpp-sasl' - interfaces = set(('mechanism', 'value')) + interfaces = {'mechanism', 'value'} plugin_attrib = name #: Some SASL mechs require sending values as is, diff --git a/slixmpp/features/feature_mechanisms/stanza/failure.py b/slixmpp/features/feature_mechanisms/stanza/failure.py index 29f0a343..b4428fcc 100644 --- a/slixmpp/features/feature_mechanisms/stanza/failure.py +++ b/slixmpp/features/feature_mechanisms/stanza/failure.py @@ -16,7 +16,7 @@ class Failure(StanzaBase): name = 'failure' namespace = 'urn:ietf:params:xml:ns:xmpp-sasl' - interfaces = set(('condition', 'text')) + interfaces = {'condition', 'text'} plugin_attrib = name sub_interfaces = {'text'} conditions = set(('aborted', 'account-disabled', 'credentials-expired', diff --git a/slixmpp/features/feature_mechanisms/stanza/mechanisms.py b/slixmpp/features/feature_mechanisms/stanza/mechanisms.py index 064b8d1f..4ff15678 100644 --- a/slixmpp/features/feature_mechanisms/stanza/mechanisms.py +++ b/slixmpp/features/feature_mechanisms/stanza/mechanisms.py @@ -16,7 +16,7 @@ class Mechanisms(ElementBase): name = 'mechanisms' namespace = 'urn:ietf:params:xml:ns:xmpp-sasl' - interfaces = set(('mechanisms', 'required')) + interfaces = {'mechanisms', 'required'} plugin_attrib = name is_extension = True diff --git a/slixmpp/plugins/gmail_notify.py b/slixmpp/plugins/gmail_notify.py index f4cf188c..2a85e17f 100644 --- a/slixmpp/plugins/gmail_notify.py +++ b/slixmpp/plugins/gmail_notify.py @@ -21,7 +21,7 @@ class GmailQuery(ElementBase): namespace = 'google:mail:notify' name = 'query' plugin_attrib = 'gmail' - interfaces = set(('newer-than-time', 'newer-than-tid', 'q', 'search')) + interfaces = {'newer-than-time', 'newer-than-tid', 'q', 'search'} def get_search(self): return self['q'] @@ -60,7 +60,7 @@ class MailThread(ElementBase): plugin_attrib = 'thread' interfaces = set(('tid', 'participation', 'messages', 'date', 'senders', 'url', 'labels', 'subject', 'snippet')) - sub_interfaces = set(('labels', 'subject', 'snippet')) + sub_interfaces = {'labels', 'subject', 'snippet'} def get_senders(self): senders = [] @@ -75,7 +75,7 @@ class MailSender(ElementBase): namespace = 'google:mail:notify' name = 'sender' plugin_attrib = 'sender' - interfaces = set(('address', 'name', 'originator', 'unread')) + interfaces = {'address', 'name', 'originator', 'unread'} def get_originator(self): return self.xml.attrib.get('originator', '0') == '1' diff --git a/slixmpp/plugins/xep_0004/stanza/field.py b/slixmpp/plugins/xep_0004/stanza/field.py index 2bcc823a..2eebbe6f 100644 --- a/slixmpp/plugins/xep_0004/stanza/field.py +++ b/slixmpp/plugins/xep_0004/stanza/field.py @@ -24,9 +24,9 @@ class FormField(ElementBase): 'jid-single', 'list-multi', 'list-single', 'text-multi', 'text-private', 'text-single')) - true_values = set((True, '1', 'true')) - option_types = set(('list-multi', 'list-single')) - multi_line_types = set(('hidden', 'text-multi')) + true_values = {True, '1', 'true'} + option_types = {'list-multi', 'list-single'} + multi_line_types = {'hidden', 'text-multi'} multi_value_types = set(('hidden', 'jid-multi', 'list-multi', 'text-multi')) @@ -164,7 +164,7 @@ class FieldOption(ElementBase): namespace = 'jabber:x:data' name = 'option' plugin_attrib = 'option' - interfaces = set(('label', 'value')) + interfaces = {'label', 'value'} sub_interfaces = {'value'} plugin_multi_attrib = 'options' diff --git a/slixmpp/plugins/xep_0004/stanza/form.py b/slixmpp/plugins/xep_0004/stanza/form.py index 52b18f81..0ae22098 100644 --- a/slixmpp/plugins/xep_0004/stanza/form.py +++ b/slixmpp/plugins/xep_0004/stanza/form.py @@ -25,7 +25,7 @@ class Form(ElementBase): plugin_attrib = 'form' interfaces = OrderedSet(('instructions', 'reported', 'title', 'type', 'items', )) sub_interfaces = {'title'} - form_types = set(('cancel', 'form', 'result', 'submit')) + form_types = {'cancel', 'form', 'result', 'submit'} def __init__(self, *args, **kwargs): title = None diff --git a/slixmpp/plugins/xep_0009/stanza/RPC.py b/slixmpp/plugins/xep_0009/stanza/RPC.py index 3abab8fc..f8cec481 100644 --- a/slixmpp/plugins/xep_0009/stanza/RPC.py +++ b/slixmpp/plugins/xep_0009/stanza/RPC.py @@ -14,8 +14,8 @@ class RPCQuery(ElementBase): name = 'query' namespace = 'jabber:iq:rpc' plugin_attrib = 'rpc_query' - interfaces = set(()) - subinterfaces = set(()) + interfaces = {} + subinterfaces = {} plugin_attrib_map = {} plugin_tag_map = {} @@ -24,8 +24,8 @@ class MethodCall(ElementBase): name = 'methodCall' namespace = 'jabber:iq:rpc' plugin_attrib = 'method_call' - interfaces = set(('method_name', 'params')) - subinterfaces = set(()) + interfaces = {'method_name', 'params'} + subinterfaces = {} plugin_attrib_map = {} plugin_tag_map = {} @@ -46,8 +46,8 @@ class MethodResponse(ElementBase): name = 'methodResponse' namespace = 'jabber:iq:rpc' plugin_attrib = 'method_response' - interfaces = set(('params', 'fault')) - subinterfaces = set(()) + interfaces = {'params', 'fault'} + subinterfaces = {} plugin_attrib_map = {} plugin_tag_map = {} diff --git a/slixmpp/plugins/xep_0012/stanza.py b/slixmpp/plugins/xep_0012/stanza.py index bd539a2d..16ca6fcf 100644 --- a/slixmpp/plugins/xep_0012/stanza.py +++ b/slixmpp/plugins/xep_0012/stanza.py @@ -14,7 +14,7 @@ class LastActivity(ElementBase): name = 'query' namespace = 'jabber:iq:last' plugin_attrib = 'last_activity' - interfaces = set(('seconds', 'status')) + interfaces = {'seconds', 'status'} def get_seconds(self): return int(self._get_attr('seconds')) diff --git a/slixmpp/plugins/xep_0030/stanza/info.py b/slixmpp/plugins/xep_0030/stanza/info.py index a09c85a8..7102d529 100644 --- a/slixmpp/plugins/xep_0030/stanza/info.py +++ b/slixmpp/plugins/xep_0030/stanza/info.py @@ -71,7 +71,7 @@ class DiscoInfo(ElementBase): name = 'query' namespace = 'http://jabber.org/protocol/disco#info' plugin_attrib = 'disco_info' - interfaces = set(('node', 'features', 'identities')) + interfaces = {'node', 'features', 'identities'} lang_interfaces = {'identities'} # Cache identities and features diff --git a/slixmpp/plugins/xep_0030/stanza/items.py b/slixmpp/plugins/xep_0030/stanza/items.py index 314ab9b3..a59d9114 100644 --- a/slixmpp/plugins/xep_0030/stanza/items.py +++ b/slixmpp/plugins/xep_0030/stanza/items.py @@ -45,7 +45,7 @@ class DiscoItems(ElementBase): name = 'query' namespace = 'http://jabber.org/protocol/disco#items' plugin_attrib = 'disco_items' - interfaces = set(('node', 'items')) + interfaces = {'node', 'items'} # Cache items _items = set() @@ -138,7 +138,7 @@ class DiscoItem(ElementBase): name = 'item' namespace = 'http://jabber.org/protocol/disco#items' plugin_attrib = name - interfaces = set(('jid', 'node', 'name')) + interfaces = {'jid', 'node', 'name'} def get_node(self): """Return the item's node name or ``None``.""" diff --git a/slixmpp/plugins/xep_0033/stanza.py b/slixmpp/plugins/xep_0033/stanza.py index 50c7b6db..d2a67de1 100644 --- a/slixmpp/plugins/xep_0033/stanza.py +++ b/slixmpp/plugins/xep_0033/stanza.py @@ -39,7 +39,7 @@ class Address(ElementBase): plugin_attrib = 'address' interfaces = set(['type', 'jid', 'node', 'uri', 'desc', 'delivered']) - address_types = set(('bcc', 'cc', 'noreply', 'replyroom', 'replyto', 'to')) + address_types = {'bcc', 'cc', 'noreply', 'replyroom', 'replyto', 'to'} def get_jid(self): return JID(self._get_attr('jid')) diff --git a/slixmpp/plugins/xep_0045.py b/slixmpp/plugins/xep_0045.py index 942ba22a..ce4631ef 100644 --- a/slixmpp/plugins/xep_0045.py +++ b/slixmpp/plugins/xep_0045.py @@ -25,9 +25,9 @@ class MUCPresence(ElementBase): name = 'x' namespace = 'http://jabber.org/protocol/muc#user' plugin_attrib = 'muc' - interfaces = set(('affiliation', 'role', 'jid', 'nick', 'room')) - affiliations = set(('', )) - roles = set(('', )) + interfaces = {'affiliation', 'role', 'jid', 'nick', 'room'} + affiliations = {'', } + roles = {'', } def get_xml_item(self): item = self.xml.find('{http://jabber.org/protocol/muc#user}item') diff --git a/slixmpp/plugins/xep_0047/stanza.py b/slixmpp/plugins/xep_0047/stanza.py index 7f8ff0ba..91f17c1c 100644 --- a/slixmpp/plugins/xep_0047/stanza.py +++ b/slixmpp/plugins/xep_0047/stanza.py @@ -21,7 +21,7 @@ class Open(ElementBase): name = 'open' namespace = 'http://jabber.org/protocol/ibb' plugin_attrib = 'ibb_open' - interfaces = set(('block_size', 'sid', 'stanza')) + interfaces = {'block_size', 'sid', 'stanza'} def get_block_size(self): return int(self._get_attr('block-size', '0')) @@ -37,7 +37,7 @@ class Data(ElementBase): name = 'data' namespace = 'http://jabber.org/protocol/ibb' plugin_attrib = 'ibb_data' - interfaces = set(('seq', 'sid', 'data')) + interfaces = {'seq', 'sid', 'data'} sub_interfaces = set(['data']) def get_seq(self): diff --git a/slixmpp/plugins/xep_0050/stanza.py b/slixmpp/plugins/xep_0050/stanza.py index 107135f4..d512425d 100644 --- a/slixmpp/plugins/xep_0050/stanza.py +++ b/slixmpp/plugins/xep_0050/stanza.py @@ -74,9 +74,9 @@ class Command(ElementBase): plugin_attrib = 'command' interfaces = set(('action', 'sessionid', 'node', 'status', 'actions', 'notes')) - actions = set(('cancel', 'complete', 'execute', 'next', 'prev')) - statuses = set(('canceled', 'completed', 'executing')) - next_actions = set(('prev', 'next', 'complete')) + actions = {'cancel', 'complete', 'execute', 'next', 'prev'} + statuses = {'canceled', 'completed', 'executing'} + next_actions = {'prev', 'next', 'complete'} def get_action(self): """ diff --git a/slixmpp/plugins/xep_0060/stanza/pubsub.py b/slixmpp/plugins/xep_0060/stanza/pubsub.py index 841e69d2..210bce08 100644 --- a/slixmpp/plugins/xep_0060/stanza/pubsub.py +++ b/slixmpp/plugins/xep_0060/stanza/pubsub.py @@ -30,7 +30,7 @@ class Affiliation(ElementBase): namespace = 'http://jabber.org/protocol/pubsub' name = 'affiliation' plugin_attrib = name - interfaces = set(('node', 'affiliation', 'jid')) + interfaces = {'node', 'affiliation', 'jid'} def set_jid(self, value): self._set_attr('jid', str(value)) @@ -43,7 +43,7 @@ class Subscription(ElementBase): namespace = 'http://jabber.org/protocol/pubsub' name = 'subscription' plugin_attrib = name - interfaces = set(('jid', 'node', 'subscription', 'subid')) + interfaces = {'jid', 'node', 'subscription', 'subid'} def set_jid(self, value): self._set_attr('jid', str(value)) @@ -70,7 +70,7 @@ class Item(ElementBase): namespace = 'http://jabber.org/protocol/pubsub' name = 'item' plugin_attrib = name - interfaces = set(('id', 'payload')) + interfaces = {'id', 'payload'} def set_payload(self, value): del self['payload'] @@ -95,7 +95,7 @@ class Items(ElementBase): namespace = 'http://jabber.org/protocol/pubsub' name = 'items' plugin_attrib = name - interfaces = set(('node', 'max_items')) + interfaces = {'node', 'max_items'} def set_max_items(self, value): self._set_attr('max_items', str(value)) @@ -112,7 +112,7 @@ class Default(ElementBase): namespace = 'http://jabber.org/protocol/pubsub' name = 'default' plugin_attrib = name - interfaces = set(('node', 'type')) + interfaces = {'node', 'type'} def get_type(self): t = self._get_attr('type') @@ -132,7 +132,7 @@ class Retract(ElementBase): namespace = 'http://jabber.org/protocol/pubsub' name = 'retract' plugin_attrib = name - interfaces = set(('node', 'notify')) + interfaces = {'node', 'notify'} def get_notify(self): notify = self._get_attr('notify') @@ -156,7 +156,7 @@ class Unsubscribe(ElementBase): namespace = 'http://jabber.org/protocol/pubsub' name = 'unsubscribe' plugin_attrib = name - interfaces = set(('node', 'jid', 'subid')) + interfaces = {'node', 'jid', 'subid'} def set_jid(self, value): self._set_attr('jid', str(value)) @@ -169,7 +169,7 @@ class Subscribe(ElementBase): namespace = 'http://jabber.org/protocol/pubsub' name = 'subscribe' plugin_attrib = name - interfaces = set(('node', 'jid')) + interfaces = {'node', 'jid'} def set_jid(self, value): self._set_attr('jid', str(value)) @@ -182,7 +182,7 @@ class Configure(ElementBase): namespace = 'http://jabber.org/protocol/pubsub' name = 'configure' plugin_attrib = name - interfaces = set(('node', 'type')) + interfaces = {'node', 'type'} def getType(self): t = self._get_attr('type') @@ -195,7 +195,7 @@ class Options(ElementBase): namespace = 'http://jabber.org/protocol/pubsub' name = 'options' plugin_attrib = name - interfaces = set(('jid', 'node', 'options')) + interfaces = {'jid', 'node', 'options'} def __init__(self, *args, **kwargs): ElementBase.__init__(self, *args, **kwargs) diff --git a/slixmpp/plugins/xep_0060/stanza/pubsub_errors.py b/slixmpp/plugins/xep_0060/stanza/pubsub_errors.py index 3e728009..7786c854 100644 --- a/slixmpp/plugins/xep_0060/stanza/pubsub_errors.py +++ b/slixmpp/plugins/xep_0060/stanza/pubsub_errors.py @@ -13,7 +13,7 @@ from slixmpp.xmlstream import ElementBase, ET, register_stanza_plugin class PubsubErrorCondition(ElementBase): plugin_attrib = 'pubsub' - interfaces = set(('condition', 'unsupported')) + interfaces = {'condition', 'unsupported'} plugin_attrib_map = {} plugin_tag_map = {} conditions = set(('closed-node', 'configuration-required', 'invalid-jid', diff --git a/slixmpp/plugins/xep_0060/stanza/pubsub_event.py b/slixmpp/plugins/xep_0060/stanza/pubsub_event.py index b2b53d3d..e46ad408 100644 --- a/slixmpp/plugins/xep_0060/stanza/pubsub_event.py +++ b/slixmpp/plugins/xep_0060/stanza/pubsub_event.py @@ -25,7 +25,7 @@ class EventItem(ElementBase): namespace = 'http://jabber.org/protocol/pubsub#event' name = 'item' plugin_attrib = name - interfaces = set(('id', 'payload', 'node', 'publisher')) + interfaces = {'id', 'payload', 'node', 'publisher'} def set_payload(self, value): self.xml.append(value) @@ -93,7 +93,7 @@ class EventDelete(ElementBase): namespace = 'http://jabber.org/protocol/pubsub#event' name = 'delete' plugin_attrib = name - interfaces = set(('node', 'redirect')) + interfaces = {'node', 'redirect'} def set_redirect(self, uri): del self['redirect'] @@ -117,7 +117,7 @@ class EventSubscription(ElementBase): namespace = 'http://jabber.org/protocol/pubsub#event' name = 'subscription' plugin_attrib = name - interfaces = set(('node', 'expiry', 'jid', 'subid', 'subscription')) + interfaces = {'node', 'expiry', 'jid', 'subid', 'subscription'} def get_expiry(self): expiry = self._get_attr('expiry') diff --git a/slixmpp/plugins/xep_0060/stanza/pubsub_owner.py b/slixmpp/plugins/xep_0060/stanza/pubsub_owner.py index bcb96149..850df8cf 100644 --- a/slixmpp/plugins/xep_0060/stanza/pubsub_owner.py +++ b/slixmpp/plugins/xep_0060/stanza/pubsub_owner.py @@ -25,7 +25,7 @@ class DefaultConfig(ElementBase): namespace = 'http://jabber.org/protocol/pubsub#owner' name = 'default' plugin_attrib = name - interfaces = set(('node', 'config')) + interfaces = {'node', 'config'} def __init__(self, *args, **kwargs): ElementBase.__init__(self, *args, **kwargs) @@ -51,7 +51,7 @@ class OwnerAffiliations(Affiliations): class OwnerAffiliation(Affiliation): namespace = 'http://jabber.org/protocol/pubsub#owner' - interfaces = set(('affiliation', 'jid')) + interfaces = {'affiliation', 'jid'} class OwnerConfigure(Configure): @@ -84,7 +84,7 @@ class OwnerRedirect(ElementBase): namespace = 'http://jabber.org/protocol/pubsub#owner' name = 'redirect' plugin_attrib = name - interfaces = set(('node', 'jid')) + interfaces = {'node', 'jid'} def set_jid(self, value): self._set_attr('jid', str(value)) @@ -109,7 +109,7 @@ class OwnerSubscription(ElementBase): namespace = 'http://jabber.org/protocol/pubsub#owner' name = 'subscription' plugin_attrib = name - interfaces = set(('jid', 'subscription')) + interfaces = {'jid', 'subscription'} def set_jid(self, value): self._set_attr('jid', str(value)) diff --git a/slixmpp/plugins/xep_0066/stanza.py b/slixmpp/plugins/xep_0066/stanza.py index e1da5bdd..55707b99 100644 --- a/slixmpp/plugins/xep_0066/stanza.py +++ b/slixmpp/plugins/xep_0066/stanza.py @@ -17,8 +17,8 @@ class OOBTransfer(ElementBase): name = 'query' namespace = 'jabber:iq:oob' plugin_attrib = 'oob_transfer' - interfaces = set(('url', 'desc', 'sid')) - sub_interfaces = set(('url', 'desc')) + interfaces = {'url', 'desc', 'sid'} + sub_interfaces = {'url', 'desc'} class OOB(ElementBase): @@ -29,5 +29,5 @@ class OOB(ElementBase): name = 'x' namespace = 'jabber:x:oob' plugin_attrib = 'oob' - interfaces = set(('url', 'desc')) + interfaces = {'url', 'desc'} sub_interfaces = interfaces diff --git a/slixmpp/plugins/xep_0078/stanza.py b/slixmpp/plugins/xep_0078/stanza.py index 7dc9401d..2a9ba510 100644 --- a/slixmpp/plugins/xep_0078/stanza.py +++ b/slixmpp/plugins/xep_0078/stanza.py @@ -13,8 +13,8 @@ class IqAuth(ElementBase): namespace = 'jabber:iq:auth' name = 'query' plugin_attrib = 'auth' - interfaces = set(('fields', 'username', 'password', 'resource', 'digest')) - sub_interfaces = set(('username', 'password', 'resource', 'digest')) + interfaces = {'fields', 'username', 'password', 'resource', 'digest'} + sub_interfaces = {'username', 'password', 'resource', 'digest'} plugin_tag_map = {} plugin_attrib_map = {} diff --git a/slixmpp/plugins/xep_0085/stanza.py b/slixmpp/plugins/xep_0085/stanza.py index f5048f45..d0987308 100644 --- a/slixmpp/plugins/xep_0085/stanza.py +++ b/slixmpp/plugins/xep_0085/stanza.py @@ -41,7 +41,7 @@ class ChatState(ElementBase): sub_interfaces = interfaces is_extension = True - states = set(('active', 'composing', 'gone', 'inactive', 'paused')) + states = {'active', 'composing', 'gone', 'inactive', 'paused'} def setup(self, xml=None): self.xml = ET.Element('') diff --git a/slixmpp/plugins/xep_0091/stanza.py b/slixmpp/plugins/xep_0091/stanza.py index ac6457e6..0ce2acda 100644 --- a/slixmpp/plugins/xep_0091/stanza.py +++ b/slixmpp/plugins/xep_0091/stanza.py @@ -18,7 +18,7 @@ class LegacyDelay(ElementBase): name = 'x' namespace = 'jabber:x:delay' plugin_attrib = 'legacy_delay' - interfaces = set(('from', 'stamp', 'text')) + interfaces = {'from', 'stamp', 'text'} def get_from(self): from_ = self._get_attr('from') diff --git a/slixmpp/plugins/xep_0092/stanza.py b/slixmpp/plugins/xep_0092/stanza.py index 04097a8b..e76a041e 100644 --- a/slixmpp/plugins/xep_0092/stanza.py +++ b/slixmpp/plugins/xep_0092/stanza.py @@ -38,5 +38,5 @@ class Version(ElementBase): name = 'query' namespace = 'jabber:iq:version' plugin_attrib = 'software_version' - interfaces = set(('name', 'version', 'os')) + interfaces = {'name', 'version', 'os'} sub_interfaces = interfaces diff --git a/slixmpp/plugins/xep_0115/stanza.py b/slixmpp/plugins/xep_0115/stanza.py index 36fb173c..1811307f 100644 --- a/slixmpp/plugins/xep_0115/stanza.py +++ b/slixmpp/plugins/xep_0115/stanza.py @@ -16,4 +16,4 @@ class Capabilities(ElementBase): namespace = 'http://jabber.org/protocol/caps' name = 'c' plugin_attrib = 'caps' - interfaces = set(('hash', 'node', 'ver', 'ext')) + interfaces = {'hash', 'node', 'ver', 'ext'} diff --git a/slixmpp/plugins/xep_0202/stanza.py b/slixmpp/plugins/xep_0202/stanza.py index c855663b..d97b2fb2 100644 --- a/slixmpp/plugins/xep_0202/stanza.py +++ b/slixmpp/plugins/xep_0202/stanza.py @@ -48,7 +48,7 @@ class EntityTime(ElementBase): name = 'time' namespace = 'urn:xmpp:time' plugin_attrib = 'entity_time' - interfaces = set(('tzo', 'utc', 'time')) + interfaces = {'tzo', 'utc', 'time'} sub_interfaces = interfaces def set_time(self, value): diff --git a/slixmpp/plugins/xep_0203/stanza.py b/slixmpp/plugins/xep_0203/stanza.py index de907c69..5daed864 100644 --- a/slixmpp/plugins/xep_0203/stanza.py +++ b/slixmpp/plugins/xep_0203/stanza.py @@ -18,7 +18,7 @@ class Delay(ElementBase): name = 'delay' namespace = 'urn:xmpp:delay' plugin_attrib = 'delay' - interfaces = set(('from', 'stamp', 'text')) + interfaces = {'from', 'stamp', 'text'} def get_from(self): from_ = self._get_attr('from') diff --git a/slixmpp/plugins/xep_0231/stanza.py b/slixmpp/plugins/xep_0231/stanza.py index b3b96eff..3de99aac 100644 --- a/slixmpp/plugins/xep_0231/stanza.py +++ b/slixmpp/plugins/xep_0231/stanza.py @@ -18,7 +18,7 @@ class BitsOfBinary(ElementBase): name = 'data' namespace = 'urn:xmpp:bob' plugin_attrib = 'bob' - interfaces = set(('cid', 'max_age', 'type', 'data')) + interfaces = {'cid', 'max_age', 'type', 'data'} def get_max_age(self): return int(self._get_attr('max-age')) diff --git a/slixmpp/stanza/atom.py b/slixmpp/stanza/atom.py index ccded724..c7192dd8 100644 --- a/slixmpp/stanza/atom.py +++ b/slixmpp/stanza/atom.py @@ -21,7 +21,7 @@ class AtomEntry(ElementBase): namespace = 'http://www.w3.org/2005/Atom' name = 'entry' plugin_attrib = 'entry' - interfaces = set(('title', 'summary', 'id', 'published', 'updated')) + interfaces = {'title', 'summary', 'id', 'published', 'updated'} sub_interfaces = set(('title', 'summary', 'id', 'published', 'updated')) @@ -37,7 +37,7 @@ class AtomAuthor(ElementBase): name = 'author' plugin_attrib = 'author' - interfaces = set(('name', 'uri')) - sub_interfaces = set(('name', 'uri')) + interfaces = {'name', 'uri'} + sub_interfaces = {'name', 'uri'} register_stanza_plugin(AtomEntry, AtomAuthor) diff --git a/slixmpp/stanza/error.py b/slixmpp/stanza/error.py index 1499c652..145aaa24 100644 --- a/slixmpp/stanza/error.py +++ b/slixmpp/stanza/error.py @@ -66,7 +66,7 @@ class Error(ElementBase): 'service-unavailable', 'subscription-required', 'undefined-condition', 'unexpected-request')) condition_ns = 'urn:ietf:params:xml:ns:xmpp-stanzas' - types = set(('cancel', 'continue', 'modify', 'auth', 'wait')) + types = {'cancel', 'continue', 'modify', 'auth', 'wait'} def setup(self, xml=None): """ diff --git a/slixmpp/stanza/iq.py b/slixmpp/stanza/iq.py index a64dfa7f..af7e3109 100644 --- a/slixmpp/stanza/iq.py +++ b/slixmpp/stanza/iq.py @@ -57,8 +57,8 @@ class Iq(RootStanza): namespace = 'jabber:client' name = 'iq' - interfaces = set(('type', 'to', 'from', 'id', 'query')) - types = set(('get', 'result', 'set', 'error')) + interfaces = {'type', 'to', 'from', 'id', 'query'} + types = {'get', 'result', 'set', 'error'} plugin_attrib = name def __init__(self, *args, **kwargs): diff --git a/slixmpp/stanza/roster.py b/slixmpp/stanza/roster.py index c017c33f..f846d595 100644 --- a/slixmpp/stanza/roster.py +++ b/slixmpp/stanza/roster.py @@ -36,7 +36,7 @@ class Roster(ElementBase): namespace = 'jabber:iq:roster' name = 'query' plugin_attrib = 'roster' - interfaces = set(('items', 'ver')) + interfaces = {'items', 'ver'} def get_ver(self): """ diff --git a/slixmpp/stanza/stream_error.py b/slixmpp/stanza/stream_error.py index d8b8bb5a..1b5cceb2 100644 --- a/slixmpp/stanza/stream_error.py +++ b/slixmpp/stanza/stream_error.py @@ -54,7 +54,7 @@ class StreamError(Error, StanzaBase): """ namespace = 'http://etherx.jabber.org/streams' - interfaces = set(('condition', 'text', 'see_other_host')) + interfaces = {'condition', 'text', 'see_other_host'} conditions = set(( 'bad-format', 'bad-namespace-prefix', 'conflict', 'connection-timeout', 'host-gone', 'host-unknown', diff --git a/slixmpp/stanza/stream_features.py b/slixmpp/stanza/stream_features.py index 05788771..70d0ccca 100644 --- a/slixmpp/stanza/stream_features.py +++ b/slixmpp/stanza/stream_features.py @@ -17,7 +17,7 @@ class StreamFeatures(StanzaBase): name = 'features' namespace = 'http://etherx.jabber.org/streams' - interfaces = set(('features', 'required', 'optional')) + interfaces = {'features', 'required', 'optional'} sub_interfaces = interfaces plugin_tag_map = {} plugin_attrib_map = {} diff --git a/slixmpp/xmlstream/stanzabase.py b/slixmpp/xmlstream/stanzabase.py index 306fdb2e..1108adfb 100644 --- a/slixmpp/xmlstream/stanzabase.py +++ b/slixmpp/xmlstream/stanzabase.py @@ -212,7 +212,7 @@ class ElementBase(object): >>> class Message(ElementBase): ... name = "message" ... namespace = "jabber:client" - ... interfaces = set(('to', 'from', 'type', 'body')) + ... interfaces = {'to', 'from', 'type', 'body'} ... sub_interfaces = {'body'} The resulting Message stanza's contents may be accessed as so:: @@ -239,7 +239,7 @@ class ElementBase(object): >>> class MessagePlugin(ElementBase): ... name = "custom_plugin" ... namespace = "custom" - ... interfaces = set(('useful_thing', 'custom')) + ... interfaces = {'useful_thing', 'custom'} ... plugin_attrib = "custom" The plugin stanza class must be associated with its intended @@ -311,7 +311,7 @@ class ElementBase(object): #: manipulating the underlying XML object. This set may be augmented #: with the :attr:`plugin_attrib` value of any registered #: stanza plugins. - interfaces = set(('type', 'to', 'from', 'id', 'payload')) + interfaces = {'type', 'to', 'from', 'id', 'payload'} #: A subset of :attr:`interfaces` which maps interfaces to direct #: subelements of the underlying XML object. Using this set, the text @@ -1385,10 +1385,10 @@ class StanzaBase(ElementBase): #: There is a small set of attributes which apply to all XMPP stanzas: #: the stanza type, the to and from JIDs, the stanza ID, and, especially #: in the case of an Iq stanza, a payload. - interfaces = set(('type', 'to', 'from', 'id', 'payload')) + interfaces = {'type', 'to', 'from', 'id', 'payload'} #: A basic set of allowed values for the ``'type'`` interface. - types = set(('get', 'set', 'error', None, 'unavailable', 'normal', 'chat')) + types = {'get', 'set', 'error', None, 'unavailable', 'normal', 'chat'} def __init__(self, stream=None, xml=None, stype=None, sto=None, sfrom=None, sid=None, parent=None): diff --git a/tests/test_stanza_element.py b/tests/test_stanza_element.py index 7b6c5561..26cc2438 100644 --- a/tests/test_stanza_element.py +++ b/tests/test_stanza_element.py @@ -43,18 +43,18 @@ class TestElementBase(SlixTest): class TestStanzaPlugin(ElementBase): name = "foo2" namespace = "foo" - interfaces = set(('bar', 'baz')) + interfaces = {'bar', 'baz'} plugin_attrib = "foo2" class TestSubStanza(ElementBase): name = "subfoo" namespace = "foo" - interfaces = set(('bar', 'baz')) + interfaces = {'bar', 'baz'} class TestStanza(ElementBase): name = "foo" namespace = "foo" - interfaces = set(('bar', 'baz')) + interfaces = {'bar', 'baz'} register_stanza_plugin(TestStanza, TestStanzaPlugin, iterable=True) @@ -90,24 +90,24 @@ class TestElementBase(SlixTest): class TestStanzaPlugin(ElementBase): name = "pluginfoo" namespace = "foo" - interfaces = set(('bar', 'baz')) + interfaces = {'bar', 'baz'} plugin_attrib = "plugin_foo" class TestStanzaPlugin2(ElementBase): name = "pluginfoo2" namespace = "foo" - interfaces = set(('bar', 'baz')) + interfaces = {'bar', 'baz'} plugin_attrib = "plugin_foo2" class TestSubStanza(ElementBase): name = "subfoo" namespace = "foo" - interfaces = set(('bar', 'baz')) + interfaces = {'bar', 'baz'} class TestStanza(ElementBase): name = "foo" namespace = "foo" - interfaces = set(('bar', 'baz')) + interfaces = {'bar', 'baz'} register_stanza_plugin(TestStanza, TestSubStanza, iterable=True) register_stanza_plugin(TestStanza, TestStanzaPlugin) @@ -139,7 +139,7 @@ class TestElementBase(SlixTest): class TestStanza(ElementBase): name = "foo" namespace = "foo" - interfaces = set(('bar', 'baz', 'qux')) + interfaces = {'bar', 'baz', 'qux'} sub_interfaces = {'baz'} def get_qux(self): @@ -185,7 +185,7 @@ class TestElementBase(SlixTest): class TestStanza(ElementBase): name = "foo" namespace = "foo" - interfaces = set(('bar', 'baz', 'qux')) + interfaces = {'bar', 'baz', 'qux'} sub_interfaces = {'baz'} def set_qux(self, value): @@ -219,7 +219,7 @@ class TestElementBase(SlixTest): class TestStanza(ElementBase): name = "foo" namespace = "foo" - interfaces = set(('bar', 'baz', 'qux')) + interfaces = {'bar', 'baz', 'qux'} sub_interfaces = {'bar'} def del_qux(self): @@ -261,7 +261,7 @@ class TestElementBase(SlixTest): class TestStanza(ElementBase): name = "foo" namespace = "foo" - interfaces = set(('bar', 'baz')) + interfaces = {'bar', 'baz'} stanza = TestStanza() @@ -331,7 +331,7 @@ class TestElementBase(SlixTest): class TestStanza(ElementBase): name = "foo" namespace = "foo" - interfaces = set(('bar', 'baz')) + interfaces = {'bar', 'baz'} def set_baz(self, value): self._set_sub_text("wrapper/baz", text=value) @@ -382,7 +382,7 @@ class TestElementBase(SlixTest): class TestStanza(ElementBase): name = "foo" namespace = "foo" - interfaces = set(('bar', 'baz')) + interfaces = {'bar', 'baz'} def set_bar(self, value): self._set_sub_text("path/to/only/bar", value) @@ -463,7 +463,7 @@ class TestElementBase(SlixTest): class TestStanza(ElementBase): name = "foo" namespace = "foo" - interfaces = set(('bar','baz', 'qux')) + interfaces = {'bar','baz', 'qux'} sub_interfaces = {'qux'} def set_qux(self, value): @@ -528,7 +528,7 @@ class TestElementBase(SlixTest): class TestStanza(ElementBase): name = "foo" namespace = "foo" - interfaces = set(('bar', 'baz')) + interfaces = {'bar', 'baz'} stanza1 = TestStanza() stanza1['bar'] = 'a' @@ -554,7 +554,7 @@ class TestElementBase(SlixTest): class TestStanza(ElementBase): name = "foo" namespace = "foo" - interfaces = set(('bar', 'baz')) + interfaces = {'bar', 'baz'} plugin_attrib = 'qux' register_stanza_plugin(TestStanza, TestStanza) @@ -575,7 +575,7 @@ class TestElementBase(SlixTest): class TestStanza(ElementBase): name = "foo" namespace = "foo" - interfaces = set(('bar', 'baz')) + interfaces = {'bar', 'baz'} stanza = TestStanza() stanza['bar'] = 'a' @@ -597,7 +597,7 @@ class TestElementBase(SlixTest): class TestStanza(ElementBase): name = "foo" namespace = "foo" - interfaces = set(('bar', 'baz')) + interfaces = {'bar', 'baz'} register_stanza_plugin(TestStanza, TestSubStanza, iterable=True) @@ -652,7 +652,7 @@ class TestElementBase(SlixTest): class TestStanza(ElementBase): name = "foo" namespace = "foo" - interfaces = set(('bar', 'baz')) + interfaces = {'bar', 'baz'} stanza1 = TestStanza() stanza1['bar'] = 'a' @@ -672,7 +672,7 @@ class TestElementBase(SlixTest): class TestStanza(ElementBase): name = "foo" namespace = "foo" - interfaces = set(('bar', 'baz')) + interfaces = {'bar', 'baz'} class TestExtension(ElementBase): name = 'extended' @@ -715,7 +715,7 @@ class TestElementBase(SlixTest): class TestStanza(ElementBase): name = "foo" namespace = "foo" - interfaces = set(('bar', 'baz')) + interfaces = {'bar', 'baz'} class TestOverride(ElementBase): name = 'overrider' diff --git a/tests/test_stream_presence.py b/tests/test_stream_presence.py index ea2337a2..27559785 100644 --- a/tests/test_stream_presence.py +++ b/tests/test_stream_presence.py @@ -102,7 +102,7 @@ class TestStreamPresence(SlixTest): to="tester@localhost" /> """) - expected = set(('presence_available', 'got_online')) + expected = {'presence_available', 'got_online'} self.assertEqual(events, expected, "Incorrect events triggered: %s" % events) @@ -151,7 +151,7 @@ class TestStreamPresence(SlixTest): type="subscribe" /> """) - expected = set(('presence_subscribe', 'changed_subscription')) + expected = {'presence_subscribe', 'changed_subscription'} self.assertEqual(events, expected, "Incorrect events triggered: %s" % events) @@ -185,7 +185,7 @@ class TestStreamPresence(SlixTest): type="unsubscribed" /> """) - expected = set(('presence_subscribe', 'changed_subscription')) + expected = {'presence_subscribe', 'changed_subscription'} self.assertEqual(events, expected, "Incorrect events triggered: %s" % events)