Manual cleanup of the remaining set([…]) and set((…)).

This commit is contained in:
Emmanuel Gil Peyrot 2016-10-22 13:35:54 +01:00
parent dcacc7d7d5
commit d008988843
35 changed files with 180 additions and 178 deletions

View File

@ -163,7 +163,7 @@ behaviour:
namespace = 'jabber:iq:register' namespace = 'jabber:iq:register'
name = 'query' name = 'query'
plugin_attrib = 'register' plugin_attrib = 'register'
interfaces = set(('username', 'password', 'registered', 'remove')) interfaces = {'username', 'password', 'registered', 'remove'}
sub_interfaces = interfaces sub_interfaces = interfaces
def getRegistered(self): def getRegistered(self):
@ -535,10 +535,10 @@ with some additional registration fields implemented.
namespace = 'jabber:iq:register' namespace = 'jabber:iq:register'
name = 'query' name = 'query'
plugin_attrib = 'register' plugin_attrib = 'register'
interfaces = set(('username', 'password', 'email', 'nick', 'name', interfaces = {'username', 'password', 'email', 'nick', 'name',
'first', 'last', 'address', 'city', 'state', 'zip', 'first', 'last', 'address', 'city', 'state', 'zip',
'phone', 'url', 'date', 'misc', 'text', 'key', 'phone', 'url', 'date', 'misc', 'text', 'key',
'registered', 'remove', 'instructions')) 'registered', 'remove', 'instructions'}
sub_interfaces = interfaces sub_interfaces = interfaces
def getRegistered(self): def getRegistered(self):

View File

@ -49,7 +49,7 @@ class FeatureMechanisms(BasePlugin):
if self.security_callback is None: if self.security_callback is None:
self.security_callback = self._default_security self.security_callback = self._default_security
creds = self.sasl_callback(set(['username']), set()) creds = self.sasl_callback({'username'}, set())
if not self.use_mech and not creds['username']: if not self.use_mech and not creds['username']:
self.use_mech = 'ANONYMOUS' self.use_mech = 'ANONYMOUS'

View File

@ -19,10 +19,11 @@ class Failure(StanzaBase):
interfaces = {'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 = {'aborted', 'account-disabled', 'credentials-expired',
'encryption-required', 'incorrect-encoding', 'invalid-authzid', 'encryption-required', 'incorrect-encoding',
'invalid-mechanism', 'malformed-request', 'mechansism-too-weak', 'invalid-authzid', 'invalid-mechanism', 'malformed-request',
'not-authorized', 'temporary-auth-failure')) 'mechansism-too-weak', 'not-authorized',
'temporary-auth-failure'}
def setup(self, xml=None): def setup(self, xml=None):
""" """

View File

@ -37,8 +37,8 @@ class MailBox(ElementBase):
namespace = 'google:mail:notify' namespace = 'google:mail:notify'
name = 'mailbox' name = 'mailbox'
plugin_attrib = 'mailbox' plugin_attrib = 'mailbox'
interfaces = set(('result-time', 'total-matched', 'total-estimate', interfaces = {'result-time', 'total-matched', 'total-estimate',
'url', 'threads', 'matched', 'estimate')) 'url', 'threads', 'matched', 'estimate'}
def get_threads(self): def get_threads(self):
threads = [] threads = []
@ -58,8 +58,8 @@ class MailThread(ElementBase):
namespace = 'google:mail:notify' namespace = 'google:mail:notify'
name = 'mail-thread-info' name = 'mail-thread-info'
plugin_attrib = 'thread' plugin_attrib = 'thread'
interfaces = set(('tid', 'participation', 'messages', 'date', interfaces = {'tid', 'participation', 'messages', 'date',
'senders', 'url', 'labels', 'subject', 'snippet')) 'senders', 'url', 'labels', 'subject', 'snippet'}
sub_interfaces = {'labels', 'subject', 'snippet'} sub_interfaces = {'labels', 'subject', 'snippet'}
def get_senders(self): def get_senders(self):

View File

@ -14,21 +14,21 @@ class FormField(ElementBase):
name = 'field' name = 'field'
plugin_attrib = 'field' plugin_attrib = 'field'
plugin_multi_attrib = 'fields' plugin_multi_attrib = 'fields'
interfaces = set(('answer', 'desc', 'required', 'value', interfaces = {'answer', 'desc', 'required', 'value',
'label', 'type', 'var')) 'label', 'type', 'var'}
sub_interfaces = {'desc'} sub_interfaces = {'desc'}
plugin_tag_map = {} plugin_tag_map = {}
plugin_attrib_map = {} plugin_attrib_map = {}
field_types = set(('boolean', 'fixed', 'hidden', 'jid-multi', field_types = {'boolean', 'fixed', 'hidden', 'jid-multi',
'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 = {True, '1', 'true'} true_values = {True, '1', 'true'}
option_types = {'list-multi', 'list-single'} option_types = {'list-multi', 'list-single'}
multi_line_types = {'hidden', 'text-multi'} multi_line_types = {'hidden', 'text-multi'}
multi_value_types = set(('hidden', 'jid-multi', multi_value_types = {'hidden', 'jid-multi',
'list-multi', 'text-multi')) 'list-multi', 'text-multi'}
def setup(self, xml=None): def setup(self, xml=None):
if ElementBase.setup(self, xml): if ElementBase.setup(self, xml):

View File

@ -55,8 +55,8 @@ class Item(ElementBase):
namespace = 'jabber:iq:privacy' namespace = 'jabber:iq:privacy'
plugin_attrib = name plugin_attrib = name
plugin_multi_attrib = 'items' plugin_multi_attrib = 'items'
interfaces = set(['type', 'value', 'action', 'order', 'iq', interfaces = {'type', 'value', 'action', 'order', 'iq',
'message', 'presence_in', 'presence_out']) 'message', 'presence_in', 'presence_out'}
bool_interfaces = {'message', 'iq', 'presence_in', 'presence_out'} bool_interfaces = {'message', 'iq', 'presence_in', 'presence_out'}
type_values = ('', 'jid', 'group', 'subscription') type_values = ('', 'jid', 'group', 'subscription')

View File

@ -322,8 +322,8 @@ class XEP_0050(BasePlugin):
interfaces = session.get('interfaces', set()) interfaces = session.get('interfaces', set())
payload_classes = session.get('payload_classes', set()) payload_classes = session.get('payload_classes', set())
interfaces.update(set([item.plugin_attrib for item in payload])) interfaces.update({item.plugin_attrib for item in payload})
payload_classes.update(set([item.__class__ for item in payload])) payload_classes.update({item.__class__ for item in payload})
session['interfaces'] = interfaces session['interfaces'] = interfaces
session['payload_classes'] = payload_classes session['payload_classes'] = payload_classes

View File

@ -72,8 +72,8 @@ class Command(ElementBase):
name = 'command' name = 'command'
namespace = 'http://jabber.org/protocol/commands' namespace = 'http://jabber.org/protocol/commands'
plugin_attrib = 'command' plugin_attrib = 'command'
interfaces = set(('action', 'sessionid', 'node', interfaces = {'action', 'sessionid', 'node',
'status', 'actions', 'notes')) 'status', 'actions', 'notes'}
actions = {'cancel', 'complete', 'execute', 'next', 'prev'} actions = {'cancel', 'complete', 'execute', 'next', 'prev'}
statuses = {'canceled', 'completed', 'executing'} statuses = {'canceled', 'completed', 'executing'}
next_actions = {'prev', 'next', 'complete'} next_actions = {'prev', 'next', 'complete'}

View File

@ -105,11 +105,11 @@ class Address(ElementBase):
namespace = 'vcard-temp' namespace = 'vcard-temp'
plugin_attrib = name plugin_attrib = name
plugin_multi_attrib = 'addresses' plugin_multi_attrib = 'addresses'
interfaces = set(['HOME', 'WORK', 'POSTAL', 'PARCEL', 'DOM', 'INTL', interfaces = {'HOME', 'WORK', 'POSTAL', 'PARCEL', 'DOM', 'INTL',
'PREF', 'POBOX', 'EXTADD', 'STREET', 'LOCALITY', 'PREF', 'POBOX', 'EXTADD', 'STREET', 'LOCALITY',
'REGION', 'PCODE', 'CTRY']) 'REGION', 'PCODE', 'CTRY'}
sub_interfaces = set(['POBOX', 'EXTADD', 'STREET', 'LOCALITY', sub_interfaces = {'POBOX', 'EXTADD', 'STREET', 'LOCALITY',
'REGION', 'PCODE', 'CTRY']) 'REGION', 'PCODE', 'CTRY'}
bool_interfaces = {'HOME', 'WORK', 'DOM', 'INTL', 'PREF'} bool_interfaces = {'HOME', 'WORK', 'DOM', 'INTL', 'PREF'}
@ -118,13 +118,13 @@ class Telephone(ElementBase):
namespace = 'vcard-temp' namespace = 'vcard-temp'
plugin_attrib = name plugin_attrib = name
plugin_multi_attrib = 'telephone_numbers' plugin_multi_attrib = 'telephone_numbers'
interfaces = set(['HOME', 'WORK', 'VOICE', 'FAX', 'PAGER', 'MSG', interfaces = {'HOME', 'WORK', 'VOICE', 'FAX', 'PAGER', 'MSG',
'CELL', 'VIDEO', 'BBS', 'MODEM', 'ISDN', 'PCS', 'CELL', 'VIDEO', 'BBS', 'MODEM', 'ISDN', 'PCS',
'PREF', 'NUMBER']) 'PREF', 'NUMBER'}
sub_interfaces = {'NUMBER'} sub_interfaces = {'NUMBER'}
bool_interfaces = set(['HOME', 'WORK', 'VOICE', 'FAX', 'PAGER', bool_interfaces = {'HOME', 'WORK', 'VOICE', 'FAX', 'PAGER',
'MSG', 'CELL', 'VIDEO', 'BBS', 'MODEM', 'MSG', 'CELL', 'VIDEO', 'BBS', 'MODEM',
'ISDN', 'PCS', 'PREF']) 'ISDN', 'PCS', 'PREF'}
def setup(self, xml=None): def setup(self, xml=None):
super().setup(xml=xml) super().setup(xml=xml)
@ -143,10 +143,10 @@ class Label(ElementBase):
namespace = 'vcard-temp' namespace = 'vcard-temp'
plugin_attrib = name plugin_attrib = name
plugin_multi_attrib = 'labels' plugin_multi_attrib = 'labels'
interfaces = set(['HOME', 'WORK', 'POSTAL', 'PARCEL', 'DOM', 'INT', interfaces = {'HOME', 'WORK', 'POSTAL', 'PARCEL', 'DOM', 'INT',
'PREF', 'lines']) 'PREF', 'lines'}
bool_interfaces = set(['HOME', 'WORK', 'POSTAL', 'PARCEL', 'DOM', bool_interfaces = {'HOME', 'WORK', 'POSTAL', 'PARCEL', 'DOM',
'INT', 'PREF']) 'INT', 'PREF'}
def add_line(self, value): def add_line(self, value):
line = ET.Element('{%s}LINE' % self.namespace) line = ET.Element('{%s}LINE' % self.namespace)

View File

@ -64,10 +64,10 @@ class Set(ElementBase):
namespace = 'http://jabber.org/protocol/rsm' namespace = 'http://jabber.org/protocol/rsm'
name = 'set' name = 'set'
plugin_attrib = 'rsm' plugin_attrib = 'rsm'
sub_interfaces = set(('first', 'after', 'before', 'count', sub_interfaces = {'first', 'after', 'before', 'count',
'index', 'last', 'max')) 'index', 'last', 'max'}
interfaces = set(('first_index', 'first', 'after', 'before', interfaces = {'first_index', 'first', 'after', 'before',
'count', 'index', 'last', 'max')) 'count', 'index', 'last', 'max'}
def set_first_index(self, val): def set_first_index(self, val):
fi = self.xml.find("{%s}first" % (self.namespace)) fi = self.xml.find("{%s}first" % (self.namespace))

View File

@ -16,7 +16,7 @@ class PubsubErrorCondition(ElementBase):
interfaces = {'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 = {'closed-node', 'configuration-required', 'invalid-jid',
'invalid-options', 'invalid-payload', 'invalid-subid', 'invalid-options', 'invalid-payload', 'invalid-subid',
'item-forbidden', 'item-required', 'jid-required', 'item-forbidden', 'item-required', 'jid-required',
'max-items-exceeded', 'max-nodes-exceeded', 'max-items-exceeded', 'max-nodes-exceeded',
@ -24,7 +24,7 @@ class PubsubErrorCondition(ElementBase):
'not-subscribed', 'payload-too-big', 'not-subscribed', 'payload-too-big',
'payload-required', 'pending-subscription', 'payload-required', 'pending-subscription',
'presence-subscription-required', 'subid-required', 'presence-subscription-required', 'subid-required',
'too-many-subscriptions', 'unsupported')) 'too-many-subscriptions', 'unsupported'}
condition_ns = 'http://jabber.org/protocol/pubsub#errors' condition_ns = 'http://jabber.org/protocol/pubsub#errors'
def setup(self, xml): def setup(self, xml):

View File

@ -16,14 +16,14 @@ class Register(ElementBase):
namespace = 'jabber:iq:register' namespace = 'jabber:iq:register'
name = 'query' name = 'query'
plugin_attrib = 'register' plugin_attrib = 'register'
interfaces = set(('username', 'password', 'email', 'nick', 'name', interfaces = {'username', 'password', 'email', 'nick', 'name',
'first', 'last', 'address', 'city', 'state', 'zip', 'first', 'last', 'address', 'city', 'state', 'zip',
'phone', 'url', 'date', 'misc', 'text', 'key', 'phone', 'url', 'date', 'misc', 'text', 'key',
'registered', 'remove', 'instructions', 'fields')) 'registered', 'remove', 'instructions', 'fields'}
sub_interfaces = interfaces sub_interfaces = interfaces
form_fields = set(('username', 'password', 'email', 'nick', 'name', form_fields = {'username', 'password', 'email', 'nick', 'name',
'first', 'last', 'address', 'city', 'state', 'zip', 'first', 'last', 'address', 'city', 'state', 'zip',
'phone', 'url', 'date', 'misc', 'text', 'key')) 'phone', 'url', 'date', 'misc', 'text', 'key'}
def get_registered(self): def get_registered(self):
present = self.xml.find('{%s}registered' % self.namespace) present = self.xml.find('{%s}registered' % self.namespace)

View File

@ -65,11 +65,11 @@ class Geoloc(ElementBase):
namespace = 'http://jabber.org/protocol/geoloc' namespace = 'http://jabber.org/protocol/geoloc'
name = 'geoloc' name = 'geoloc'
interfaces = set(('accuracy', 'alt', 'area', 'bearing', 'building', interfaces = {'accuracy', 'alt', 'area', 'bearing', 'building',
'country', 'countrycode', 'datum', 'dscription', 'country', 'countrycode', 'datum', 'dscription',
'error', 'floor', 'lat', 'locality', 'lon', 'error', 'floor', 'lat', 'locality', 'lon',
'postalcode', 'region', 'room', 'speed', 'street', 'postalcode', 'region', 'room', 'speed', 'street',
'text', 'timestamp', 'uri')) 'text', 'timestamp', 'uri'}
sub_interfaces = interfaces sub_interfaces = interfaces
plugin_attrib = name plugin_attrib = name

View File

@ -16,7 +16,7 @@ class UserMood(ElementBase):
plugin_attrib = 'mood' plugin_attrib = 'mood'
interfaces = {'value', 'text'} interfaces = {'value', 'text'}
sub_interfaces = {'text'} sub_interfaces = {'text'}
moods = set(['afraid', 'amazed', 'amorous', 'angry', 'annoyed', 'anxious', moods = {'afraid', 'amazed', 'amorous', 'angry', 'annoyed', 'anxious',
'aroused', 'ashamed', 'bored', 'brave', 'calm', 'cautious', 'aroused', 'ashamed', 'bored', 'brave', 'calm', 'cautious',
'cold', 'confident', 'confused', 'contemplative', 'contented', 'cold', 'confident', 'confused', 'contemplative', 'contented',
'cranky', 'crazy', 'creative', 'curious', 'dejected', 'cranky', 'crazy', 'creative', 'curious', 'dejected',
@ -32,7 +32,7 @@ class UserMood(ElementBase):
'sad', 'sarcastic', 'satisfied', 'serious', 'shocked', 'sad', 'sarcastic', 'satisfied', 'serious', 'shocked',
'shy', 'sick', 'sleepy', 'spontaneous', 'stressed', 'strong', 'shy', 'sick', 'sleepy', 'spontaneous', 'stressed', 'strong',
'surprised', 'thankful', 'thirsty', 'tired', 'undefined', 'surprised', 'thankful', 'thirsty', 'tired', 'undefined',
'weak', 'worried']) 'weak', 'worried'}
def set_value(self, value): def set_value(self, value):
self.del_value() self.del_value()

View File

@ -16,10 +16,10 @@ class UserActivity(ElementBase):
plugin_attrib = 'activity' plugin_attrib = 'activity'
interfaces = {'value', 'text'} interfaces = {'value', 'text'}
sub_interfaces = {'text'} sub_interfaces = {'text'}
general = set(['doing_chores', 'drinking', 'eating', 'exercising', general = {'doing_chores', 'drinking', 'eating', 'exercising',
'grooming', 'having_appointment', 'inactive', 'relaxing', 'grooming', 'having_appointment', 'inactive', 'relaxing',
'talking', 'traveling', 'undefined', 'working']) 'talking', 'traveling', 'undefined', 'working'}
specific = set(['at_the_spa', 'brushing_teeth', 'buying_groceries', specific = {'at_the_spa', 'brushing_teeth', 'buying_groceries',
'cleaning', 'coding', 'commuting', 'cooking', 'cycling', 'cleaning', 'coding', 'commuting', 'cooking', 'cycling',
'dancing', 'day_off', 'doing_maintenance', 'dancing', 'day_off', 'doing_maintenance',
'doing_the_dishes', 'doing_the_laundry', 'driving', 'doing_the_dishes', 'doing_the_laundry', 'driving',
@ -37,7 +37,7 @@ class UserActivity(ElementBase):
'socializing', 'studying', 'sunbathing', 'swimming', 'socializing', 'studying', 'sunbathing', 'swimming',
'taking_a_bath', 'taking_a_shower', 'thinking', 'taking_a_bath', 'taking_a_shower', 'thinking',
'walking', 'walking_the_dog', 'watching_a_movie', 'walking', 'walking_the_dog', 'watching_a_movie',
'watching_tv', 'working_out', 'writing']) 'watching_tv', 'working_out', 'writing'}
def set_value(self, value): def set_value(self, value):
self.del_value() self.del_value()

View File

@ -14,8 +14,8 @@ class UserTune(ElementBase):
name = 'tune' name = 'tune'
namespace = 'http://jabber.org/protocol/tune' namespace = 'http://jabber.org/protocol/tune'
plugin_attrib = 'tune' plugin_attrib = 'tune'
interfaces = set(['artist', 'length', 'rating', 'source', interfaces = {'artist', 'length', 'rating', 'source',
'title', 'track', 'uri']) 'title', 'track', 'uri'}
sub_interfaces = interfaces sub_interfaces = interfaces
def set_length(self, value): def set_length(self, value):

View File

@ -15,7 +15,7 @@ class XEP_0133(BasePlugin):
name = 'xep_0133' name = 'xep_0133'
description = 'XEP-0133: Service Administration' description = 'XEP-0133: Service Administration'
dependencies = {'xep_0030', 'xep_0004', 'xep_0050'} dependencies = {'xep_0030', 'xep_0004', 'xep_0050'}
commands = set(['add-user', 'delete-user', 'disable-user', commands = {'add-user', 'delete-user', 'disable-user',
'reenable-user', 'end-user-session', 'get-user-password', 'reenable-user', 'end-user-session', 'get-user-password',
'change-user-password', 'get-user-roster', 'change-user-password', 'get-user-roster',
'get-user-lastlogin', 'user-stats', 'edit-blacklist', 'get-user-lastlogin', 'user-stats', 'edit-blacklist',
@ -26,7 +26,7 @@ class XEP_0133(BasePlugin):
'get-online-users-list', 'get-online-users', 'get-online-users-list', 'get-online-users',
'get-active-users', 'get-idle-userslist', 'announce', 'get-active-users', 'get-idle-userslist', 'announce',
'set-motd', 'edit-motd', 'delete-motd', 'set-welcome', 'set-motd', 'edit-motd', 'delete-motd', 'set-welcome',
'delete-welcome', 'edit-admin', 'restart', 'shutdown']) 'delete-welcome', 'edit-admin', 'restart', 'shutdown'}
def get_commands(self, jid=None, **kwargs): def get_commands(self, jid=None, **kwargs):
if jid is None: if jid is None:

View File

@ -14,7 +14,7 @@ class UserGaming(ElementBase):
name = 'gaming' name = 'gaming'
namespace = 'urn:xmpp:gaming:0' namespace = 'urn:xmpp:gaming:0'
plugin_attrib = 'gaming' plugin_attrib = 'gaming'
interfaces = set(['character_name', 'character_profile', 'name', interfaces = {'character_name', 'character_profile', 'name',
'level', 'server_address', 'server_name', 'uri']) 'level', 'server_address', 'server_name', 'uri'}
sub_interfaces = interfaces sub_interfaces = interfaces

View File

@ -19,9 +19,9 @@ class OAuth(ElementBase):
name = 'oauth' name = 'oauth'
namespace = 'urn:xmpp:oauth:0' namespace = 'urn:xmpp:oauth:0'
plugin_attrib = 'oauth' plugin_attrib = 'oauth'
interfaces = set(['oauth_consumer_key', 'oauth_nonce', 'oauth_signature', interfaces = {'oauth_consumer_key', 'oauth_nonce', 'oauth_signature',
'oauth_signature_method', 'oauth_timestamp', 'oauth_signature_method', 'oauth_timestamp', 'oauth_token',
'oauth_token', 'oauth_version']) 'oauth_version'}
sub_interfaces = interfaces sub_interfaces = interfaces
def generate_signature(self, stanza, sfrom, sto, consumer_secret, def generate_signature(self, stanza, sfrom, sto, consumer_secret,

View File

@ -13,9 +13,9 @@ class XEP_0242(BasePlugin):
name = 'xep_0242' name = 'xep_0242'
description = 'XEP-0242: XMPP Client Compliance 2009' description = 'XEP-0242: XMPP Client Compliance 2009'
dependencies = set(['xep_0030', 'xep_0115', 'xep_0054', dependencies = {'xep_0030', 'xep_0115', 'xep_0054',
'xep_0045', 'xep_0085', 'xep_0016', 'xep_0045', 'xep_0085', 'xep_0016',
'xep_0191']) 'xep_0191'}
register_plugin(XEP_0242) register_plugin(XEP_0242)

View File

@ -13,8 +13,8 @@ class XEP_0270(BasePlugin):
name = 'xep_0270' name = 'xep_0270'
description = 'XEP-0270: XMPP Compliance Suites 2010' description = 'XEP-0270: XMPP Compliance Suites 2010'
dependencies = set(['xep_0030', 'xep_0115', 'xep_0054', dependencies = {'xep_0030', 'xep_0115', 'xep_0054',
'xep_0163', 'xep_0045', 'xep_0085']) 'xep_0163', 'xep_0045', 'xep_0085'}
register_plugin(XEP_0270) register_plugin(XEP_0270)

View File

@ -13,9 +13,9 @@ class XEP_0302(BasePlugin):
name = 'xep_0302' name = 'xep_0302'
description = 'XEP-0302: XMPP Compliance Suites 2012' description = 'XEP-0302: XMPP Compliance Suites 2012'
dependencies = set(['xep_0030', 'xep_0115', 'xep_0054', dependencies = {'xep_0030', 'xep_0115', 'xep_0054',
'xep_0163', 'xep_0045', 'xep_0085', 'xep_0163', 'xep_0045', 'xep_0085',
'xep_0184', 'xep_0198']) 'xep_0184', 'xep_0198'}
register_plugin(XEP_0302) register_plugin(XEP_0302)

View File

@ -17,21 +17,25 @@ class Sensordata(ElementBase):
namespace = 'urn:xmpp:iot:sensordata' namespace = 'urn:xmpp:iot:sensordata'
name = 'sensordata' name = 'sensordata'
plugin_attrib = name plugin_attrib = name
interfaces = set(tuple()) interfaces = set()
class FieldTypes(): class FieldTypes():
""" """
All field types are optional booleans that default to False All field types are optional booleans that default to False
""" """
field_types = set([ 'momentary','peak','status','computed','identity','historicalSecond','historicalMinute','historicalHour', \ field_types = {'momentary', 'peak', 'status', 'computed', 'identity',
'historicalDay','historicalWeek','historicalMonth','historicalQuarter','historicalYear','historicalOther']) 'historicalSecond', 'historicalMinute', 'historicalHour',
'historicalDay', 'historicalWeek', 'historicalMonth',
'historicalQuarter', 'historicalYear', 'historicalOther'}
class FieldStatus(): class FieldStatus():
""" """
All field statuses are optional booleans that default to False All field statuses are optional booleans that default to False
""" """
field_status = set([ 'missing','automaticEstimate','manualEstimate','manualReadout','automaticReadout','timeOffset','warning','error', \ field_status = {'missing', 'automaticEstimate', 'manualEstimate',
'signed','invoiced','endOfSeries','powerFailure','invoiceConfirmed']) 'manualReadout', 'automaticReadout', 'timeOffset',
'warning', 'error', 'signed', 'invoiced', 'endOfSeries',
'powerFailure', 'invoiceConfirmed'}
class Request(ElementBase): class Request(ElementBase):
namespace = 'urn:xmpp:iot:sensordata' namespace = 'urn:xmpp:iot:sensordata'

View File

@ -40,7 +40,7 @@ class XEP_0332(BasePlugin):
#: TODO: Do we really need to mention the supported_headers?! #: TODO: Do we really need to mention the supported_headers?!
default_config = { default_config = {
'supported_headers': set([ 'supported_headers': {
'Content-Length', 'Transfer-Encoding', 'DateTime', 'Content-Length', 'Transfer-Encoding', 'DateTime',
'Accept-Charset', 'Location', 'Content-ID', 'Description', 'Accept-Charset', 'Location', 'Content-ID', 'Description',
'Content-Language', 'Content-Transfer-Encoding', 'Timestamp', 'Content-Language', 'Content-Transfer-Encoding', 'Timestamp',
@ -48,7 +48,7 @@ class XEP_0332(BasePlugin):
'WWW-Authenticate', 'Accept-Encoding', 'Server', 'Error-Info', 'WWW-Authenticate', 'Accept-Encoding', 'Server', 'Error-Info',
'Identifier', 'Content-Location', 'Content-Encoding', 'Distribute', 'Identifier', 'Content-Location', 'Content-Encoding', 'Distribute',
'Accept', 'Proxy-Authenticate', 'ETag', 'Expect', 'Content-Type' 'Accept', 'Proxy-Authenticate', 'ETag', 'Expect', 'Content-Type'
]) }
} }
def plugin_init(self): def plugin_init(self):

View File

@ -22,8 +22,7 @@ class AtomEntry(ElementBase):
name = 'entry' name = 'entry'
plugin_attrib = 'entry' plugin_attrib = 'entry'
interfaces = {'title', 'summary', 'id', 'published', 'updated'} interfaces = {'title', 'summary', 'id', 'published', 'updated'}
sub_interfaces = set(('title', 'summary', 'id', 'published', sub_interfaces = {'title', 'summary', 'id', 'published', 'updated'}
'updated'))
class AtomAuthor(ElementBase): class AtomAuthor(ElementBase):

View File

@ -51,12 +51,12 @@ class Error(ElementBase):
namespace = 'jabber:client' namespace = 'jabber:client'
name = 'error' name = 'error'
plugin_attrib = 'error' plugin_attrib = 'error'
interfaces = set(('code', 'condition', 'text', 'type', interfaces = {'code', 'condition', 'text', 'type',
'gone', 'redirect', 'by')) 'gone', 'redirect', 'by'}
sub_interfaces = {'text'} sub_interfaces = {'text'}
plugin_attrib_map = {} plugin_attrib_map = {}
plugin_tag_map = {} plugin_tag_map = {}
conditions = set(('bad-request', 'conflict', 'feature-not-implemented', conditions = {'bad-request', 'conflict', 'feature-not-implemented',
'forbidden', 'gone', 'internal-server-error', 'forbidden', 'gone', 'internal-server-error',
'item-not-found', 'jid-malformed', 'not-acceptable', 'item-not-found', 'jid-malformed', 'not-acceptable',
'not-allowed', 'not-authorized', 'payment-required', 'not-allowed', 'not-authorized', 'payment-required',
@ -64,7 +64,7 @@ class Error(ElementBase):
'registration-required', 'remote-server-not-found', 'registration-required', 'remote-server-not-found',
'remote-server-timeout', 'resource-constraint', 'remote-server-timeout', 'resource-constraint',
'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 = {'cancel', 'continue', 'modify', 'auth', 'wait'} types = {'cancel', 'continue', 'modify', 'auth', 'wait'}

View File

@ -47,8 +47,8 @@ class Message(RootStanza):
name = 'message' name = 'message'
namespace = 'jabber:client' namespace = 'jabber:client'
plugin_attrib = name plugin_attrib = name
interfaces = set(['type', 'to', 'from', 'id', 'body', 'subject', interfaces = {'type', 'to', 'from', 'id', 'body', 'subject', 'thread',
'thread', 'parent_thread', 'mucroom', 'mucnick']) 'parent_thread', 'mucroom', 'mucnick'}
sub_interfaces = {'body', 'subject', 'thread'} sub_interfaces = {'body', 'subject', 'thread'}
lang_interfaces = sub_interfaces lang_interfaces = sub_interfaces
types = {'normal', 'chat', 'headline', 'error', 'groupchat'} types = {'normal', 'chat', 'headline', 'error', 'groupchat'}

View File

@ -56,13 +56,12 @@ class Presence(RootStanza):
name = 'presence' name = 'presence'
namespace = 'jabber:client' namespace = 'jabber:client'
plugin_attrib = name plugin_attrib = name
interfaces = set(['type', 'to', 'from', 'id', 'show', interfaces = {'type', 'to', 'from', 'id', 'show', 'status', 'priority'}
'status', 'priority'])
sub_interfaces = {'show', 'status', 'priority'} sub_interfaces = {'show', 'status', 'priority'}
lang_interfaces = {'status'} lang_interfaces = {'status'}
types = set(['available', 'unavailable', 'error', 'probe', 'subscribe', types = {'available', 'unavailable', 'error', 'probe', 'subscribe',
'subscribed', 'unsubscribe', 'unsubscribed']) 'subscribed', 'unsubscribe', 'unsubscribed'}
showtypes = {'dnd', 'chat', 'xa', 'away'} showtypes = {'dnd', 'chat', 'xa', 'away'}
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):

View File

@ -118,8 +118,7 @@ class RosterItem(ElementBase):
namespace = 'jabber:iq:roster' namespace = 'jabber:iq:roster'
name = 'item' name = 'item'
plugin_attrib = 'item' plugin_attrib = 'item'
interfaces = set(('jid', 'name', 'subscription', 'ask', interfaces = {'jid', 'name', 'subscription', 'ask', 'approved', 'groups'}
'approved', 'groups'))
def get_jid(self): def get_jid(self):
return JID(self._get_attr('jid', '')) return JID(self._get_attr('jid', ''))

View File

@ -55,7 +55,7 @@ class StreamError(Error, StanzaBase):
namespace = 'http://etherx.jabber.org/streams' namespace = 'http://etherx.jabber.org/streams'
interfaces = {'condition', 'text', 'see_other_host'} interfaces = {'condition', 'text', 'see_other_host'}
conditions = set(( conditions = {
'bad-format', 'bad-namespace-prefix', 'conflict', 'bad-format', 'bad-namespace-prefix', 'conflict',
'connection-timeout', 'host-gone', 'host-unknown', 'connection-timeout', 'host-gone', 'host-unknown',
'improper-addressing', 'internal-server-error', 'invalid-from', 'improper-addressing', 'internal-server-error', 'invalid-from',
@ -64,7 +64,7 @@ class StreamError(Error, StanzaBase):
'reset', 'resource-constraint', 'restricted-xml', 'see-other-host', 'reset', 'resource-constraint', 'restricted-xml', 'see-other-host',
'system-shutdown', 'undefined-condition', 'unsupported-encoding', 'system-shutdown', 'undefined-condition', 'unsupported-encoding',
'unsupported-feature', 'unsupported-stanza-type', 'unsupported-feature', 'unsupported-stanza-type',
'unsupported-version')) 'unsupported-version'}
condition_ns = 'urn:ietf:params:xml:ns:xmpp-streams' condition_ns = 'urn:ietf:params:xml:ns:xmpp-streams'
def get_see_other_host(self): def get_see_other_host(self):

View File

@ -561,12 +561,12 @@ class TestElementBase(SlixTest):
stanza = TestStanza() stanza = TestStanza()
self.failUnless(set(stanza.keys()) == set(('lang', 'bar', 'baz')), self.failUnless(set(stanza.keys()) == {'lang', 'bar', 'baz'},
"Returned set of interface keys does not match expected.") "Returned set of interface keys does not match expected.")
stanza.enable('qux') stanza.enable('qux')
self.failUnless(set(stanza.keys()) == set(('lang', 'bar', 'baz', 'qux')), self.failUnless(set(stanza.keys()) == {'lang', 'bar', 'baz', 'qux'},
"Incorrect set of interface and plugin keys.") "Incorrect set of interface and plugin keys.")
def testGet(self): def testGet(self):

View File

@ -254,10 +254,10 @@ class TestDisco(SlixTest):
iq['disco_info'].add_identity('client', 'pc', lang='en') iq['disco_info'].add_identity('client', 'pc', lang='en')
iq['disco_info'].add_identity('client', 'pc', lang='fr') iq['disco_info'].add_identity('client', 'pc', lang='fr')
expected = set([('client', 'pc', None, None), expected = {('client', 'pc', None, None),
('client', 'pc', 'no', None), ('client', 'pc', 'no', None),
('client', 'pc', 'en', None), ('client', 'pc', 'en', None),
('client', 'pc', 'fr', None)]) ('client', 'pc', 'fr', None)}
self.failUnless(iq['disco_info']['identities'] == expected, self.failUnless(iq['disco_info']['identities'] == expected,
"Identities do not match:\n%s\n%s" % ( "Identities do not match:\n%s\n%s" % (
expected, expected,
@ -472,9 +472,9 @@ class TestDisco(SlixTest):
node='bar', node='bar',
name='Tester') name='Tester')
expected = set([('user@localhost', None, None), expected = {('user@localhost', None, None),
('user@localhost', 'foo', None), ('user@localhost', 'foo', None),
('test@localhost', 'bar', 'Tester')]) ('test@localhost', 'bar', 'Tester')}
self.failUnless(iq['disco_items']['items'] == expected, self.failUnless(iq['disco_items']['items'] == expected,
"Items do not match:\n%s\n%s" % ( "Items do not match:\n%s\n%s" % (
expected, expected,

View File

@ -38,7 +38,7 @@ class TestStreamPresence(SlixTest):
to="tester@localhost"/> to="tester@localhost"/>
""") """)
self.assertEqual(events, set(('unavailable',)), self.assertEqual(events, {'unavailable'},
"Got offline incorrectly triggered: %s." % events) "Got offline incorrectly triggered: %s." % events)
def testGotOffline(self): def testGotOffline(self):

View File

@ -307,7 +307,7 @@ class TestStreamDisco(SlixTest):
</iq> </iq>
""") """)
self.assertEqual(events, set(('disco_info',)), self.assertEqual(events, {'disco_info'},
"Disco info event was not triggered: %s" % events) "Disco info event was not triggered: %s" % events)
def testDynamicItemsJID(self): def testDynamicItemsJID(self):
@ -502,9 +502,9 @@ class TestStreamDisco(SlixTest):
</iq> </iq>
""") """)
items = set([('user@localhost', 'bar', 'Test'), items = {('user@localhost', 'bar', 'Test'),
('user@localhost', 'baz', 'Test 2')]) ('user@localhost', 'baz', 'Test 2')}
self.assertEqual(events, set(('disco_items',)), self.assertEqual(events, {'disco_items'},
"Disco items event was not triggered: %s" % events) "Disco items event was not triggered: %s" % events)
self.assertEqual(results, items, self.assertEqual(results, items,
"Unexpected items: %s" % results) "Unexpected items: %s" % results)

View File

@ -77,7 +77,7 @@ class TestInBandByteStreams(SlixTest):
from="tester@localhost/receiver" /> from="tester@localhost/receiver" />
""") """)
self.assertEqual(events, set(['ibb_stream_start', 'callback'])) self.assertEqual(events, {'ibb_stream_start', 'callback'})
@asyncio.coroutine @asyncio.coroutine
def testSendData(self): def testSendData(self):