sed -i 's/set((\(.*\)))$/{\1}/g' **/*.py

This commit is contained in:
Emmanuel Gil Peyrot 2016-10-22 13:20:27 +01:00
parent 1038f656eb
commit c4285961df
38 changed files with 100 additions and 100 deletions

View file

@ -41,7 +41,7 @@ class Action(ElementBase):
#: del action['status'] #: del action['status']
#: #:
#: to set, get, or remove its values. #: 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 #: By default, values in the `interfaces` set are mapped to
#: attribute values. This can be changed such that an interface #: attribute values. This can be changed such that an interface

View file

@ -16,6 +16,6 @@ class Bind(ElementBase):
name = 'bind' name = 'bind'
namespace = 'urn:ietf:params:xml:ns:xmpp-bind' namespace = 'urn:ietf:params:xml:ns:xmpp-bind'
interfaces = set(('resource', 'jid')) interfaces = {'resource', 'jid'}
sub_interfaces = interfaces sub_interfaces = interfaces
plugin_attrib = 'bind' plugin_attrib = 'bind'

View file

@ -19,7 +19,7 @@ class Auth(StanzaBase):
name = 'auth' name = 'auth'
namespace = 'urn:ietf:params:xml:ns:xmpp-sasl' namespace = 'urn:ietf:params:xml:ns:xmpp-sasl'
interfaces = set(('mechanism', 'value')) interfaces = {'mechanism', 'value'}
plugin_attrib = name plugin_attrib = name
#: Some SASL mechs require sending values as is, #: Some SASL mechs require sending values as is,

View file

@ -16,7 +16,7 @@ class Failure(StanzaBase):
name = 'failure' name = 'failure'
namespace = 'urn:ietf:params:xml:ns:xmpp-sasl' namespace = 'urn:ietf:params:xml:ns:xmpp-sasl'
interfaces = set(('condition', 'text')) interfaces = {'condition', 'text'}
plugin_attrib = name plugin_attrib = name
sub_interfaces = {'text'} sub_interfaces = {'text'}
conditions = set(('aborted', 'account-disabled', 'credentials-expired', conditions = set(('aborted', 'account-disabled', 'credentials-expired',

View file

@ -16,7 +16,7 @@ class Mechanisms(ElementBase):
name = 'mechanisms' name = 'mechanisms'
namespace = 'urn:ietf:params:xml:ns:xmpp-sasl' namespace = 'urn:ietf:params:xml:ns:xmpp-sasl'
interfaces = set(('mechanisms', 'required')) interfaces = {'mechanisms', 'required'}
plugin_attrib = name plugin_attrib = name
is_extension = True is_extension = True

View file

@ -21,7 +21,7 @@ class GmailQuery(ElementBase):
namespace = 'google:mail:notify' namespace = 'google:mail:notify'
name = 'query' name = 'query'
plugin_attrib = 'gmail' 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): def get_search(self):
return self['q'] return self['q']
@ -60,7 +60,7 @@ class MailThread(ElementBase):
plugin_attrib = 'thread' plugin_attrib = 'thread'
interfaces = set(('tid', 'participation', 'messages', 'date', interfaces = set(('tid', 'participation', 'messages', 'date',
'senders', 'url', 'labels', 'subject', 'snippet')) 'senders', 'url', 'labels', 'subject', 'snippet'))
sub_interfaces = set(('labels', 'subject', 'snippet')) sub_interfaces = {'labels', 'subject', 'snippet'}
def get_senders(self): def get_senders(self):
senders = [] senders = []
@ -75,7 +75,7 @@ class MailSender(ElementBase):
namespace = 'google:mail:notify' namespace = 'google:mail:notify'
name = 'sender' name = 'sender'
plugin_attrib = 'sender' plugin_attrib = 'sender'
interfaces = set(('address', 'name', 'originator', 'unread')) interfaces = {'address', 'name', 'originator', 'unread'}
def get_originator(self): def get_originator(self):
return self.xml.attrib.get('originator', '0') == '1' return self.xml.attrib.get('originator', '0') == '1'

View file

@ -24,9 +24,9 @@ class FormField(ElementBase):
'jid-single', 'list-multi', 'list-single', 'jid-single', 'list-multi', 'list-single',
'text-multi', 'text-private', 'text-single')) 'text-multi', 'text-private', 'text-single'))
true_values = set((True, '1', 'true')) true_values = {True, '1', 'true'}
option_types = set(('list-multi', 'list-single')) option_types = {'list-multi', 'list-single'}
multi_line_types = set(('hidden', 'text-multi')) multi_line_types = {'hidden', 'text-multi'}
multi_value_types = set(('hidden', 'jid-multi', multi_value_types = set(('hidden', 'jid-multi',
'list-multi', 'text-multi')) 'list-multi', 'text-multi'))
@ -164,7 +164,7 @@ class FieldOption(ElementBase):
namespace = 'jabber:x:data' namespace = 'jabber:x:data'
name = 'option' name = 'option'
plugin_attrib = 'option' plugin_attrib = 'option'
interfaces = set(('label', 'value')) interfaces = {'label', 'value'}
sub_interfaces = {'value'} sub_interfaces = {'value'}
plugin_multi_attrib = 'options' plugin_multi_attrib = 'options'

View file

@ -25,7 +25,7 @@ class Form(ElementBase):
plugin_attrib = 'form' plugin_attrib = 'form'
interfaces = OrderedSet(('instructions', 'reported', 'title', 'type', 'items', )) interfaces = OrderedSet(('instructions', 'reported', 'title', 'type', 'items', ))
sub_interfaces = {'title'} sub_interfaces = {'title'}
form_types = set(('cancel', 'form', 'result', 'submit')) form_types = {'cancel', 'form', 'result', 'submit'}
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
title = None title = None

View file

@ -14,8 +14,8 @@ class RPCQuery(ElementBase):
name = 'query' name = 'query'
namespace = 'jabber:iq:rpc' namespace = 'jabber:iq:rpc'
plugin_attrib = 'rpc_query' plugin_attrib = 'rpc_query'
interfaces = set(()) interfaces = {}
subinterfaces = set(()) subinterfaces = {}
plugin_attrib_map = {} plugin_attrib_map = {}
plugin_tag_map = {} plugin_tag_map = {}
@ -24,8 +24,8 @@ class MethodCall(ElementBase):
name = 'methodCall' name = 'methodCall'
namespace = 'jabber:iq:rpc' namespace = 'jabber:iq:rpc'
plugin_attrib = 'method_call' plugin_attrib = 'method_call'
interfaces = set(('method_name', 'params')) interfaces = {'method_name', 'params'}
subinterfaces = set(()) subinterfaces = {}
plugin_attrib_map = {} plugin_attrib_map = {}
plugin_tag_map = {} plugin_tag_map = {}
@ -46,8 +46,8 @@ class MethodResponse(ElementBase):
name = 'methodResponse' name = 'methodResponse'
namespace = 'jabber:iq:rpc' namespace = 'jabber:iq:rpc'
plugin_attrib = 'method_response' plugin_attrib = 'method_response'
interfaces = set(('params', 'fault')) interfaces = {'params', 'fault'}
subinterfaces = set(()) subinterfaces = {}
plugin_attrib_map = {} plugin_attrib_map = {}
plugin_tag_map = {} plugin_tag_map = {}

View file

@ -14,7 +14,7 @@ class LastActivity(ElementBase):
name = 'query' name = 'query'
namespace = 'jabber:iq:last' namespace = 'jabber:iq:last'
plugin_attrib = 'last_activity' plugin_attrib = 'last_activity'
interfaces = set(('seconds', 'status')) interfaces = {'seconds', 'status'}
def get_seconds(self): def get_seconds(self):
return int(self._get_attr('seconds')) return int(self._get_attr('seconds'))

View file

@ -71,7 +71,7 @@ class DiscoInfo(ElementBase):
name = 'query' name = 'query'
namespace = 'http://jabber.org/protocol/disco#info' namespace = 'http://jabber.org/protocol/disco#info'
plugin_attrib = 'disco_info' plugin_attrib = 'disco_info'
interfaces = set(('node', 'features', 'identities')) interfaces = {'node', 'features', 'identities'}
lang_interfaces = {'identities'} lang_interfaces = {'identities'}
# Cache identities and features # Cache identities and features

View file

@ -45,7 +45,7 @@ class DiscoItems(ElementBase):
name = 'query' name = 'query'
namespace = 'http://jabber.org/protocol/disco#items' namespace = 'http://jabber.org/protocol/disco#items'
plugin_attrib = 'disco_items' plugin_attrib = 'disco_items'
interfaces = set(('node', 'items')) interfaces = {'node', 'items'}
# Cache items # Cache items
_items = set() _items = set()
@ -138,7 +138,7 @@ class DiscoItem(ElementBase):
name = 'item' name = 'item'
namespace = 'http://jabber.org/protocol/disco#items' namespace = 'http://jabber.org/protocol/disco#items'
plugin_attrib = name plugin_attrib = name
interfaces = set(('jid', 'node', 'name')) interfaces = {'jid', 'node', 'name'}
def get_node(self): def get_node(self):
"""Return the item's node name or ``None``.""" """Return the item's node name or ``None``."""

View file

@ -39,7 +39,7 @@ class Address(ElementBase):
plugin_attrib = 'address' plugin_attrib = 'address'
interfaces = set(['type', 'jid', 'node', 'uri', 'desc', 'delivered']) 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): def get_jid(self):
return JID(self._get_attr('jid')) return JID(self._get_attr('jid'))

View file

@ -25,9 +25,9 @@ class MUCPresence(ElementBase):
name = 'x' name = 'x'
namespace = 'http://jabber.org/protocol/muc#user' namespace = 'http://jabber.org/protocol/muc#user'
plugin_attrib = 'muc' plugin_attrib = 'muc'
interfaces = set(('affiliation', 'role', 'jid', 'nick', 'room')) interfaces = {'affiliation', 'role', 'jid', 'nick', 'room'}
affiliations = set(('', )) affiliations = {'', }
roles = set(('', )) roles = {'', }
def get_xml_item(self): def get_xml_item(self):
item = self.xml.find('{http://jabber.org/protocol/muc#user}item') item = self.xml.find('{http://jabber.org/protocol/muc#user}item')

View file

@ -21,7 +21,7 @@ class Open(ElementBase):
name = 'open' name = 'open'
namespace = 'http://jabber.org/protocol/ibb' namespace = 'http://jabber.org/protocol/ibb'
plugin_attrib = 'ibb_open' plugin_attrib = 'ibb_open'
interfaces = set(('block_size', 'sid', 'stanza')) interfaces = {'block_size', 'sid', 'stanza'}
def get_block_size(self): def get_block_size(self):
return int(self._get_attr('block-size', '0')) return int(self._get_attr('block-size', '0'))
@ -37,7 +37,7 @@ class Data(ElementBase):
name = 'data' name = 'data'
namespace = 'http://jabber.org/protocol/ibb' namespace = 'http://jabber.org/protocol/ibb'
plugin_attrib = 'ibb_data' plugin_attrib = 'ibb_data'
interfaces = set(('seq', 'sid', 'data')) interfaces = {'seq', 'sid', 'data'}
sub_interfaces = set(['data']) sub_interfaces = set(['data'])
def get_seq(self): def get_seq(self):

View file

@ -74,9 +74,9 @@ class Command(ElementBase):
plugin_attrib = 'command' plugin_attrib = 'command'
interfaces = set(('action', 'sessionid', 'node', interfaces = set(('action', 'sessionid', 'node',
'status', 'actions', 'notes')) 'status', 'actions', 'notes'))
actions = set(('cancel', 'complete', 'execute', 'next', 'prev')) actions = {'cancel', 'complete', 'execute', 'next', 'prev'}
statuses = set(('canceled', 'completed', 'executing')) statuses = {'canceled', 'completed', 'executing'}
next_actions = set(('prev', 'next', 'complete')) next_actions = {'prev', 'next', 'complete'}
def get_action(self): def get_action(self):
""" """

View file

@ -30,7 +30,7 @@ class Affiliation(ElementBase):
namespace = 'http://jabber.org/protocol/pubsub' namespace = 'http://jabber.org/protocol/pubsub'
name = 'affiliation' name = 'affiliation'
plugin_attrib = name plugin_attrib = name
interfaces = set(('node', 'affiliation', 'jid')) interfaces = {'node', 'affiliation', 'jid'}
def set_jid(self, value): def set_jid(self, value):
self._set_attr('jid', str(value)) self._set_attr('jid', str(value))
@ -43,7 +43,7 @@ class Subscription(ElementBase):
namespace = 'http://jabber.org/protocol/pubsub' namespace = 'http://jabber.org/protocol/pubsub'
name = 'subscription' name = 'subscription'
plugin_attrib = name plugin_attrib = name
interfaces = set(('jid', 'node', 'subscription', 'subid')) interfaces = {'jid', 'node', 'subscription', 'subid'}
def set_jid(self, value): def set_jid(self, value):
self._set_attr('jid', str(value)) self._set_attr('jid', str(value))
@ -70,7 +70,7 @@ class Item(ElementBase):
namespace = 'http://jabber.org/protocol/pubsub' namespace = 'http://jabber.org/protocol/pubsub'
name = 'item' name = 'item'
plugin_attrib = name plugin_attrib = name
interfaces = set(('id', 'payload')) interfaces = {'id', 'payload'}
def set_payload(self, value): def set_payload(self, value):
del self['payload'] del self['payload']
@ -95,7 +95,7 @@ class Items(ElementBase):
namespace = 'http://jabber.org/protocol/pubsub' namespace = 'http://jabber.org/protocol/pubsub'
name = 'items' name = 'items'
plugin_attrib = name plugin_attrib = name
interfaces = set(('node', 'max_items')) interfaces = {'node', 'max_items'}
def set_max_items(self, value): def set_max_items(self, value):
self._set_attr('max_items', str(value)) self._set_attr('max_items', str(value))
@ -112,7 +112,7 @@ class Default(ElementBase):
namespace = 'http://jabber.org/protocol/pubsub' namespace = 'http://jabber.org/protocol/pubsub'
name = 'default' name = 'default'
plugin_attrib = name plugin_attrib = name
interfaces = set(('node', 'type')) interfaces = {'node', 'type'}
def get_type(self): def get_type(self):
t = self._get_attr('type') t = self._get_attr('type')
@ -132,7 +132,7 @@ class Retract(ElementBase):
namespace = 'http://jabber.org/protocol/pubsub' namespace = 'http://jabber.org/protocol/pubsub'
name = 'retract' name = 'retract'
plugin_attrib = name plugin_attrib = name
interfaces = set(('node', 'notify')) interfaces = {'node', 'notify'}
def get_notify(self): def get_notify(self):
notify = self._get_attr('notify') notify = self._get_attr('notify')
@ -156,7 +156,7 @@ class Unsubscribe(ElementBase):
namespace = 'http://jabber.org/protocol/pubsub' namespace = 'http://jabber.org/protocol/pubsub'
name = 'unsubscribe' name = 'unsubscribe'
plugin_attrib = name plugin_attrib = name
interfaces = set(('node', 'jid', 'subid')) interfaces = {'node', 'jid', 'subid'}
def set_jid(self, value): def set_jid(self, value):
self._set_attr('jid', str(value)) self._set_attr('jid', str(value))
@ -169,7 +169,7 @@ class Subscribe(ElementBase):
namespace = 'http://jabber.org/protocol/pubsub' namespace = 'http://jabber.org/protocol/pubsub'
name = 'subscribe' name = 'subscribe'
plugin_attrib = name plugin_attrib = name
interfaces = set(('node', 'jid')) interfaces = {'node', 'jid'}
def set_jid(self, value): def set_jid(self, value):
self._set_attr('jid', str(value)) self._set_attr('jid', str(value))
@ -182,7 +182,7 @@ class Configure(ElementBase):
namespace = 'http://jabber.org/protocol/pubsub' namespace = 'http://jabber.org/protocol/pubsub'
name = 'configure' name = 'configure'
plugin_attrib = name plugin_attrib = name
interfaces = set(('node', 'type')) interfaces = {'node', 'type'}
def getType(self): def getType(self):
t = self._get_attr('type') t = self._get_attr('type')
@ -195,7 +195,7 @@ class Options(ElementBase):
namespace = 'http://jabber.org/protocol/pubsub' namespace = 'http://jabber.org/protocol/pubsub'
name = 'options' name = 'options'
plugin_attrib = name plugin_attrib = name
interfaces = set(('jid', 'node', 'options')) interfaces = {'jid', 'node', 'options'}
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
ElementBase.__init__(self, *args, **kwargs) ElementBase.__init__(self, *args, **kwargs)

View file

@ -13,7 +13,7 @@ from slixmpp.xmlstream import ElementBase, ET, register_stanza_plugin
class PubsubErrorCondition(ElementBase): class PubsubErrorCondition(ElementBase):
plugin_attrib = 'pubsub' plugin_attrib = 'pubsub'
interfaces = set(('condition', 'unsupported')) interfaces = {'condition', 'unsupported'}
plugin_attrib_map = {} plugin_attrib_map = {}
plugin_tag_map = {} plugin_tag_map = {}
conditions = set(('closed-node', 'configuration-required', 'invalid-jid', conditions = set(('closed-node', 'configuration-required', 'invalid-jid',

View file

@ -25,7 +25,7 @@ class EventItem(ElementBase):
namespace = 'http://jabber.org/protocol/pubsub#event' namespace = 'http://jabber.org/protocol/pubsub#event'
name = 'item' name = 'item'
plugin_attrib = name plugin_attrib = name
interfaces = set(('id', 'payload', 'node', 'publisher')) interfaces = {'id', 'payload', 'node', 'publisher'}
def set_payload(self, value): def set_payload(self, value):
self.xml.append(value) self.xml.append(value)
@ -93,7 +93,7 @@ class EventDelete(ElementBase):
namespace = 'http://jabber.org/protocol/pubsub#event' namespace = 'http://jabber.org/protocol/pubsub#event'
name = 'delete' name = 'delete'
plugin_attrib = name plugin_attrib = name
interfaces = set(('node', 'redirect')) interfaces = {'node', 'redirect'}
def set_redirect(self, uri): def set_redirect(self, uri):
del self['redirect'] del self['redirect']
@ -117,7 +117,7 @@ class EventSubscription(ElementBase):
namespace = 'http://jabber.org/protocol/pubsub#event' namespace = 'http://jabber.org/protocol/pubsub#event'
name = 'subscription' name = 'subscription'
plugin_attrib = name plugin_attrib = name
interfaces = set(('node', 'expiry', 'jid', 'subid', 'subscription')) interfaces = {'node', 'expiry', 'jid', 'subid', 'subscription'}
def get_expiry(self): def get_expiry(self):
expiry = self._get_attr('expiry') expiry = self._get_attr('expiry')

View file

@ -25,7 +25,7 @@ class DefaultConfig(ElementBase):
namespace = 'http://jabber.org/protocol/pubsub#owner' namespace = 'http://jabber.org/protocol/pubsub#owner'
name = 'default' name = 'default'
plugin_attrib = name plugin_attrib = name
interfaces = set(('node', 'config')) interfaces = {'node', 'config'}
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
ElementBase.__init__(self, *args, **kwargs) ElementBase.__init__(self, *args, **kwargs)
@ -51,7 +51,7 @@ class OwnerAffiliations(Affiliations):
class OwnerAffiliation(Affiliation): class OwnerAffiliation(Affiliation):
namespace = 'http://jabber.org/protocol/pubsub#owner' namespace = 'http://jabber.org/protocol/pubsub#owner'
interfaces = set(('affiliation', 'jid')) interfaces = {'affiliation', 'jid'}
class OwnerConfigure(Configure): class OwnerConfigure(Configure):
@ -84,7 +84,7 @@ class OwnerRedirect(ElementBase):
namespace = 'http://jabber.org/protocol/pubsub#owner' namespace = 'http://jabber.org/protocol/pubsub#owner'
name = 'redirect' name = 'redirect'
plugin_attrib = name plugin_attrib = name
interfaces = set(('node', 'jid')) interfaces = {'node', 'jid'}
def set_jid(self, value): def set_jid(self, value):
self._set_attr('jid', str(value)) self._set_attr('jid', str(value))
@ -109,7 +109,7 @@ class OwnerSubscription(ElementBase):
namespace = 'http://jabber.org/protocol/pubsub#owner' namespace = 'http://jabber.org/protocol/pubsub#owner'
name = 'subscription' name = 'subscription'
plugin_attrib = name plugin_attrib = name
interfaces = set(('jid', 'subscription')) interfaces = {'jid', 'subscription'}
def set_jid(self, value): def set_jid(self, value):
self._set_attr('jid', str(value)) self._set_attr('jid', str(value))

View file

@ -17,8 +17,8 @@ class OOBTransfer(ElementBase):
name = 'query' name = 'query'
namespace = 'jabber:iq:oob' namespace = 'jabber:iq:oob'
plugin_attrib = 'oob_transfer' plugin_attrib = 'oob_transfer'
interfaces = set(('url', 'desc', 'sid')) interfaces = {'url', 'desc', 'sid'}
sub_interfaces = set(('url', 'desc')) sub_interfaces = {'url', 'desc'}
class OOB(ElementBase): class OOB(ElementBase):
@ -29,5 +29,5 @@ class OOB(ElementBase):
name = 'x' name = 'x'
namespace = 'jabber:x:oob' namespace = 'jabber:x:oob'
plugin_attrib = 'oob' plugin_attrib = 'oob'
interfaces = set(('url', 'desc')) interfaces = {'url', 'desc'}
sub_interfaces = interfaces sub_interfaces = interfaces

View file

@ -13,8 +13,8 @@ class IqAuth(ElementBase):
namespace = 'jabber:iq:auth' namespace = 'jabber:iq:auth'
name = 'query' name = 'query'
plugin_attrib = 'auth' plugin_attrib = 'auth'
interfaces = set(('fields', 'username', 'password', 'resource', 'digest')) interfaces = {'fields', 'username', 'password', 'resource', 'digest'}
sub_interfaces = set(('username', 'password', 'resource', 'digest')) sub_interfaces = {'username', 'password', 'resource', 'digest'}
plugin_tag_map = {} plugin_tag_map = {}
plugin_attrib_map = {} plugin_attrib_map = {}

View file

@ -41,7 +41,7 @@ class ChatState(ElementBase):
sub_interfaces = interfaces sub_interfaces = interfaces
is_extension = True is_extension = True
states = set(('active', 'composing', 'gone', 'inactive', 'paused')) states = {'active', 'composing', 'gone', 'inactive', 'paused'}
def setup(self, xml=None): def setup(self, xml=None):
self.xml = ET.Element('') self.xml = ET.Element('')

View file

@ -18,7 +18,7 @@ class LegacyDelay(ElementBase):
name = 'x' name = 'x'
namespace = 'jabber:x:delay' namespace = 'jabber:x:delay'
plugin_attrib = 'legacy_delay' plugin_attrib = 'legacy_delay'
interfaces = set(('from', 'stamp', 'text')) interfaces = {'from', 'stamp', 'text'}
def get_from(self): def get_from(self):
from_ = self._get_attr('from') from_ = self._get_attr('from')

View file

@ -38,5 +38,5 @@ class Version(ElementBase):
name = 'query' name = 'query'
namespace = 'jabber:iq:version' namespace = 'jabber:iq:version'
plugin_attrib = 'software_version' plugin_attrib = 'software_version'
interfaces = set(('name', 'version', 'os')) interfaces = {'name', 'version', 'os'}
sub_interfaces = interfaces sub_interfaces = interfaces

View file

@ -16,4 +16,4 @@ class Capabilities(ElementBase):
namespace = 'http://jabber.org/protocol/caps' namespace = 'http://jabber.org/protocol/caps'
name = 'c' name = 'c'
plugin_attrib = 'caps' plugin_attrib = 'caps'
interfaces = set(('hash', 'node', 'ver', 'ext')) interfaces = {'hash', 'node', 'ver', 'ext'}

View file

@ -48,7 +48,7 @@ class EntityTime(ElementBase):
name = 'time' name = 'time'
namespace = 'urn:xmpp:time' namespace = 'urn:xmpp:time'
plugin_attrib = 'entity_time' plugin_attrib = 'entity_time'
interfaces = set(('tzo', 'utc', 'time')) interfaces = {'tzo', 'utc', 'time'}
sub_interfaces = interfaces sub_interfaces = interfaces
def set_time(self, value): def set_time(self, value):

View file

@ -18,7 +18,7 @@ class Delay(ElementBase):
name = 'delay' name = 'delay'
namespace = 'urn:xmpp:delay' namespace = 'urn:xmpp:delay'
plugin_attrib = 'delay' plugin_attrib = 'delay'
interfaces = set(('from', 'stamp', 'text')) interfaces = {'from', 'stamp', 'text'}
def get_from(self): def get_from(self):
from_ = self._get_attr('from') from_ = self._get_attr('from')

View file

@ -18,7 +18,7 @@ class BitsOfBinary(ElementBase):
name = 'data' name = 'data'
namespace = 'urn:xmpp:bob' namespace = 'urn:xmpp:bob'
plugin_attrib = 'bob' plugin_attrib = 'bob'
interfaces = set(('cid', 'max_age', 'type', 'data')) interfaces = {'cid', 'max_age', 'type', 'data'}
def get_max_age(self): def get_max_age(self):
return int(self._get_attr('max-age')) return int(self._get_attr('max-age'))

View file

@ -21,7 +21,7 @@ class AtomEntry(ElementBase):
namespace = 'http://www.w3.org/2005/Atom' namespace = 'http://www.w3.org/2005/Atom'
name = 'entry' name = 'entry'
plugin_attrib = 'entry' plugin_attrib = 'entry'
interfaces = set(('title', 'summary', 'id', 'published', 'updated')) interfaces = {'title', 'summary', 'id', 'published', 'updated'}
sub_interfaces = set(('title', 'summary', 'id', 'published', sub_interfaces = set(('title', 'summary', 'id', 'published',
'updated')) 'updated'))
@ -37,7 +37,7 @@ class AtomAuthor(ElementBase):
name = 'author' name = 'author'
plugin_attrib = 'author' plugin_attrib = 'author'
interfaces = set(('name', 'uri')) interfaces = {'name', 'uri'}
sub_interfaces = set(('name', 'uri')) sub_interfaces = {'name', 'uri'}
register_stanza_plugin(AtomEntry, AtomAuthor) register_stanza_plugin(AtomEntry, AtomAuthor)

View file

@ -66,7 +66,7 @@ class Error(ElementBase):
'service-unavailable', 'subscription-required', 'service-unavailable', 'subscription-required',
'undefined-condition', 'unexpected-request')) 'undefined-condition', 'unexpected-request'))
condition_ns = 'urn:ietf:params:xml:ns:xmpp-stanzas' 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): def setup(self, xml=None):
""" """

View file

@ -57,8 +57,8 @@ class Iq(RootStanza):
namespace = 'jabber:client' namespace = 'jabber:client'
name = 'iq' name = 'iq'
interfaces = set(('type', 'to', 'from', 'id', 'query')) interfaces = {'type', 'to', 'from', 'id', 'query'}
types = set(('get', 'result', 'set', 'error')) types = {'get', 'result', 'set', 'error'}
plugin_attrib = name plugin_attrib = name
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):

View file

@ -36,7 +36,7 @@ class Roster(ElementBase):
namespace = 'jabber:iq:roster' namespace = 'jabber:iq:roster'
name = 'query' name = 'query'
plugin_attrib = 'roster' plugin_attrib = 'roster'
interfaces = set(('items', 'ver')) interfaces = {'items', 'ver'}
def get_ver(self): def get_ver(self):
""" """

View file

@ -54,7 +54,7 @@ class StreamError(Error, StanzaBase):
""" """
namespace = 'http://etherx.jabber.org/streams' namespace = 'http://etherx.jabber.org/streams'
interfaces = set(('condition', 'text', 'see_other_host')) interfaces = {'condition', 'text', 'see_other_host'}
conditions = set(( conditions = set((
'bad-format', 'bad-namespace-prefix', 'conflict', 'bad-format', 'bad-namespace-prefix', 'conflict',
'connection-timeout', 'host-gone', 'host-unknown', 'connection-timeout', 'host-gone', 'host-unknown',

View file

@ -17,7 +17,7 @@ class StreamFeatures(StanzaBase):
name = 'features' name = 'features'
namespace = 'http://etherx.jabber.org/streams' namespace = 'http://etherx.jabber.org/streams'
interfaces = set(('features', 'required', 'optional')) interfaces = {'features', 'required', 'optional'}
sub_interfaces = interfaces sub_interfaces = interfaces
plugin_tag_map = {} plugin_tag_map = {}
plugin_attrib_map = {} plugin_attrib_map = {}

View file

@ -212,7 +212,7 @@ class ElementBase(object):
>>> class Message(ElementBase): >>> class Message(ElementBase):
... name = "message" ... name = "message"
... namespace = "jabber:client" ... namespace = "jabber:client"
... interfaces = set(('to', 'from', 'type', 'body')) ... interfaces = {'to', 'from', 'type', 'body'}
... sub_interfaces = {'body'} ... sub_interfaces = {'body'}
The resulting Message stanza's contents may be accessed as so:: The resulting Message stanza's contents may be accessed as so::
@ -239,7 +239,7 @@ class ElementBase(object):
>>> class MessagePlugin(ElementBase): >>> class MessagePlugin(ElementBase):
... name = "custom_plugin" ... name = "custom_plugin"
... namespace = "custom" ... namespace = "custom"
... interfaces = set(('useful_thing', 'custom')) ... interfaces = {'useful_thing', 'custom'}
... plugin_attrib = "custom" ... plugin_attrib = "custom"
The plugin stanza class must be associated with its intended 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 #: manipulating the underlying XML object. This set may be augmented
#: with the :attr:`plugin_attrib` value of any registered #: with the :attr:`plugin_attrib` value of any registered
#: stanza plugins. #: 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 #: A subset of :attr:`interfaces` which maps interfaces to direct
#: subelements of the underlying XML object. Using this set, the text #: 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: #: 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 #: the stanza type, the to and from JIDs, the stanza ID, and, especially
#: in the case of an Iq stanza, a payload. #: 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. #: 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, def __init__(self, stream=None, xml=None, stype=None,
sto=None, sfrom=None, sid=None, parent=None): sto=None, sfrom=None, sid=None, parent=None):

View file

@ -43,18 +43,18 @@ class TestElementBase(SlixTest):
class TestStanzaPlugin(ElementBase): class TestStanzaPlugin(ElementBase):
name = "foo2" name = "foo2"
namespace = "foo" namespace = "foo"
interfaces = set(('bar', 'baz')) interfaces = {'bar', 'baz'}
plugin_attrib = "foo2" plugin_attrib = "foo2"
class TestSubStanza(ElementBase): class TestSubStanza(ElementBase):
name = "subfoo" name = "subfoo"
namespace = "foo" namespace = "foo"
interfaces = set(('bar', 'baz')) interfaces = {'bar', 'baz'}
class TestStanza(ElementBase): class TestStanza(ElementBase):
name = "foo" name = "foo"
namespace = "foo" namespace = "foo"
interfaces = set(('bar', 'baz')) interfaces = {'bar', 'baz'}
register_stanza_plugin(TestStanza, TestStanzaPlugin, iterable=True) register_stanza_plugin(TestStanza, TestStanzaPlugin, iterable=True)
@ -90,24 +90,24 @@ class TestElementBase(SlixTest):
class TestStanzaPlugin(ElementBase): class TestStanzaPlugin(ElementBase):
name = "pluginfoo" name = "pluginfoo"
namespace = "foo" namespace = "foo"
interfaces = set(('bar', 'baz')) interfaces = {'bar', 'baz'}
plugin_attrib = "plugin_foo" plugin_attrib = "plugin_foo"
class TestStanzaPlugin2(ElementBase): class TestStanzaPlugin2(ElementBase):
name = "pluginfoo2" name = "pluginfoo2"
namespace = "foo" namespace = "foo"
interfaces = set(('bar', 'baz')) interfaces = {'bar', 'baz'}
plugin_attrib = "plugin_foo2" plugin_attrib = "plugin_foo2"
class TestSubStanza(ElementBase): class TestSubStanza(ElementBase):
name = "subfoo" name = "subfoo"
namespace = "foo" namespace = "foo"
interfaces = set(('bar', 'baz')) interfaces = {'bar', 'baz'}
class TestStanza(ElementBase): class TestStanza(ElementBase):
name = "foo" name = "foo"
namespace = "foo" namespace = "foo"
interfaces = set(('bar', 'baz')) interfaces = {'bar', 'baz'}
register_stanza_plugin(TestStanza, TestSubStanza, iterable=True) register_stanza_plugin(TestStanza, TestSubStanza, iterable=True)
register_stanza_plugin(TestStanza, TestStanzaPlugin) register_stanza_plugin(TestStanza, TestStanzaPlugin)
@ -139,7 +139,7 @@ class TestElementBase(SlixTest):
class TestStanza(ElementBase): class TestStanza(ElementBase):
name = "foo" name = "foo"
namespace = "foo" namespace = "foo"
interfaces = set(('bar', 'baz', 'qux')) interfaces = {'bar', 'baz', 'qux'}
sub_interfaces = {'baz'} sub_interfaces = {'baz'}
def get_qux(self): def get_qux(self):
@ -185,7 +185,7 @@ class TestElementBase(SlixTest):
class TestStanza(ElementBase): class TestStanza(ElementBase):
name = "foo" name = "foo"
namespace = "foo" namespace = "foo"
interfaces = set(('bar', 'baz', 'qux')) interfaces = {'bar', 'baz', 'qux'}
sub_interfaces = {'baz'} sub_interfaces = {'baz'}
def set_qux(self, value): def set_qux(self, value):
@ -219,7 +219,7 @@ class TestElementBase(SlixTest):
class TestStanza(ElementBase): class TestStanza(ElementBase):
name = "foo" name = "foo"
namespace = "foo" namespace = "foo"
interfaces = set(('bar', 'baz', 'qux')) interfaces = {'bar', 'baz', 'qux'}
sub_interfaces = {'bar'} sub_interfaces = {'bar'}
def del_qux(self): def del_qux(self):
@ -261,7 +261,7 @@ class TestElementBase(SlixTest):
class TestStanza(ElementBase): class TestStanza(ElementBase):
name = "foo" name = "foo"
namespace = "foo" namespace = "foo"
interfaces = set(('bar', 'baz')) interfaces = {'bar', 'baz'}
stanza = TestStanza() stanza = TestStanza()
@ -331,7 +331,7 @@ class TestElementBase(SlixTest):
class TestStanza(ElementBase): class TestStanza(ElementBase):
name = "foo" name = "foo"
namespace = "foo" namespace = "foo"
interfaces = set(('bar', 'baz')) interfaces = {'bar', 'baz'}
def set_baz(self, value): def set_baz(self, value):
self._set_sub_text("wrapper/baz", text=value) self._set_sub_text("wrapper/baz", text=value)
@ -382,7 +382,7 @@ class TestElementBase(SlixTest):
class TestStanza(ElementBase): class TestStanza(ElementBase):
name = "foo" name = "foo"
namespace = "foo" namespace = "foo"
interfaces = set(('bar', 'baz')) interfaces = {'bar', 'baz'}
def set_bar(self, value): def set_bar(self, value):
self._set_sub_text("path/to/only/bar", value) self._set_sub_text("path/to/only/bar", value)
@ -463,7 +463,7 @@ class TestElementBase(SlixTest):
class TestStanza(ElementBase): class TestStanza(ElementBase):
name = "foo" name = "foo"
namespace = "foo" namespace = "foo"
interfaces = set(('bar','baz', 'qux')) interfaces = {'bar','baz', 'qux'}
sub_interfaces = {'qux'} sub_interfaces = {'qux'}
def set_qux(self, value): def set_qux(self, value):
@ -528,7 +528,7 @@ class TestElementBase(SlixTest):
class TestStanza(ElementBase): class TestStanza(ElementBase):
name = "foo" name = "foo"
namespace = "foo" namespace = "foo"
interfaces = set(('bar', 'baz')) interfaces = {'bar', 'baz'}
stanza1 = TestStanza() stanza1 = TestStanza()
stanza1['bar'] = 'a' stanza1['bar'] = 'a'
@ -554,7 +554,7 @@ class TestElementBase(SlixTest):
class TestStanza(ElementBase): class TestStanza(ElementBase):
name = "foo" name = "foo"
namespace = "foo" namespace = "foo"
interfaces = set(('bar', 'baz')) interfaces = {'bar', 'baz'}
plugin_attrib = 'qux' plugin_attrib = 'qux'
register_stanza_plugin(TestStanza, TestStanza) register_stanza_plugin(TestStanza, TestStanza)
@ -575,7 +575,7 @@ class TestElementBase(SlixTest):
class TestStanza(ElementBase): class TestStanza(ElementBase):
name = "foo" name = "foo"
namespace = "foo" namespace = "foo"
interfaces = set(('bar', 'baz')) interfaces = {'bar', 'baz'}
stanza = TestStanza() stanza = TestStanza()
stanza['bar'] = 'a' stanza['bar'] = 'a'
@ -597,7 +597,7 @@ class TestElementBase(SlixTest):
class TestStanza(ElementBase): class TestStanza(ElementBase):
name = "foo" name = "foo"
namespace = "foo" namespace = "foo"
interfaces = set(('bar', 'baz')) interfaces = {'bar', 'baz'}
register_stanza_plugin(TestStanza, TestSubStanza, iterable=True) register_stanza_plugin(TestStanza, TestSubStanza, iterable=True)
@ -652,7 +652,7 @@ class TestElementBase(SlixTest):
class TestStanza(ElementBase): class TestStanza(ElementBase):
name = "foo" name = "foo"
namespace = "foo" namespace = "foo"
interfaces = set(('bar', 'baz')) interfaces = {'bar', 'baz'}
stanza1 = TestStanza() stanza1 = TestStanza()
stanza1['bar'] = 'a' stanza1['bar'] = 'a'
@ -672,7 +672,7 @@ class TestElementBase(SlixTest):
class TestStanza(ElementBase): class TestStanza(ElementBase):
name = "foo" name = "foo"
namespace = "foo" namespace = "foo"
interfaces = set(('bar', 'baz')) interfaces = {'bar', 'baz'}
class TestExtension(ElementBase): class TestExtension(ElementBase):
name = 'extended' name = 'extended'
@ -715,7 +715,7 @@ class TestElementBase(SlixTest):
class TestStanza(ElementBase): class TestStanza(ElementBase):
name = "foo" name = "foo"
namespace = "foo" namespace = "foo"
interfaces = set(('bar', 'baz')) interfaces = {'bar', 'baz'}
class TestOverride(ElementBase): class TestOverride(ElementBase):
name = 'overrider' name = 'overrider'

View file

@ -102,7 +102,7 @@ class TestStreamPresence(SlixTest):
to="tester@localhost" /> to="tester@localhost" />
""") """)
expected = set(('presence_available', 'got_online')) expected = {'presence_available', 'got_online'}
self.assertEqual(events, expected, self.assertEqual(events, expected,
"Incorrect events triggered: %s" % events) "Incorrect events triggered: %s" % events)
@ -151,7 +151,7 @@ class TestStreamPresence(SlixTest):
type="subscribe" /> type="subscribe" />
""") """)
expected = set(('presence_subscribe', 'changed_subscription')) expected = {'presence_subscribe', 'changed_subscription'}
self.assertEqual(events, expected, self.assertEqual(events, expected,
"Incorrect events triggered: %s" % events) "Incorrect events triggered: %s" % events)
@ -185,7 +185,7 @@ class TestStreamPresence(SlixTest):
type="unsubscribed" /> type="unsubscribed" />
""") """)
expected = set(('presence_subscribe', 'changed_subscription')) expected = {'presence_subscribe', 'changed_subscription'}
self.assertEqual(events, expected, self.assertEqual(events, expected,
"Incorrect events triggered: %s" % events) "Incorrect events triggered: %s" % events)