diff options
author | jerico.dev <jerico.dev@gmail.com> | 2011-06-20 16:06:39 -0300 |
---|---|---|
committer | Riccardo (C10uD) <c10ud.dev@gmail.com> | 2011-09-01 12:04:24 +0200 |
commit | f33af27860a731a421dfc8efa26e0970ca76ae66 (patch) | |
tree | 5b621fd258fc415a8c3f60cda9def7328dcebc54 | |
parent | e002a45ad2e1ebb0f0746735beb98d512790a4e0 (diff) |
whitespace fixes (PEP8)
-rw-r--r-- | papyon/msnp/notification.py | 8 | ||||
-rw-r--r-- | papyon/profile.py | 14 | ||||
-rw-r--r-- | papyon/service/AddressBook/ab.py | 2 | ||||
-rw-r--r-- | papyon/service/AddressBook/common.py | 1 | ||||
-rw-r--r-- | papyon/service/AddressBook/constants.py | 32 | ||||
-rw-r--r-- | papyon/service/description/AB/ABContactAdd.py | 10 | ||||
-rw-r--r-- | papyon/service/description/Sharing/FindMembership.py | 2 | ||||
-rw-r--r-- | papyon/util/element_tree.py | 6 | ||||
-rw-r--r-- | papyon/util/iso8601/iso8601.py | 2 |
9 files changed, 39 insertions, 38 deletions
diff --git a/papyon/msnp/notification.py b/papyon/msnp/notification.py index 813e2a7..0fbfeac 100644 --- a/papyon/msnp/notification.py +++ b/papyon/msnp/notification.py @@ -155,7 +155,7 @@ class NotificationProtocol(BaseProtocol, Timer): @type personal_message: string""" cm = '' if current_media is not None: - cm ='\\0Music\\01\\0{0} - {1}\\0%s\\0%s\\0\\0' % \ + cm = '\\0Music\\01\\0{0} - {1}\\0%s\\0%s\\0\\0' % \ (xml_utils.escape(current_media[0]), xml_utils.escape(current_media[1])) @@ -335,7 +335,7 @@ class NotificationProtocol(BaseProtocol, Timer): host = command.arguments[1] port = self._transport.server[1] logger.debug("<-> Redirecting to " + command.arguments[1]) - self._transport.reset_connection((host,port)) + self._transport.reset_connection((host, port)) else: # connect to a switchboard try: host, port = command.arguments[1].split(":", 1) @@ -687,7 +687,7 @@ class NotificationProtocol(BaseProtocol, Timer): # --------- Invitation --------------------------------------------------- def _handle_RNG(self, command): session_id = command.arguments[0] - host, port = command.arguments[1].split(':',1) + host, port = command.arguments[1].split(':', 1) port = int(port) key = command.arguments[3] account = command.arguments[4] @@ -840,7 +840,7 @@ class NotificationProtocol(BaseProtocol, Timer): if contact.network_id != profile.NetworkID.MOBILE: account, domain = contact.account.split('@', 1) - payload = '<ml l="2"><d n="%s"><c n="%s"/></d></ml>'% \ + payload = '<ml l="2"><d n="%s"><c n="%s"/></d></ml>' % \ (domain, account) self._send_command("FQY", payload=payload) diff --git a/papyon/profile.py b/papyon/profile.py index 6cecfae..c8a1593 100644 --- a/papyon/profile.py +++ b/papyon/profile.py @@ -117,13 +117,13 @@ class ClientCapabilities(gobject.GObject): @undocumented: __getattr__, __setattr__, __str__ """ - __gsignals__ = { + __gsignals__ = { "capability-changed": (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (object, object)), } - MSNC = [0x0, # MSNC0 + MSNC = [0x0, # MSNC0 0x10000000, # MSNC1 0x20000000, # MSNC2 0x30000000, # MSNC3 @@ -294,11 +294,11 @@ class Membership(object): FORWARD = 1 """Contact belongs to our contact list""" - ALLOW = 2 + ALLOW = 2 """Contact is explicitely allowed to see our presence regardless of the currently set L{Privacy<papyon.profile.Privacy>}""" - BLOCK = 4 + BLOCK = 4 """Contact is explicitely forbidden from seeing our presence regardless of the currently set L{Privacy<papyon.profile.Privacy>}""" @@ -348,7 +348,7 @@ class ContactFlag(object): class BaseContact(gobject.GObject): - __gsignals__ = { + __gsignals__ = { "end-point-added": (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (object,)), @@ -745,7 +745,7 @@ gobject.type_register(Profile) class Contact(BaseContact): """Contact related information""" - __gsignals__ = { + __gsignals__ = { "infos-changed": (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (object,)), @@ -845,7 +845,7 @@ class Contact(BaseContact): return result[1] else: return "" - + @property def profile_url(self): """Contact profile url diff --git a/papyon/service/AddressBook/ab.py b/papyon/service/AddressBook/ab.py index ea4f7c9..de1e7e3 100644 --- a/papyon/service/AddressBook/ab.py +++ b/papyon/service/AddressBook/ab.py @@ -227,7 +227,7 @@ class AB(SOAPService): contacts.append(Contact(contact)) #FIXME: add support for the ab param - address_book = ABResult(None, contacts, groups) + address_book = ABResult(None, contacts, groups) run(callback, address_book) def _HandleABFindAllFault(self, callback, errback, response, user_data): diff --git a/papyon/service/AddressBook/common.py b/papyon/service/AddressBook/common.py index 79a0993..d7b7171 100644 --- a/papyon/service/AddressBook/common.py +++ b/papyon/service/AddressBook/common.py @@ -20,6 +20,7 @@ __all__ = ['annotations_to_dict'] + def annotations_to_dict(annotations): if annotations is None: return {} diff --git a/papyon/service/AddressBook/constants.py b/papyon/service/AddressBook/constants.py index 43e6b8b..dfc6619 100644 --- a/papyon/service/AddressBook/constants.py +++ b/papyon/service/AddressBook/constants.py @@ -25,27 +25,27 @@ __all__ = ['AddressBookError', 'AddressBookState'] class AddressBookError(ClientError): "Address book related errors" - UNKNOWN = 0 + UNKNOWN = 0 - AB_DOES_NOT_EXIST = 1 - AB_ALREADY_EXISTS = 2 + AB_DOES_NOT_EXIST = 1 + AB_ALREADY_EXISTS = 2 - CONTACT_ALREADY_EXISTS = 3 - CONTACT_ALREADY_IN_GROUP = 3 # deprecated - CONTACT_DOES_NOT_EXIST = 4 - CONTACT_NOT_IN_GROUP = 4 # deprecated - INVALID_CONTACT_ADDRESS = 5 + CONTACT_ALREADY_EXISTS = 3 + CONTACT_ALREADY_IN_GROUP = 3 # deprecated + CONTACT_DOES_NOT_EXIST = 4 + CONTACT_NOT_IN_GROUP = 4 # deprecated + INVALID_CONTACT_ADDRESS = 5 - GROUP_ALREADY_EXISTS = 6 - GROUP_DOES_NOT_EXIST = 7 + GROUP_ALREADY_EXISTS = 6 + GROUP_DOES_NOT_EXIST = 7 - MEMBER_ALREADY_EXISTS = 8 - MEMBER_DOES_NOT_EXIST = 9 + MEMBER_ALREADY_EXISTS = 8 + MEMBER_DOES_NOT_EXIST = 9 - INVALID_ARGUMENT = 10 - GROUP_NAME_TOO_LONG = 10 # deprecated - LIMIT_REACHED = 11 - FULL_SYNC_REQUIRED = 12 + INVALID_ARGUMENT = 10 + GROUP_NAME_TOO_LONG = 10 # deprecated + LIMIT_REACHED = 11 + FULL_SYNC_REQUIRED = 12 def __init__(self, code, fault="", details=""): diff --git a/papyon/service/description/AB/ABContactAdd.py b/papyon/service/description/AB/ABContactAdd.py index 66cac7b..218472c 100644 --- a/papyon/service/description/AB/ABContactAdd.py +++ b/papyon/service/description/AB/ABContactAdd.py @@ -34,8 +34,8 @@ def soap_action(): return "http://www.msn.com/webservices/AddressBook/ABContactAdd" -def soap_body(passport_name, is_messenger_user, contact_type, first_name, - last_name, birth_date, email, phone, location, web_site, +def soap_body(passport_name, is_messenger_user, contact_type, first_name, + last_name, birth_date, email, phone, location, web_site, annotation, comment, anniversary, display_name, invite_message, capability, enable_allow_list_management=True): """Returns the SOAP xml body @@ -66,7 +66,7 @@ def soap_body(passport_name, is_messenger_user, contact_type, first_name, if contact_type is not None: contact_info += "<contactType>%s</contactType>" % contact_type - + if first_name is not None: contact_info += "<firstName>%s</firstName>" % xml.escape(first_name) @@ -75,7 +75,7 @@ def soap_body(passport_name, is_messenger_user, contact_type, first_name, if birth_date is not None: contact_info += "<birthdate>%s</birthdate>" % birth_date - + if email is not None: emails = "" for type, email in email.iteritems(): @@ -112,7 +112,7 @@ def soap_body(passport_name, is_messenger_user, contact_type, first_name, items = changes = "" for item, value in parts.iteritems(): items += "<%s>%s</%s>" % (item, value, item) - changes += " %s%s" % (item[0].upper(), item[1:len(item)]) + changes += " %s%s" % (item[0].upper(), item[1:len(item)]) locations += """<ContactLocation> <contactLocationType>%s</contactLocationType> %s diff --git a/papyon/service/description/Sharing/FindMembership.py b/papyon/service/description/Sharing/FindMembership.py index b5ecfc3..12aa7a1 100644 --- a/papyon/service/description/Sharing/FindMembership.py +++ b/papyon/service/description/Sharing/FindMembership.py @@ -62,7 +62,7 @@ def soap_body(services_types, deltas_only, last_change): def process_response(soap_response): # FIXME: don't pick the 1st service only, we need to extract them all - result = {'Allow':{},'Block':{},'Reverse':{},'Pending':{}} + result = {'Allow':{}, 'Block':{}, 'Reverse':{}, 'Pending':{}} service = soap_response.body.find("./ab:FindMembershipResponse/" "ab:FindMembershipResult/ab:Services/" "ab:Service") diff --git a/papyon/util/element_tree.py b/papyon/util/element_tree.py index 59d1b4a..38c7d98 100644 --- a/papyon/util/element_tree.py +++ b/papyon/util/element_tree.py @@ -21,7 +21,7 @@ """ElementTree independent from the available distribution""" try: - from xml.etree.cElementTree import * + from xml.etree.cElementTree import * except ImportError: try: from cElementTree import * @@ -129,7 +129,7 @@ class _Element(object): def findall(self, path): path = self._process_path(path) - + result = [] nodes = self.element.findall(path) for node in nodes: @@ -141,7 +141,7 @@ class _Element(object): if result is None: return "" result = result.text - + if type is None: return result return getattr(XMLTYPE, type).decode(result) diff --git a/papyon/util/iso8601/iso8601.py b/papyon/util/iso8601/iso8601.py index dec97d4..eb5ab29 100644 --- a/papyon/util/iso8601/iso8601.py +++ b/papyon/util/iso8601/iso8601.py @@ -55,7 +55,7 @@ class FixedOffset(tzinfo): def dst(self, dt): return ZERO - + def __repr__(self): return "<FixedOffset %r>" % self.__name |