From f4683546d942f8e7ce3e31d40a8c51a1b73ebda5 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sat, 22 Oct 2016 13:35:54 +0100 Subject: =?UTF-8?q?Manual=20cleanup=20of=20the=20remaining=20set([?= =?UTF-8?q?=E2=80=A6])=20and=20set((=E2=80=A6)).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/create_plugin.rst | 10 ++--- slixmpp/features/feature_mechanisms/mechanisms.py | 2 +- .../features/feature_mechanisms/stanza/failure.py | 9 +++-- slixmpp/plugins/gmail_notify.py | 8 ++-- slixmpp/plugins/xep_0004/stanza/field.py | 14 +++---- slixmpp/plugins/xep_0016/stanza.py | 4 +- slixmpp/plugins/xep_0050/adhoc.py | 4 +- slixmpp/plugins/xep_0050/stanza.py | 4 +- slixmpp/plugins/xep_0054/stanza.py | 30 +++++++-------- slixmpp/plugins/xep_0059/stanza.py | 8 ++-- slixmpp/plugins/xep_0060/stanza/pubsub_errors.py | 18 ++++----- slixmpp/plugins/xep_0077/stanza.py | 14 +++---- slixmpp/plugins/xep_0080/stanza.py | 10 ++--- slixmpp/plugins/xep_0107/stanza.py | 34 ++++++++--------- slixmpp/plugins/xep_0108/stanza.py | 44 +++++++++++----------- slixmpp/plugins/xep_0118/stanza.py | 4 +- slixmpp/plugins/xep_0133.py | 24 ++++++------ slixmpp/plugins/xep_0196/stanza.py | 4 +- slixmpp/plugins/xep_0235/stanza.py | 6 +-- slixmpp/plugins/xep_0242.py | 6 +-- slixmpp/plugins/xep_0270.py | 4 +- slixmpp/plugins/xep_0302.py | 6 +-- slixmpp/plugins/xep_0323/stanza/sensordata.py | 14 ++++--- slixmpp/plugins/xep_0332/http.py | 4 +- slixmpp/stanza/atom.py | 3 +- slixmpp/stanza/error.py | 22 +++++------ slixmpp/stanza/message.py | 4 +- slixmpp/stanza/presence.py | 7 ++-- slixmpp/stanza/roster.py | 3 +- slixmpp/stanza/stream_error.py | 4 +- tests/test_stanza_element.py | 4 +- tests/test_stanza_xep_0030.py | 14 +++---- tests/test_stream_presence.py | 2 +- tests/test_stream_xep_0030.py | 8 ++-- tests/test_stream_xep_0047.py | 2 +- 35 files changed, 180 insertions(+), 178 deletions(-) diff --git a/docs/create_plugin.rst b/docs/create_plugin.rst index 9bfb053f..437374c7 100644 --- a/docs/create_plugin.rst +++ b/docs/create_plugin.rst @@ -163,7 +163,7 @@ behaviour: namespace = 'jabber:iq:register' name = 'query' plugin_attrib = 'register' - interfaces = set(('username', 'password', 'registered', 'remove')) + interfaces = {'username', 'password', 'registered', 'remove'} sub_interfaces = interfaces def getRegistered(self): @@ -535,10 +535,10 @@ with some additional registration fields implemented. namespace = 'jabber:iq:register' name = 'query' plugin_attrib = 'register' - interfaces = set(('username', 'password', 'email', 'nick', 'name', - 'first', 'last', 'address', 'city', 'state', 'zip', - 'phone', 'url', 'date', 'misc', 'text', 'key', - 'registered', 'remove', 'instructions')) + interfaces = {'username', 'password', 'email', 'nick', 'name', + 'first', 'last', 'address', 'city', 'state', 'zip', + 'phone', 'url', 'date', 'misc', 'text', 'key', + 'registered', 'remove', 'instructions'} sub_interfaces = interfaces def getRegistered(self): diff --git a/slixmpp/features/feature_mechanisms/mechanisms.py b/slixmpp/features/feature_mechanisms/mechanisms.py index 8e507afc..33bdaff5 100644 --- a/slixmpp/features/feature_mechanisms/mechanisms.py +++ b/slixmpp/features/feature_mechanisms/mechanisms.py @@ -49,7 +49,7 @@ class FeatureMechanisms(BasePlugin): if self.security_callback is None: 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']: self.use_mech = 'ANONYMOUS' diff --git a/slixmpp/features/feature_mechanisms/stanza/failure.py b/slixmpp/features/feature_mechanisms/stanza/failure.py index b4428fcc..adc686b7 100644 --- a/slixmpp/features/feature_mechanisms/stanza/failure.py +++ b/slixmpp/features/feature_mechanisms/stanza/failure.py @@ -19,10 +19,11 @@ class Failure(StanzaBase): interfaces = {'condition', 'text'} plugin_attrib = name sub_interfaces = {'text'} - conditions = set(('aborted', 'account-disabled', 'credentials-expired', - 'encryption-required', 'incorrect-encoding', 'invalid-authzid', - 'invalid-mechanism', 'malformed-request', 'mechansism-too-weak', - 'not-authorized', 'temporary-auth-failure')) + conditions = {'aborted', 'account-disabled', 'credentials-expired', + 'encryption-required', 'incorrect-encoding', + 'invalid-authzid', 'invalid-mechanism', 'malformed-request', + 'mechansism-too-weak', 'not-authorized', + 'temporary-auth-failure'} def setup(self, xml=None): """ diff --git a/slixmpp/plugins/gmail_notify.py b/slixmpp/plugins/gmail_notify.py index 2a85e17f..a56ca699 100644 --- a/slixmpp/plugins/gmail_notify.py +++ b/slixmpp/plugins/gmail_notify.py @@ -37,8 +37,8 @@ class MailBox(ElementBase): namespace = 'google:mail:notify' name = 'mailbox' plugin_attrib = 'mailbox' - interfaces = set(('result-time', 'total-matched', 'total-estimate', - 'url', 'threads', 'matched', 'estimate')) + interfaces = {'result-time', 'total-matched', 'total-estimate', + 'url', 'threads', 'matched', 'estimate'} def get_threads(self): threads = [] @@ -58,8 +58,8 @@ class MailThread(ElementBase): namespace = 'google:mail:notify' name = 'mail-thread-info' plugin_attrib = 'thread' - interfaces = set(('tid', 'participation', 'messages', 'date', - 'senders', 'url', 'labels', 'subject', 'snippet')) + interfaces = {'tid', 'participation', 'messages', 'date', + 'senders', 'url', 'labels', 'subject', 'snippet'} sub_interfaces = {'labels', 'subject', 'snippet'} def get_senders(self): diff --git a/slixmpp/plugins/xep_0004/stanza/field.py b/slixmpp/plugins/xep_0004/stanza/field.py index 2eebbe6f..c186157d 100644 --- a/slixmpp/plugins/xep_0004/stanza/field.py +++ b/slixmpp/plugins/xep_0004/stanza/field.py @@ -14,21 +14,21 @@ class FormField(ElementBase): name = 'field' plugin_attrib = 'field' plugin_multi_attrib = 'fields' - interfaces = set(('answer', 'desc', 'required', 'value', - 'label', 'type', 'var')) + interfaces = {'answer', 'desc', 'required', 'value', + 'label', 'type', 'var'} sub_interfaces = {'desc'} plugin_tag_map = {} plugin_attrib_map = {} - field_types = set(('boolean', 'fixed', 'hidden', 'jid-multi', - 'jid-single', 'list-multi', 'list-single', - 'text-multi', 'text-private', 'text-single')) + field_types = {'boolean', 'fixed', 'hidden', 'jid-multi', + 'jid-single', 'list-multi', 'list-single', + 'text-multi', 'text-private', 'text-single'} 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')) + multi_value_types = {'hidden', 'jid-multi', + 'list-multi', 'text-multi'} def setup(self, xml=None): if ElementBase.setup(self, xml): diff --git a/slixmpp/plugins/xep_0016/stanza.py b/slixmpp/plugins/xep_0016/stanza.py index 9a2cfa9f..2fb3d03a 100644 --- a/slixmpp/plugins/xep_0016/stanza.py +++ b/slixmpp/plugins/xep_0016/stanza.py @@ -55,8 +55,8 @@ class Item(ElementBase): namespace = 'jabber:iq:privacy' plugin_attrib = name plugin_multi_attrib = 'items' - interfaces = set(['type', 'value', 'action', 'order', 'iq', - 'message', 'presence_in', 'presence_out']) + interfaces = {'type', 'value', 'action', 'order', 'iq', + 'message', 'presence_in', 'presence_out'} bool_interfaces = {'message', 'iq', 'presence_in', 'presence_out'} type_values = ('', 'jid', 'group', 'subscription') diff --git a/slixmpp/plugins/xep_0050/adhoc.py b/slixmpp/plugins/xep_0050/adhoc.py index 795f3b81..4cff6b46 100644 --- a/slixmpp/plugins/xep_0050/adhoc.py +++ b/slixmpp/plugins/xep_0050/adhoc.py @@ -322,8 +322,8 @@ class XEP_0050(BasePlugin): interfaces = session.get('interfaces', set()) payload_classes = session.get('payload_classes', set()) - interfaces.update(set([item.plugin_attrib for item in payload])) - payload_classes.update(set([item.__class__ for item in payload])) + interfaces.update({item.plugin_attrib for item in payload}) + payload_classes.update({item.__class__ for item in payload}) session['interfaces'] = interfaces session['payload_classes'] = payload_classes diff --git a/slixmpp/plugins/xep_0050/stanza.py b/slixmpp/plugins/xep_0050/stanza.py index d512425d..ef3eac9f 100644 --- a/slixmpp/plugins/xep_0050/stanza.py +++ b/slixmpp/plugins/xep_0050/stanza.py @@ -72,8 +72,8 @@ class Command(ElementBase): name = 'command' namespace = 'http://jabber.org/protocol/commands' plugin_attrib = 'command' - interfaces = set(('action', 'sessionid', 'node', - 'status', 'actions', 'notes')) + interfaces = {'action', 'sessionid', 'node', + 'status', 'actions', 'notes'} actions = {'cancel', 'complete', 'execute', 'next', 'prev'} statuses = {'canceled', 'completed', 'executing'} next_actions = {'prev', 'next', 'complete'} diff --git a/slixmpp/plugins/xep_0054/stanza.py b/slixmpp/plugins/xep_0054/stanza.py index a0733ed1..9bdcb448 100644 --- a/slixmpp/plugins/xep_0054/stanza.py +++ b/slixmpp/plugins/xep_0054/stanza.py @@ -105,11 +105,11 @@ class Address(ElementBase): namespace = 'vcard-temp' plugin_attrib = name plugin_multi_attrib = 'addresses' - interfaces = set(['HOME', 'WORK', 'POSTAL', 'PARCEL', 'DOM', 'INTL', - 'PREF', 'POBOX', 'EXTADD', 'STREET', 'LOCALITY', - 'REGION', 'PCODE', 'CTRY']) - sub_interfaces = set(['POBOX', 'EXTADD', 'STREET', 'LOCALITY', - 'REGION', 'PCODE', 'CTRY']) + interfaces = {'HOME', 'WORK', 'POSTAL', 'PARCEL', 'DOM', 'INTL', + 'PREF', 'POBOX', 'EXTADD', 'STREET', 'LOCALITY', + 'REGION', 'PCODE', 'CTRY'} + sub_interfaces = {'POBOX', 'EXTADD', 'STREET', 'LOCALITY', + 'REGION', 'PCODE', 'CTRY'} bool_interfaces = {'HOME', 'WORK', 'DOM', 'INTL', 'PREF'} @@ -118,13 +118,13 @@ class Telephone(ElementBase): namespace = 'vcard-temp' plugin_attrib = name plugin_multi_attrib = 'telephone_numbers' - interfaces = set(['HOME', 'WORK', 'VOICE', 'FAX', 'PAGER', 'MSG', - 'CELL', 'VIDEO', 'BBS', 'MODEM', 'ISDN', 'PCS', - 'PREF', 'NUMBER']) + interfaces = {'HOME', 'WORK', 'VOICE', 'FAX', 'PAGER', 'MSG', + 'CELL', 'VIDEO', 'BBS', 'MODEM', 'ISDN', 'PCS', + 'PREF', 'NUMBER'} sub_interfaces = {'NUMBER'} - bool_interfaces = set(['HOME', 'WORK', 'VOICE', 'FAX', 'PAGER', - 'MSG', 'CELL', 'VIDEO', 'BBS', 'MODEM', - 'ISDN', 'PCS', 'PREF']) + bool_interfaces = {'HOME', 'WORK', 'VOICE', 'FAX', 'PAGER', + 'MSG', 'CELL', 'VIDEO', 'BBS', 'MODEM', + 'ISDN', 'PCS', 'PREF'} def setup(self, xml=None): super().setup(xml=xml) @@ -143,10 +143,10 @@ class Label(ElementBase): namespace = 'vcard-temp' plugin_attrib = name plugin_multi_attrib = 'labels' - interfaces = set(['HOME', 'WORK', 'POSTAL', 'PARCEL', 'DOM', 'INT', - 'PREF', 'lines']) - bool_interfaces = set(['HOME', 'WORK', 'POSTAL', 'PARCEL', 'DOM', - 'INT', 'PREF']) + interfaces = {'HOME', 'WORK', 'POSTAL', 'PARCEL', 'DOM', 'INT', + 'PREF', 'lines'} + bool_interfaces = {'HOME', 'WORK', 'POSTAL', 'PARCEL', 'DOM', + 'INT', 'PREF'} def add_line(self, value): line = ET.Element('{%s}LINE' % self.namespace) diff --git a/slixmpp/plugins/xep_0059/stanza.py b/slixmpp/plugins/xep_0059/stanza.py index 3843bc85..38ac08b8 100644 --- a/slixmpp/plugins/xep_0059/stanza.py +++ b/slixmpp/plugins/xep_0059/stanza.py @@ -64,10 +64,10 @@ class Set(ElementBase): namespace = 'http://jabber.org/protocol/rsm' name = 'set' plugin_attrib = 'rsm' - sub_interfaces = set(('first', 'after', 'before', 'count', - 'index', 'last', 'max')) - interfaces = set(('first_index', 'first', 'after', 'before', - 'count', 'index', 'last', 'max')) + sub_interfaces = {'first', 'after', 'before', 'count', + 'index', 'last', 'max'} + interfaces = {'first_index', 'first', 'after', 'before', + 'count', 'index', 'last', 'max'} def set_first_index(self, val): fi = self.xml.find("{%s}first" % (self.namespace)) diff --git a/slixmpp/plugins/xep_0060/stanza/pubsub_errors.py b/slixmpp/plugins/xep_0060/stanza/pubsub_errors.py index 7786c854..d0444081 100644 --- a/slixmpp/plugins/xep_0060/stanza/pubsub_errors.py +++ b/slixmpp/plugins/xep_0060/stanza/pubsub_errors.py @@ -16,15 +16,15 @@ class PubsubErrorCondition(ElementBase): interfaces = {'condition', 'unsupported'} plugin_attrib_map = {} plugin_tag_map = {} - conditions = set(('closed-node', 'configuration-required', 'invalid-jid', - 'invalid-options', 'invalid-payload', 'invalid-subid', - 'item-forbidden', 'item-required', 'jid-required', - 'max-items-exceeded', 'max-nodes-exceeded', - 'nodeid-required', 'not-in-roster-group', - 'not-subscribed', 'payload-too-big', - 'payload-required', 'pending-subscription', - 'presence-subscription-required', 'subid-required', - 'too-many-subscriptions', 'unsupported')) + conditions = {'closed-node', 'configuration-required', 'invalid-jid', + 'invalid-options', 'invalid-payload', 'invalid-subid', + 'item-forbidden', 'item-required', 'jid-required', + 'max-items-exceeded', 'max-nodes-exceeded', + 'nodeid-required', 'not-in-roster-group', + 'not-subscribed', 'payload-too-big', + 'payload-required', 'pending-subscription', + 'presence-subscription-required', 'subid-required', + 'too-many-subscriptions', 'unsupported'} condition_ns = 'http://jabber.org/protocol/pubsub#errors' def setup(self, xml): diff --git a/slixmpp/plugins/xep_0077/stanza.py b/slixmpp/plugins/xep_0077/stanza.py index 6ac543c2..d020a005 100644 --- a/slixmpp/plugins/xep_0077/stanza.py +++ b/slixmpp/plugins/xep_0077/stanza.py @@ -16,14 +16,14 @@ class Register(ElementBase): namespace = 'jabber:iq:register' name = 'query' plugin_attrib = 'register' - interfaces = set(('username', 'password', 'email', 'nick', 'name', - 'first', 'last', 'address', 'city', 'state', 'zip', - 'phone', 'url', 'date', 'misc', 'text', 'key', - 'registered', 'remove', 'instructions', 'fields')) + interfaces = {'username', 'password', 'email', 'nick', 'name', + 'first', 'last', 'address', 'city', 'state', 'zip', + 'phone', 'url', 'date', 'misc', 'text', 'key', + 'registered', 'remove', 'instructions', 'fields'} sub_interfaces = interfaces - form_fields = set(('username', 'password', 'email', 'nick', 'name', - 'first', 'last', 'address', 'city', 'state', 'zip', - 'phone', 'url', 'date', 'misc', 'text', 'key')) + form_fields = {'username', 'password', 'email', 'nick', 'name', + 'first', 'last', 'address', 'city', 'state', 'zip', + 'phone', 'url', 'date', 'misc', 'text', 'key'} def get_registered(self): present = self.xml.find('{%s}registered' % self.namespace) diff --git a/slixmpp/plugins/xep_0080/stanza.py b/slixmpp/plugins/xep_0080/stanza.py index e25fea4f..adad6321 100644 --- a/slixmpp/plugins/xep_0080/stanza.py +++ b/slixmpp/plugins/xep_0080/stanza.py @@ -65,11 +65,11 @@ class Geoloc(ElementBase): namespace = 'http://jabber.org/protocol/geoloc' name = 'geoloc' - interfaces = set(('accuracy', 'alt', 'area', 'bearing', 'building', - 'country', 'countrycode', 'datum', 'dscription', - 'error', 'floor', 'lat', 'locality', 'lon', - 'postalcode', 'region', 'room', 'speed', 'street', - 'text', 'timestamp', 'uri')) + interfaces = {'accuracy', 'alt', 'area', 'bearing', 'building', + 'country', 'countrycode', 'datum', 'dscription', + 'error', 'floor', 'lat', 'locality', 'lon', + 'postalcode', 'region', 'room', 'speed', 'street', + 'text', 'timestamp', 'uri'} sub_interfaces = interfaces plugin_attrib = name diff --git a/slixmpp/plugins/xep_0107/stanza.py b/slixmpp/plugins/xep_0107/stanza.py index ea5a799a..8384793a 100644 --- a/slixmpp/plugins/xep_0107/stanza.py +++ b/slixmpp/plugins/xep_0107/stanza.py @@ -16,23 +16,23 @@ class UserMood(ElementBase): plugin_attrib = 'mood' interfaces = {'value', 'text'} sub_interfaces = {'text'} - moods = set(['afraid', 'amazed', 'amorous', 'angry', 'annoyed', 'anxious', - 'aroused', 'ashamed', 'bored', 'brave', 'calm', 'cautious', - 'cold', 'confident', 'confused', 'contemplative', 'contented', - 'cranky', 'crazy', 'creative', 'curious', 'dejected', - 'depressed', 'disappointed', 'disgusted', 'dismayed', - 'distracted', 'embarrassed', 'envious', 'excited', - 'flirtatious', 'frustrated', 'grateful', 'grieving', 'grumpy', - 'guilty', 'happy', 'hopeful', 'hot', 'humbled', 'humiliated', - 'hungry', 'hurt', 'impressed', 'in_awe', 'in_love', - 'indignant', 'interested', 'intoxicated', 'invincible', - 'jealous', 'lonely', 'lost', 'lucky', 'mean', 'moody', - 'nervous', 'neutral', 'offended', 'outraged', 'playful', - 'proud', 'relaxed', 'relieved', 'remorseful', 'restless', - 'sad', 'sarcastic', 'satisfied', 'serious', 'shocked', - 'shy', 'sick', 'sleepy', 'spontaneous', 'stressed', 'strong', - 'surprised', 'thankful', 'thirsty', 'tired', 'undefined', - 'weak', 'worried']) + moods = {'afraid', 'amazed', 'amorous', 'angry', 'annoyed', 'anxious', + 'aroused', 'ashamed', 'bored', 'brave', 'calm', 'cautious', + 'cold', 'confident', 'confused', 'contemplative', 'contented', + 'cranky', 'crazy', 'creative', 'curious', 'dejected', + 'depressed', 'disappointed', 'disgusted', 'dismayed', + 'distracted', 'embarrassed', 'envious', 'excited', + 'flirtatious', 'frustrated', 'grateful', 'grieving', 'grumpy', + 'guilty', 'happy', 'hopeful', 'hot', 'humbled', 'humiliated', + 'hungry', 'hurt', 'impressed', 'in_awe', 'in_love', + 'indignant', 'interested', 'intoxicated', 'invincible', + 'jealous', 'lonely', 'lost', 'lucky', 'mean', 'moody', + 'nervous', 'neutral', 'offended', 'outraged', 'playful', + 'proud', 'relaxed', 'relieved', 'remorseful', 'restless', + 'sad', 'sarcastic', 'satisfied', 'serious', 'shocked', + 'shy', 'sick', 'sleepy', 'spontaneous', 'stressed', 'strong', + 'surprised', 'thankful', 'thirsty', 'tired', 'undefined', + 'weak', 'worried'} def set_value(self, value): self.del_value() diff --git a/slixmpp/plugins/xep_0108/stanza.py b/slixmpp/plugins/xep_0108/stanza.py index a614e2de..c9a3c362 100644 --- a/slixmpp/plugins/xep_0108/stanza.py +++ b/slixmpp/plugins/xep_0108/stanza.py @@ -16,28 +16,28 @@ class UserActivity(ElementBase): plugin_attrib = 'activity' interfaces = {'value', 'text'} sub_interfaces = {'text'} - general = set(['doing_chores', 'drinking', 'eating', 'exercising', - 'grooming', 'having_appointment', 'inactive', 'relaxing', - 'talking', 'traveling', 'undefined', 'working']) - specific = set(['at_the_spa', 'brushing_teeth', 'buying_groceries', - 'cleaning', 'coding', 'commuting', 'cooking', 'cycling', - 'dancing', 'day_off', 'doing_maintenance', - 'doing_the_dishes', 'doing_the_laundry', 'driving', - 'fishing', 'gaming', 'gardening', 'getting_a_haircut', - 'going_out', 'hanging_out', 'having_a_beer', - 'having_a_snack', 'having_breakfast', 'having_coffee', - 'having_dinner', 'having_lunch', 'having_tea', 'hiding', - 'hiking', 'in_a_car', 'in_a_meeting', 'in_real_life', - 'jogging', 'on_a_bus', 'on_a_plane', 'on_a_train', - 'on_a_trip', 'on_the_phone', 'on_vacation', - 'on_video_phone', 'other', 'partying', 'playing_sports', - 'praying', 'reading', 'rehearsing', 'running', - 'running_an_errand', 'scheduled_holiday', 'shaving', - 'shopping', 'skiing', 'sleeping', 'smoking', - 'socializing', 'studying', 'sunbathing', 'swimming', - 'taking_a_bath', 'taking_a_shower', 'thinking', - 'walking', 'walking_the_dog', 'watching_a_movie', - 'watching_tv', 'working_out', 'writing']) + general = {'doing_chores', 'drinking', 'eating', 'exercising', + 'grooming', 'having_appointment', 'inactive', 'relaxing', + 'talking', 'traveling', 'undefined', 'working'} + specific = {'at_the_spa', 'brushing_teeth', 'buying_groceries', + 'cleaning', 'coding', 'commuting', 'cooking', 'cycling', + 'dancing', 'day_off', 'doing_maintenance', + 'doing_the_dishes', 'doing_the_laundry', 'driving', + 'fishing', 'gaming', 'gardening', 'getting_a_haircut', + 'going_out', 'hanging_out', 'having_a_beer', + 'having_a_snack', 'having_breakfast', 'having_coffee', + 'having_dinner', 'having_lunch', 'having_tea', 'hiding', + 'hiking', 'in_a_car', 'in_a_meeting', 'in_real_life', + 'jogging', 'on_a_bus', 'on_a_plane', 'on_a_train', + 'on_a_trip', 'on_the_phone', 'on_vacation', + 'on_video_phone', 'other', 'partying', 'playing_sports', + 'praying', 'reading', 'rehearsing', 'running', + 'running_an_errand', 'scheduled_holiday', 'shaving', + 'shopping', 'skiing', 'sleeping', 'smoking', + 'socializing', 'studying', 'sunbathing', 'swimming', + 'taking_a_bath', 'taking_a_shower', 'thinking', + 'walking', 'walking_the_dog', 'watching_a_movie', + 'watching_tv', 'working_out', 'writing'} def set_value(self, value): self.del_value() diff --git a/slixmpp/plugins/xep_0118/stanza.py b/slixmpp/plugins/xep_0118/stanza.py index 4f5a1795..579fcbf0 100644 --- a/slixmpp/plugins/xep_0118/stanza.py +++ b/slixmpp/plugins/xep_0118/stanza.py @@ -14,8 +14,8 @@ class UserTune(ElementBase): name = 'tune' namespace = 'http://jabber.org/protocol/tune' plugin_attrib = 'tune' - interfaces = set(['artist', 'length', 'rating', 'source', - 'title', 'track', 'uri']) + interfaces = {'artist', 'length', 'rating', 'source', + 'title', 'track', 'uri'} sub_interfaces = interfaces def set_length(self, value): diff --git a/slixmpp/plugins/xep_0133.py b/slixmpp/plugins/xep_0133.py index e45d228f..aec1ee36 100644 --- a/slixmpp/plugins/xep_0133.py +++ b/slixmpp/plugins/xep_0133.py @@ -15,18 +15,18 @@ class XEP_0133(BasePlugin): name = 'xep_0133' description = 'XEP-0133: Service Administration' dependencies = {'xep_0030', 'xep_0004', 'xep_0050'} - commands = set(['add-user', 'delete-user', 'disable-user', - 'reenable-user', 'end-user-session', 'get-user-password', - 'change-user-password', 'get-user-roster', - 'get-user-lastlogin', 'user-stats', 'edit-blacklist', - 'edit-whitelist', 'get-registered-users-num', - 'get-disabled-users-num', 'get-online-users-num', - 'get-active-users-num', 'get-idle-users-num', - 'get-registered-users-list', 'get-disabled-users-list', - 'get-online-users-list', 'get-online-users', - 'get-active-users', 'get-idle-userslist', 'announce', - 'set-motd', 'edit-motd', 'delete-motd', 'set-welcome', - 'delete-welcome', 'edit-admin', 'restart', 'shutdown']) + commands = {'add-user', 'delete-user', 'disable-user', + 'reenable-user', 'end-user-session', 'get-user-password', + 'change-user-password', 'get-user-roster', + 'get-user-lastlogin', 'user-stats', 'edit-blacklist', + 'edit-whitelist', 'get-registered-users-num', + 'get-disabled-users-num', 'get-online-users-num', + 'get-active-users-num', 'get-idle-users-num', + 'get-registered-users-list', 'get-disabled-users-list', + 'get-online-users-list', 'get-online-users', + 'get-active-users', 'get-idle-userslist', 'announce', + 'set-motd', 'edit-motd', 'delete-motd', 'set-welcome', + 'delete-welcome', 'edit-admin', 'restart', 'shutdown'} def get_commands(self, jid=None, **kwargs): if jid is None: diff --git a/slixmpp/plugins/xep_0196/stanza.py b/slixmpp/plugins/xep_0196/stanza.py index 9c3cd0ed..79f5621e 100644 --- a/slixmpp/plugins/xep_0196/stanza.py +++ b/slixmpp/plugins/xep_0196/stanza.py @@ -14,7 +14,7 @@ class UserGaming(ElementBase): name = 'gaming' namespace = 'urn:xmpp:gaming:0' plugin_attrib = 'gaming' - interfaces = set(['character_name', 'character_profile', 'name', - 'level', 'server_address', 'server_name', 'uri']) + interfaces = {'character_name', 'character_profile', 'name', + 'level', 'server_address', 'server_name', 'uri'} sub_interfaces = interfaces diff --git a/slixmpp/plugins/xep_0235/stanza.py b/slixmpp/plugins/xep_0235/stanza.py index abb4a38d..5205b07c 100644 --- a/slixmpp/plugins/xep_0235/stanza.py +++ b/slixmpp/plugins/xep_0235/stanza.py @@ -19,9 +19,9 @@ class OAuth(ElementBase): name = 'oauth' namespace = 'urn:xmpp:oauth:0' plugin_attrib = 'oauth' - interfaces = set(['oauth_consumer_key', 'oauth_nonce', 'oauth_signature', - 'oauth_signature_method', 'oauth_timestamp', - 'oauth_token', 'oauth_version']) + interfaces = {'oauth_consumer_key', 'oauth_nonce', 'oauth_signature', + 'oauth_signature_method', 'oauth_timestamp', 'oauth_token', + 'oauth_version'} sub_interfaces = interfaces def generate_signature(self, stanza, sfrom, sto, consumer_secret, diff --git a/slixmpp/plugins/xep_0242.py b/slixmpp/plugins/xep_0242.py index ea077a70..27e4e7c8 100644 --- a/slixmpp/plugins/xep_0242.py +++ b/slixmpp/plugins/xep_0242.py @@ -13,9 +13,9 @@ class XEP_0242(BasePlugin): name = 'xep_0242' description = 'XEP-0242: XMPP Client Compliance 2009' - dependencies = set(['xep_0030', 'xep_0115', 'xep_0054', - 'xep_0045', 'xep_0085', 'xep_0016', - 'xep_0191']) + dependencies = {'xep_0030', 'xep_0115', 'xep_0054', + 'xep_0045', 'xep_0085', 'xep_0016', + 'xep_0191'} register_plugin(XEP_0242) diff --git a/slixmpp/plugins/xep_0270.py b/slixmpp/plugins/xep_0270.py index 4d02a0a1..e5316ae5 100644 --- a/slixmpp/plugins/xep_0270.py +++ b/slixmpp/plugins/xep_0270.py @@ -13,8 +13,8 @@ class XEP_0270(BasePlugin): name = 'xep_0270' description = 'XEP-0270: XMPP Compliance Suites 2010' - dependencies = set(['xep_0030', 'xep_0115', 'xep_0054', - 'xep_0163', 'xep_0045', 'xep_0085']) + dependencies = {'xep_0030', 'xep_0115', 'xep_0054', + 'xep_0163', 'xep_0045', 'xep_0085'} register_plugin(XEP_0270) diff --git a/slixmpp/plugins/xep_0302.py b/slixmpp/plugins/xep_0302.py index 6092b3e3..ff56e63e 100644 --- a/slixmpp/plugins/xep_0302.py +++ b/slixmpp/plugins/xep_0302.py @@ -13,9 +13,9 @@ class XEP_0302(BasePlugin): name = 'xep_0302' description = 'XEP-0302: XMPP Compliance Suites 2012' - dependencies = set(['xep_0030', 'xep_0115', 'xep_0054', - 'xep_0163', 'xep_0045', 'xep_0085', - 'xep_0184', 'xep_0198']) + dependencies = {'xep_0030', 'xep_0115', 'xep_0054', + 'xep_0163', 'xep_0045', 'xep_0085', + 'xep_0184', 'xep_0198'} register_plugin(XEP_0302) diff --git a/slixmpp/plugins/xep_0323/stanza/sensordata.py b/slixmpp/plugins/xep_0323/stanza/sensordata.py index 79094e4c..75bf5532 100644 --- a/slixmpp/plugins/xep_0323/stanza/sensordata.py +++ b/slixmpp/plugins/xep_0323/stanza/sensordata.py @@ -17,21 +17,25 @@ class Sensordata(ElementBase): namespace = 'urn:xmpp:iot:sensordata' name = 'sensordata' plugin_attrib = name - interfaces = set(tuple()) + interfaces = set() class FieldTypes(): """ All field types are optional booleans that default to False """ - field_types = set([ 'momentary','peak','status','computed','identity','historicalSecond','historicalMinute','historicalHour', \ - 'historicalDay','historicalWeek','historicalMonth','historicalQuarter','historicalYear','historicalOther']) + field_types = {'momentary', 'peak', 'status', 'computed', 'identity', + 'historicalSecond', 'historicalMinute', 'historicalHour', + 'historicalDay', 'historicalWeek', 'historicalMonth', + 'historicalQuarter', 'historicalYear', 'historicalOther'} class FieldStatus(): """ All field statuses are optional booleans that default to False """ - field_status = set([ 'missing','automaticEstimate','manualEstimate','manualReadout','automaticReadout','timeOffset','warning','error', \ - 'signed','invoiced','endOfSeries','powerFailure','invoiceConfirmed']) + field_status = {'missing', 'automaticEstimate', 'manualEstimate', + 'manualReadout', 'automaticReadout', 'timeOffset', + 'warning', 'error', 'signed', 'invoiced', 'endOfSeries', + 'powerFailure', 'invoiceConfirmed'} class Request(ElementBase): namespace = 'urn:xmpp:iot:sensordata' diff --git a/slixmpp/plugins/xep_0332/http.py b/slixmpp/plugins/xep_0332/http.py index cb443bc0..bebb0e69 100644 --- a/slixmpp/plugins/xep_0332/http.py +++ b/slixmpp/plugins/xep_0332/http.py @@ -40,7 +40,7 @@ class XEP_0332(BasePlugin): #: TODO: Do we really need to mention the supported_headers?! default_config = { - 'supported_headers': set([ + 'supported_headers': { 'Content-Length', 'Transfer-Encoding', 'DateTime', 'Accept-Charset', 'Location', 'Content-ID', 'Description', 'Content-Language', 'Content-Transfer-Encoding', 'Timestamp', @@ -48,7 +48,7 @@ class XEP_0332(BasePlugin): 'WWW-Authenticate', 'Accept-Encoding', 'Server', 'Error-Info', 'Identifier', 'Content-Location', 'Content-Encoding', 'Distribute', 'Accept', 'Proxy-Authenticate', 'ETag', 'Expect', 'Content-Type' - ]) + } } def plugin_init(self): diff --git a/slixmpp/stanza/atom.py b/slixmpp/stanza/atom.py index c7192dd8..8dde00de 100644 --- a/slixmpp/stanza/atom.py +++ b/slixmpp/stanza/atom.py @@ -22,8 +22,7 @@ class AtomEntry(ElementBase): name = 'entry' plugin_attrib = 'entry' interfaces = {'title', 'summary', 'id', 'published', 'updated'} - sub_interfaces = set(('title', 'summary', 'id', 'published', - 'updated')) + sub_interfaces = {'title', 'summary', 'id', 'published', 'updated'} class AtomAuthor(ElementBase): diff --git a/slixmpp/stanza/error.py b/slixmpp/stanza/error.py index 145aaa24..132ffc4d 100644 --- a/slixmpp/stanza/error.py +++ b/slixmpp/stanza/error.py @@ -51,20 +51,20 @@ class Error(ElementBase): namespace = 'jabber:client' name = 'error' plugin_attrib = 'error' - interfaces = set(('code', 'condition', 'text', 'type', - 'gone', 'redirect', 'by')) + interfaces = {'code', 'condition', 'text', 'type', + 'gone', 'redirect', 'by'} sub_interfaces = {'text'} plugin_attrib_map = {} plugin_tag_map = {} - conditions = set(('bad-request', 'conflict', 'feature-not-implemented', - 'forbidden', 'gone', 'internal-server-error', - 'item-not-found', 'jid-malformed', 'not-acceptable', - 'not-allowed', 'not-authorized', 'payment-required', - 'recipient-unavailable', 'redirect', - 'registration-required', 'remote-server-not-found', - 'remote-server-timeout', 'resource-constraint', - 'service-unavailable', 'subscription-required', - 'undefined-condition', 'unexpected-request')) + conditions = {'bad-request', 'conflict', 'feature-not-implemented', + 'forbidden', 'gone', 'internal-server-error', + 'item-not-found', 'jid-malformed', 'not-acceptable', + 'not-allowed', 'not-authorized', 'payment-required', + 'recipient-unavailable', 'redirect', + 'registration-required', 'remote-server-not-found', + 'remote-server-timeout', 'resource-constraint', + 'service-unavailable', 'subscription-required', + 'undefined-condition', 'unexpected-request'} condition_ns = 'urn:ietf:params:xml:ns:xmpp-stanzas' types = {'cancel', 'continue', 'modify', 'auth', 'wait'} diff --git a/slixmpp/stanza/message.py b/slixmpp/stanza/message.py index b9f93b29..2fff929e 100644 --- a/slixmpp/stanza/message.py +++ b/slixmpp/stanza/message.py @@ -47,8 +47,8 @@ class Message(RootStanza): name = 'message' namespace = 'jabber:client' plugin_attrib = name - interfaces = set(['type', 'to', 'from', 'id', 'body', 'subject', - 'thread', 'parent_thread', 'mucroom', 'mucnick']) + interfaces = {'type', 'to', 'from', 'id', 'body', 'subject', 'thread', + 'parent_thread', 'mucroom', 'mucnick']) sub_interfaces = {'body', 'subject', 'thread'} lang_interfaces = sub_interfaces types = {'normal', 'chat', 'headline', 'error', 'groupchat'} diff --git a/slixmpp/stanza/presence.py b/slixmpp/stanza/presence.py index 94382bce..614cd331 100644 --- a/slixmpp/stanza/presence.py +++ b/slixmpp/stanza/presence.py @@ -56,13 +56,12 @@ class Presence(RootStanza): name = 'presence' namespace = 'jabber:client' plugin_attrib = name - interfaces = set(['type', 'to', 'from', 'id', 'show', - 'status', 'priority']) + interfaces = {'type', 'to', 'from', 'id', 'show', 'status', 'priority'} sub_interfaces = {'show', 'status', 'priority'} lang_interfaces = {'status'} - types = set(['available', 'unavailable', 'error', 'probe', 'subscribe', - 'subscribed', 'unsubscribe', 'unsubscribed']) + types = {'available', 'unavailable', 'error', 'probe', 'subscribe', + 'subscribed', 'unsubscribe', 'unsubscribed'} showtypes = {'dnd', 'chat', 'xa', 'away'} def __init__(self, *args, **kwargs): diff --git a/slixmpp/stanza/roster.py b/slixmpp/stanza/roster.py index f846d595..11d38cc2 100644 --- a/slixmpp/stanza/roster.py +++ b/slixmpp/stanza/roster.py @@ -118,8 +118,7 @@ class RosterItem(ElementBase): namespace = 'jabber:iq:roster' name = 'item' plugin_attrib = 'item' - interfaces = set(('jid', 'name', 'subscription', 'ask', - 'approved', 'groups')) + interfaces = {'jid', 'name', 'subscription', 'ask', 'approved', 'groups'} def get_jid(self): return JID(self._get_attr('jid', '')) diff --git a/slixmpp/stanza/stream_error.py b/slixmpp/stanza/stream_error.py index 1b5cceb2..2aa70173 100644 --- a/slixmpp/stanza/stream_error.py +++ b/slixmpp/stanza/stream_error.py @@ -55,7 +55,7 @@ class StreamError(Error, StanzaBase): namespace = 'http://etherx.jabber.org/streams' interfaces = {'condition', 'text', 'see_other_host'} - conditions = set(( + conditions = { 'bad-format', 'bad-namespace-prefix', 'conflict', 'connection-timeout', 'host-gone', 'host-unknown', 'improper-addressing', 'internal-server-error', 'invalid-from', @@ -64,7 +64,7 @@ class StreamError(Error, StanzaBase): 'reset', 'resource-constraint', 'restricted-xml', 'see-other-host', 'system-shutdown', 'undefined-condition', 'unsupported-encoding', 'unsupported-feature', 'unsupported-stanza-type', - 'unsupported-version')) + 'unsupported-version'} condition_ns = 'urn:ietf:params:xml:ns:xmpp-streams' def get_see_other_host(self): diff --git a/tests/test_stanza_element.py b/tests/test_stanza_element.py index 678a49fd..89ea0310 100644 --- a/tests/test_stanza_element.py +++ b/tests/test_stanza_element.py @@ -561,12 +561,12 @@ class TestElementBase(SlixTest): 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.") 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.") def testGet(self): diff --git a/tests/test_stanza_xep_0030.py b/tests/test_stanza_xep_0030.py index 71dc7032..d85f1980 100644 --- a/tests/test_stanza_xep_0030.py +++ b/tests/test_stanza_xep_0030.py @@ -254,10 +254,10 @@ class TestDisco(SlixTest): iq['disco_info'].add_identity('client', 'pc', lang='en') iq['disco_info'].add_identity('client', 'pc', lang='fr') - expected = set([('client', 'pc', None, None), - ('client', 'pc', 'no', None), - ('client', 'pc', 'en', None), - ('client', 'pc', 'fr', None)]) + expected = {('client', 'pc', None, None), + ('client', 'pc', 'no', None), + ('client', 'pc', 'en', None), + ('client', 'pc', 'fr', None)} self.failUnless(iq['disco_info']['identities'] == expected, "Identities do not match:\n%s\n%s" % ( expected, @@ -472,9 +472,9 @@ class TestDisco(SlixTest): node='bar', name='Tester') - expected = set([('user@localhost', None, None), - ('user@localhost', 'foo', None), - ('test@localhost', 'bar', 'Tester')]) + expected = {('user@localhost', None, None), + ('user@localhost', 'foo', None), + ('test@localhost', 'bar', 'Tester')} self.failUnless(iq['disco_items']['items'] == expected, "Items do not match:\n%s\n%s" % ( expected, diff --git a/tests/test_stream_presence.py b/tests/test_stream_presence.py index 27559785..caf3fef9 100644 --- a/tests/test_stream_presence.py +++ b/tests/test_stream_presence.py @@ -38,7 +38,7 @@ class TestStreamPresence(SlixTest): to="tester@localhost"/> """) - self.assertEqual(events, set(('unavailable',)), + self.assertEqual(events, {'unavailable'}, "Got offline incorrectly triggered: %s." % events) def testGotOffline(self): diff --git a/tests/test_stream_xep_0030.py b/tests/test_stream_xep_0030.py index 1d6337d5..d1ad9087 100644 --- a/tests/test_stream_xep_0030.py +++ b/tests/test_stream_xep_0030.py @@ -307,7 +307,7 @@ class TestStreamDisco(SlixTest): """) - self.assertEqual(events, set(('disco_info',)), + self.assertEqual(events, {'disco_info'}, "Disco info event was not triggered: %s" % events) def testDynamicItemsJID(self): @@ -502,9 +502,9 @@ class TestStreamDisco(SlixTest): """) - items = set([('user@localhost', 'bar', 'Test'), - ('user@localhost', 'baz', 'Test 2')]) - self.assertEqual(events, set(('disco_items',)), + items = {('user@localhost', 'bar', 'Test'), + ('user@localhost', 'baz', 'Test 2')} + self.assertEqual(events, {'disco_items'}, "Disco items event was not triggered: %s" % events) self.assertEqual(results, items, "Unexpected items: %s" % results) diff --git a/tests/test_stream_xep_0047.py b/tests/test_stream_xep_0047.py index ecba2445..a0e6c227 100644 --- a/tests/test_stream_xep_0047.py +++ b/tests/test_stream_xep_0047.py @@ -77,7 +77,7 @@ class TestInBandByteStreams(SlixTest): from="tester@localhost/receiver" /> """) - self.assertEqual(events, set(['ibb_stream_start', 'callback'])) + self.assertEqual(events, {'ibb_stream_start', 'callback'}) @asyncio.coroutine def testSendData(self): -- cgit v1.2.3