[Sugar-devel] [PATCH sugar-base 10/17] style cleanup: prefer ' for strings

Sascha Silbe sascha-pgp at silbe.org
Sat Oct 16 07:30:23 EDT 2010


Tomeu prefers ' for strings, so let's use it wherever we don't have a good
reason to use ".

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

diff --git a/src/sugar/dispatch/saferef.py b/src/sugar/dispatch/saferef.py
index 709d292..1632b34 100644
--- a/src/sugar/dispatch/saferef.py
+++ b/src/sugar/dispatch/saferef.py
@@ -190,7 +190,7 @@ class BoundNonDescriptorMethodWeakref(BoundMethodWeakref):
     an attribute named differenty than the function's name such as in:
 
     class A: pass
-    def foo(self): return "foo"
+    def foo(self): return 'foo'
     A.bar = foo
 
     But this shouldn't be a common use case. So, on platforms where methods
diff --git a/src/sugar/logger.py b/src/sugar/logger.py
index 3837857..ebb766d 100644
--- a/src/sugar/logger.py
+++ b/src/sugar/logger.py
@@ -113,7 +113,7 @@ def start(log_filename=None):
         traceback.print_stack()
 
     logging.basicConfig(level=logging.WARNING,
-            format="%(created)f %(levelname)s %(name)s: %(message)s",
+            format='%(created)f %(levelname)s %(name)s: %(message)s',
                         stream=SafeLogWrapper(sys.stderr))
     root_logger.handlers[0].handleError = handleError
 
@@ -182,22 +182,22 @@ def trace(logger=None, logger_name=None, skip_args=None, skip_kwargs=None,
         if not enabled:
             return f(*args, **kwargs)
 
-        params_formatted = ", ".join(
+        params_formatted = ', '.join(
             [trace_repr.repr(a)
                 for (idx, a) in enumerate(args) if idx not in skip_args] + \
             ['%s=%s' % (k, trace_repr.repr(v))
                 for (k, v) in kwargs.items() if k not in skip_kwargs])
 
-        trace_logger.log(TRACE, "%s(%s) invoked", f.__name__,
+        trace_logger.log(TRACE, '%s(%s) invoked', f.__name__,
             params_formatted)
 
         try:
             res = f(*args, **kwargs)
         except:
-            trace_logger.exception("Exception occured in %s", f.__name__)
+            trace_logger.exception('Exception occured in %s', f.__name__)
             raise
 
-        trace_logger.log(TRACE, "%s(%s) returned %s", f.__name__,
+        trace_logger.log(TRACE, '%s(%s) returned %s', f.__name__,
             params_formatted, trace_repr.repr(res))
 
         return res
-- 
1.7.1



More information about the Sugar-devel mailing list