[Sugar-devel] [PATCH sugar v2 14/21] pylint cleanup: pass format parameters to log functions instead of using %

Sascha Silbe sascha-pgp at silbe.org
Fri Nov 19 16:13:22 EST 2010


This avoids the overhead from the string formatting on production systems.

Reviewed-by: James Cameron <quozl at laptop.org>
CC: Aleksey Lim <alsroot at member.fsf.org>
Signed-off-by: Sascha Silbe <sascha-pgp at silbe.org>

diff --git a/src/jarabe/desktop/favoritesview.py b/src/jarabe/desktop/favoritesview.py
index 64baa15..fb865e2 100644
--- a/src/jarabe/desktop/favoritesview.py
+++ b/src/jarabe/desktop/favoritesview.py
@@ -277,7 +277,7 @@ class FavoritesView(hippo.Canvas):
 
     def _set_layout(self, layout):
         if layout not in LAYOUT_MAP:
-            logging.warn('Unknown favorites layout: %r' % layout)
+            logging.warn('Unknown favorites layout: %r', layout)
             layout = favoriteslayout.RingLayout.key
             assert layout in LAYOUT_MAP
 
diff --git a/src/jarabe/desktop/meshbox.py b/src/jarabe/desktop/meshbox.py
index a8180bd..98382d7 100644
--- a/src/jarabe/desktop/meshbox.py
+++ b/src/jarabe/desktop/meshbox.py
@@ -336,8 +336,8 @@ class NetworkManagerObserver(object):
                             settings = kwargs['connection'].get_settings()
                             net.create_keydialog(settings, kwargs['response'])
                 if not found:
-                    logging.error('Could not determine AP for'
-                                  ' specific object %s' % conn_o)
+                    logging.error('Could not determine AP for specific object'
+                                  ' %s', conn_o)
 
     def __get_devices_reply_cb(self, devices_o):
         for dev_o in devices_o:
@@ -602,7 +602,7 @@ class MeshBox(gtk.VBox):
 
         # it's not an error if the AP isn't found, since we might have ignored
         # it (e.g. olpc-mesh adhoc network)
-        logging.debug('Can not remove access point %s' % ap_o)
+        logging.debug('Can not remove access point %s', ap_o)
 
     def add_adhoc_networks(self, device):
         if self._adhoc_manager is None:
diff --git a/src/jarabe/view/keyhandler.py b/src/jarabe/view/keyhandler.py
index cdea52c..d79bfe6 100644
--- a/src/jarabe/view/keyhandler.py
+++ b/src/jarabe/view/keyhandler.py
@@ -223,7 +223,7 @@ class KeyHandler(object):
         return False
 
     def _key_released_cb(self, grabber, keycode, state, event_time):
-        logging.debug('_key_released_cb: %i %i' % (keycode, state))
+        logging.debug('_key_released_cb: %i %i', keycode, state)
         if self._tabbing_handler.is_tabbing():
             # We stop tabbing and switch to the new window as soon as the
             # modifier key is raised again.
-- 
1.7.2.3



More information about the Sugar-devel mailing list