[Sugar-devel] [PATCH 03/21 sugar-toolkit] PEP8 cleanup: ensure lines are shorter than 80 characters

Sascha Silbe sascha-pgp at silbe.org
Fri Oct 15 17:01:07 EDT 2010


Caught by PEP8. This is important for Sugar because the XO has a small screen
where long lines would make the code hard to understand (because you need to
constantly scroll horizontally).

Signed-off-by: Sascha Silbe <sascha-pgp at silbe.org>

diff --git a/src/sugar/activity/activity.py b/src/sugar/activity/activity.py
index 6774703..183d4a8 100644
--- a/src/sugar/activity/activity.py
+++ b/src/sugar/activity/activity.py
@@ -569,7 +569,8 @@ class Activity(Window, gtk.Container):
         if self._closing:
             self._show_keep_failed_dialog()
             self._closing = False
-        raise RuntimeError('Error saving activity object to datastore: %s', err)
+        raise RuntimeError('Error saving activity object to datastore: %s',
+            err)

     def _cleanup_jobject(self):
         if self._jobject:
diff --git a/src/sugar/presence/activity.py b/src/sugar/presence/activity.py
index a1b7a50..47de8aa 100644
--- a/src/sugar/presence/activity.py
+++ b/src/sugar/presence/activity.py
@@ -135,7 +135,8 @@ class Activity(gobject.GObject):
                 dbus_interface=CONN_INTERFACE_ACTIVITY_PROPERTIES)

     def __activity_properties_changed_cb(self, room_handle, properties):
-        _logger.debug('%r: Activity properties changed to %r', self, properties)
+        _logger.debug('%r: Activity properties changed to %r', self,
+            properties)
         self._update_properties(properties)

     def __got_properties_cb(self, properties):
diff --git a/src/sugar/presence/buddy.py b/src/sugar/presence/buddy.py
index b83bc51..e4f54d4 100644
--- a/src/sugar/presence/buddy.py
+++ b/src/sugar/presence/buddy.py
@@ -182,7 +182,8 @@ class Buddy(BaseBuddy):
                 CONNECTION_INTERFACE_CONTACTS,
                 'GetContactAttributes',
                 'auasb',
-                ([self.contact_handle], [CONNECTION_INTERFACE_ALIASING], False),
+                ([self.contact_handle], [CONNECTION_INTERFACE_ALIASING],
+                    False),
                 reply_handler=self.__got_attributes_cb,
                 error_handler=self.__error_handler_cb)

diff --git a/src/sugar/presence/connectionmanager.py b/src/sugar/presence/connectionmanager.py
index 6604d3f..78b744e 100644
--- a/src/sugar/presence/connectionmanager.py
+++ b/src/sugar/presence/connectionmanager.py
@@ -77,7 +77,8 @@ class ConnectionManager(object):
                 Connection(account_path, connection)

         account = bus.get_object(ACCOUNT_MANAGER_SERVICE, account_path)
-        if account.Get(ACCOUNT, 'ConnectionStatus') == CONNECTION_STATUS_CONNECTED:
+        status = account.Get(ACCOUNT, 'ConnectionStatus')
+        if status == CONNECTION_STATUS_CONNECTED:
             self._connections_per_account[account_path].connected = True
         else:
             self._connections_per_account[account_path].connected = False
diff --git a/src/sugar/presence/presenceservice.py b/src/sugar/presence/presenceservice.py
index fa5edcf..feea190 100644
--- a/src/sugar/presence/presenceservice.py
+++ b/src/sugar/presence/presenceservice.py
@@ -72,8 +72,8 @@ class PresenceService(gobject.GObject):
         """
         if self._activity_cache is not None:
             if self._activity_cache.props.id != activity_id:
-                raise RuntimeError('Activities can only access their own shared'
-                                   'instance')
+                raise RuntimeError('Activities can only access their own'
+                    ' shared instance')
             return self._activity_cache
         else:
             connection_manager = get_connection_manager()
@@ -105,8 +105,8 @@ class PresenceService(gobject.GObject):
     def get_activity_by_handle(self, connection_path, room_handle):
         if self._activity_cache is not None:
             if self._activity_cache.room_handle != room_handle:
-                raise RuntimeError('Activities can only access their own shared'
-                                   'instance')
+                raise RuntimeError('Activities can only access their own'
+                                   ' shared instance')
             return self._activity_cache
         else:
             connection_manager = get_connection_manager()
@@ -227,8 +227,8 @@ class PresenceService(gobject.GObject):

         returns the bus name and the object path of the Telepathy connection
         """
-        connection_manager = get_connection_manager()
-        account_path, connection = connection_manager.get_preferred_connection()
+        manager = get_connection_manager()
+        account_path, connection = manager.get_preferred_connection()
         if connection is None:
             return None
         else:
diff --git a/tests/lib/test_mime.py b/tests/lib/test_mime.py
index fd7006b..860bbdb 100644
--- a/tests/lib/test_mime.py
+++ b/tests/lib/test_mime.py
@@ -37,15 +37,17 @@ class TestMime(unittest.TestCase):

         # Mozilla's text in c&v
         mime_type = mime.choose_most_significant(
-                ['text/_moz_htmlcontext', 'STRING', 'text/html', 'text/_moz_htmlinfo',
-                 'text/x-moz-url-priv', 'UTF8_STRING', 'COMPOUND_TEXT'])
+                ['text/_moz_htmlcontext', 'STRING', 'text/html',
+                 'text/_moz_htmlinfo', 'text/x-moz-url-priv', 'UTF8_STRING',
+                 'COMPOUND_TEXT'])
         self.assertEqual(mime_type, 'text/html')

         # Mozilla gif in dnd
         mime_type = mime.choose_most_significant(
                 ['application/x-moz-file-promise-url',
-                 'application/x-moz-file-promise-dest-filename', 'text/_moz_htmlinfo',
-                 'text/x-moz-url-desc', 'text/_moz_htmlcontext', 'text/x-moz-url-data',
+                 'application/x-moz-file-promise-dest-filename',
+                 'text/_moz_htmlinfo', 'text/x-moz-url-desc',
+                 'text/_moz_htmlcontext', 'text/x-moz-url-data',
                  'text/uri-list'])
         self.assertEqual(mime_type, 'text/uri-list')

--
1.7.1



More information about the Sugar-devel mailing list