[Sugar-devel] [PATCH sugar-base 01/17] fix EOL spaces
Sascha Silbe
sascha-pgp at silbe.org
Sat Oct 16 07:30:14 EDT 2010
Signed-off-by: Sascha Silbe <sascha-pgp at silbe.org>
diff --git a/maint-helper.py b/maint-helper.py
index 50f7d07..fea9b3c 100755
--- a/maint-helper.py
+++ b/maint-helper.py
@@ -16,7 +16,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-# Latest source available at git://dev.laptop.org/sugar
+# Latest source available at git://dev.laptop.org/sugar
import os
import sys
diff --git a/src/sugar/dispatch/dispatcher.py b/src/sugar/dispatch/dispatcher.py
index 6855a5b..8fcbe51 100644
--- a/src/sugar/dispatch/dispatcher.py
+++ b/src/sugar/dispatch/dispatcher.py
@@ -15,11 +15,11 @@ def _make_id(target):
class Signal(object):
"""Base class for all signals
-
+
Internal attributes:
receivers -- { receriverkey (id) : weakref(receiver) }
"""
-
+
def __init__(self, providing_args=None):
"""providing_args -- A list of the arguments this signal can pass along in
a send() call.
@@ -31,7 +31,7 @@ class Signal(object):
def connect(self, receiver, sender=None, weak=True, dispatch_uid=None):
"""Connect receiver to sender for signal
-
+
receiver -- a function or an instance method which is to
receive signals. Receivers must be
hashable objects.
@@ -39,7 +39,7 @@ class Signal(object):
if weak is True, then receiver must be weak-referencable
(more precisely saferef.safeRef() must be able to create
a reference to the receiver).
-
+
Receivers must be able to accept keyword arguments.
If receivers have a dispatch_uid attribute, the receiver will
@@ -54,13 +54,13 @@ class Signal(object):
By default, the module will attempt to use weak
references to the receiver objects. If this parameter
is false, then strong references will be used.
-
+
dispatch_uid -- an identifier used to uniquely identify a particular
instance of a receiver. This will usually be a string, though it
may be anything hashable.
returns None
- """
+ """
if dispatch_uid:
lookup_key = (dispatch_uid, _make_id(sender))
else:
@@ -77,13 +77,13 @@ class Signal(object):
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
dispatch_uid is specified.
sender -- the registered sender to disconnect
weak -- the weakref state to disconnect
dispatch_uid -- the unique identifier of the receiver to disconnect
-
+
disconnect reverses the process of connect.
If weak references are used, disconnect need not be called.
@@ -106,7 +106,7 @@ class Signal(object):
sender -- the sender of the signal
Either a specific object or None.
-
+
named -- named arguments which will be passed to receivers.
Returns a list of tuple pairs [(receiver, response), ... ].
diff --git a/src/sugar/dispatch/saferef.py b/src/sugar/dispatch/saferef.py
index 8bcfd8a..7c9e1db 100644
--- a/src/sugar/dispatch/saferef.py
+++ b/src/sugar/dispatch/saferef.py
@@ -66,9 +66,9 @@ class BoundMethodWeakref(object):
same BoundMethodWeakref instance.
"""
-
+
_allInstances = weakref.WeakValueDictionary()
-
+
def __new__( cls, target, onDelete=None, *arguments,**named ):
"""Create new instance or return current instance
@@ -91,7 +91,7 @@ class BoundMethodWeakref(object):
cls._allInstances[key] = base
base.__init__( target, onDelete, *arguments,**named)
return base
-
+
def __init__(self, target, onDelete=None):
"""Return a weak-reference-like instance for a bound method
@@ -131,7 +131,7 @@ class BoundMethodWeakref(object):
self.weakFunc = weakref.ref(target.im_func, remove)
self.selfName = str(target.im_self)
self.funcName = str(target.im_func.__name__)
-
+
def calculateKey( cls, target ):
"""Calculate the reference key for this reference
@@ -140,7 +140,7 @@ class BoundMethodWeakref(object):
"""
return (id(target.im_self),id(target.im_func))
calculateKey = classmethod( calculateKey )
-
+
def __str__(self):
"""Give a friendly representation of the object"""
return """%s( %s.%s )"""%(
@@ -148,19 +148,19 @@ class BoundMethodWeakref(object):
self.selfName,
self.funcName,
)
-
+
__repr__ = __str__
-
+
def __nonzero__( self ):
"""Whether we are still a valid reference"""
return self() is not None
-
+
def __cmp__( self, other ):
"""Compare with another reference"""
if not isinstance (other,self.__class__):
return cmp( self.__class__, type(other) )
return cmp( self.key, other.key)
-
+
def __call__(self):
"""Return a strong reference to the bound method
--
1.7.1
More information about the Sugar-devel
mailing list