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 08:52:05 (GMT)
committer Sascha Silbe <sascha-pgp@silbe.org>2010-11-23 17:02:55 (GMT)
commit7e258fb45424f6f6fa3115e96c02a5d9d59f1d2a (patch)
tree640ed89396850dfb57e0d57ed2295a3a0cbfb0cc
parented023454cb1f166bd718f7edbf7ced2feead51df (diff)
PEP8 cleanup: fix number of blank lines
Reviewed-by: James Cameron <quozl@laptop.org> Acked-by: Simon Schampijer <simon@laptop.org>
-rwxr-xr-xmaint-helper.py10
-rw-r--r--src/sugar/dispatch/dispatcher.py2
-rw-r--r--src/sugar/dispatch/saferef.py4
3 files changed, 15 insertions, 1 deletions
diff --git a/maint-helper.py b/maint-helper.py
index d7c5d5b..8496f06 100755
--- a/maint-helper.py
+++ b/maint-helper.py
@@ -23,12 +23,15 @@ import datetime
import subprocess
source_exts = [ '.py', '.c', '.h', '.cpp' ]
+COPYRIGHT = 'Copyright (C) '
+
def is_source(path):
for ext in source_exts:
if path.endswith(ext):
return True
+
def get_name_and_version():
f = open('configure.ac', 'r')
config = f.read()
@@ -42,12 +45,14 @@ def get_name_and_version():
return [ match.group(2), match.group(1) ]
+
def cmd_help():
print 'Usage: \n\
maint-helper.py build-snapshot - build a source snapshot \n\
maint-helper.py fix-copyright [path] - fix the copyright year \n\
maint-helper.py check-licenses - check licenses in the source'
+
def cmd_build_snapshot():
[ name, version ] = get_name_and_version()
@@ -123,6 +128,7 @@ def cmd_build_snapshot():
print 'Done.'
+
def check_licenses(path, license, missing):
matchers = { 'LGPL' : 'GNU Lesser General Public',
'GPL' : 'GNU General Public License' }
@@ -164,6 +170,7 @@ def check_licenses(path, license, missing):
missing[license] = []
missing[license].append(full_path)
+
def cmd_check_licenses():
missing = {}
check_licenses(os.getcwd(), 'LGPL', missing)
@@ -174,7 +181,6 @@ def cmd_check_licenses():
print path
print '\n'
-COPYRIGHT = 'Copyright (C) '
def fix_copyright(path):
for item in os.listdir(path):
@@ -212,9 +218,11 @@ def fix_copyright(path):
f.write(result)
f.close()
+
def cmd_fix_copyright(path):
fix_copyright(path)
+
if len(sys.argv) < 2:
cmd_help()
elif sys.argv[1] == 'build-snapshot':
diff --git a/src/sugar/dispatch/dispatcher.py b/src/sugar/dispatch/dispatcher.py
index 8fcbe51..c9e1dd1 100644
--- a/src/sugar/dispatch/dispatcher.py
+++ b/src/sugar/dispatch/dispatcher.py
@@ -8,11 +8,13 @@ from sugar.dispatch import saferef
WEAKREF_TYPES = (weakref.ReferenceType, saferef.BoundMethodWeakref)
+
def _make_id(target):
if hasattr(target, 'im_func'):
return (id(target.im_self), id(target.im_func))
return id(target)
+
class Signal(object):
"""Base class for all signals
diff --git a/src/sugar/dispatch/saferef.py b/src/sugar/dispatch/saferef.py
index 7c9e1db..b0ceef9 100644
--- a/src/sugar/dispatch/saferef.py
+++ b/src/sugar/dispatch/saferef.py
@@ -7,6 +7,7 @@ aren't handled by the core weakref module).
import weakref, traceback
+
def safeRef(target, onDelete = None):
"""Return a *safe* weak reference to a callable target
@@ -33,6 +34,7 @@ def safeRef(target, onDelete = None):
else:
return weakref.ref( target )
+
class BoundMethodWeakref(object):
"""'Safe' and reusable weak references to instance methods
@@ -179,6 +181,7 @@ class BoundMethodWeakref(object):
return function.__get__(target)
return None
+
class BoundNonDescriptorMethodWeakref(BoundMethodWeakref):
"""A specialized BoundMethodWeakref, for platforms where instance methods
are not descriptors.
@@ -239,6 +242,7 @@ class BoundNonDescriptorMethodWeakref(BoundMethodWeakref):
return getattr(target, function.__name__)
return None
+
def get_bound_method_weakref(target, onDelete):
"""Instantiates the appropiate BoundMethodWeakRef, depending on the details of
the underlying class method implementation"""