[Sugar-devel] [PATCH sugar-base 07/17] PEP8 cleanup: ensure lines are shorter than 80 characters

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


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/dispatch/__init__.py b/src/sugar/dispatch/__init__.py
index 776b1bc..eecf049 100644
--- a/src/sugar/dispatch/__init__.py
+++ b/src/sugar/dispatch/__init__.py
@@ -1,6 +1,7 @@
 """Multi-consumer multi-producer dispatching mechanism
 
-Originally based on pydispatch (BSD) http://pypi.python.org/pypi/PyDispatcher/2.0.1
+Originally based on pydispatch (BSD)
+http://pypi.python.org/pypi/PyDispatcher/2.0.1
 See license.txt for original license.
 
 Heavily modified for Django's purposes.
diff --git a/src/sugar/dispatch/dispatcher.py b/src/sugar/dispatch/dispatcher.py
index 2138703..eb2dd7e 100644
--- a/src/sugar/dispatch/dispatcher.py
+++ b/src/sugar/dispatch/dispatcher.py
@@ -18,8 +18,8 @@ class Signal(object):
     """
 
     def __init__(self, providing_args=None):
-        """providing_args -- A list of the arguments this signal can pass along in
-                       a send() call.
+        """providing_args -- A list of the arguments this signal can pass along
+        in a send() call.
         """
         self.receivers = []
         if providing_args is None:
@@ -64,7 +64,8 @@ class Signal(object):
             lookup_key = (_make_id(receiver), _make_id(sender))
 
         if weak:
-            receiver = saferef.safeRef(receiver, onDelete=self._remove_receiver)
+            receiver = saferef.safeRef(receiver,
+                onDelete=self._remove_receiver)
 
         for r_key, _ in self.receivers:
             if r_key == lookup_key:
@@ -72,7 +73,8 @@ class Signal(object):
         else:
             self.receivers.append((lookup_key, receiver))
 
-    def disconnect(self, receiver=None, sender=None, weak=True, dispatch_uid=None):
+    def disconnect(self, receiver=None, sender=None, weak=True,
+            dispatch_uid=None):
         """Disconnect receiver from sender for signal
 
         receiver -- the registered receiver to disconnect. May be none if
@@ -137,8 +139,9 @@ class Signal(object):
         Return a list of tuple pairs [(receiver, response), ... ],
         may raise DispatcherKeyError
 
-        if any receiver raises an error (specifically any subclass of Exception),
-        the error instance is returned as the result for that receiver.
+        if any receiver raises an error (specifically any subclass of
+        Exception), the error instance is returned as the result for that
+        receiver.
         """
 
         responses = []
diff --git a/src/sugar/dispatch/saferef.py b/src/sugar/dispatch/saferef.py
index 37443fb..6eb0d9e 100644
--- a/src/sugar/dispatch/saferef.py
+++ b/src/sugar/dispatch/saferef.py
@@ -185,8 +185,8 @@ class BoundNonDescriptorMethodWeakref(BoundMethodWeakref):
 
     It assumes that the function name and the target attribute name are the
     same, instead of assuming that the function is a descriptor. This approach
-    is equally fast, but not 100% reliable because functions can be stored on an
-    attribute named differenty than the function's name such as in:
+    is equally fast, but not 100% reliable because functions can be stored on
+    an attribute named differenty than the function's name such as in:
 
     class A: pass
     def foo(self): return "foo"
@@ -241,11 +241,12 @@ class BoundNonDescriptorMethodWeakref(BoundMethodWeakref):
 
 
 def get_bound_method_weakref(target, onDelete):
-    """Instantiates the appropiate BoundMethodWeakRef, depending on the details of
-    the underlying class method implementation"""
+    """Instantiates the appropiate BoundMethodWeakRef, depending on the details
+    of the underlying class method implementation"""
     if hasattr(target, '__get__'):
         # target method is a descriptor, so the default implementation works:
         return BoundMethodWeakref(target=target, onDelete=onDelete)
     else:
         # no luck, use the alternative implementation:
-        return BoundNonDescriptorMethodWeakref(target=target, onDelete=onDelete)
+        return BoundNonDescriptorMethodWeakref(target=target,
+            onDelete=onDelete)
-- 
1.7.1



More information about the Sugar-devel mailing list