Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Silbe <sascha-pgp@silbe.org>2010-10-16 09:31:53 (GMT)
committer Sascha Silbe <sascha-pgp@silbe.org>2010-11-23 17:03:11 (GMT)
commit049e0c338c33a650e2c92c9c0d622c5412a3f35c (patch)
tree43f044e852695bfc5be9618b341137bd6133a22a
parent22bcee228d954b97976f4d84c83f58ff7465d22a (diff)
PEP8 cleanup: ensure lines are shorter than 80 characters
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). Reviewed-by: James Cameron <quozl@laptop.org> Acked-by: Simon Schampijer <simon@laptop.org>
-rw-r--r--src/sugar/dispatch/__init__.py3
-rw-r--r--src/sugar/dispatch/dispatcher.py15
-rw-r--r--src/sugar/dispatch/saferef.py11
3 files changed, 17 insertions, 12 deletions
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)