Skip to content

Commit

Permalink
Merge branch 'pylint' of git://github.com/maruel/buildbot
Browse files Browse the repository at this point in the history
* 'pylint' of git://github.com/maruel/buildbot:
  Style cleanups
  • Loading branch information
Dustin J. Mitchell committed May 31, 2010
2 parents c439877 + 2c746a6 commit 139e54e
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 25 deletions.
1 change: 0 additions & 1 deletion buildbot/buildslave.py
Expand Up @@ -318,7 +318,6 @@ def _disconnected(rref):
# however, these hacks are pretty internal, so don't blow up if
# they fail or are unavailable
log.msg("failed to accelerate the shutdown process")
pass
log.msg("waiting for slave to finish disconnecting")

return d
Expand Down
11 changes: 6 additions & 5 deletions buildbot/changes/changes.py
Expand Up @@ -96,7 +96,7 @@ def asText(self):
def asDict(self):
'''returns a dictonary with suitable info for html/mail rendering'''
result = {}

files = []
for file in self.files:
link = filter(lambda s: s.find(file) != -1, self.links)
Expand All @@ -105,9 +105,9 @@ def asDict(self):
else:
url = None
files.append(dict(url=url, name=file))
files = sorted(files, cmp=lambda a,b: a['name'] < b['name'])

files = sorted(files, cmp=lambda a, b: a['name'] < b['name'])

# Constant
result['number'] = self.number
result['branch'] = self.branch
Expand Down Expand Up @@ -213,7 +213,8 @@ def recode_changes(self, old_encoding, quiet=False):
except UnicodeDecodeError:
raise UnicodeError("Error decoding %s of change #%s as %s:\n%r" %
(attr, c.number, old_encoding, a))
if not quiet: print "converted %d strings" % nconvert
if not quiet:
print "converted %d strings" % nconvert

class OldChangeMaster(ChangeMaster):
# this is a reminder that the ChangeMaster class is old
Expand Down
8 changes: 4 additions & 4 deletions buildbot/locks.py
Expand Up @@ -23,10 +23,10 @@ class BaseLock:
description = "<BaseLock>"

def __init__(self, name, maxCount=1):
self.name = name # Name of the lock
self.waiting = [] # Current queue, tuples (LockAccess, deferred)
self.owners = [] # Current owners, tuples (owner, LockAccess)
self.maxCount=maxCount # maximal number of counting owners
self.name = name # Name of the lock
self.waiting = [] # Current queue, tuples (LockAccess, deferred)
self.owners = [] # Current owners, tuples (owner, LockAccess)
self.maxCount = maxCount # maximal number of counting owners

def __repr__(self):
return self.description
Expand Down
9 changes: 3 additions & 6 deletions buildbot/sourcestamp.py
Expand Up @@ -45,11 +45,8 @@ def __init__(self, branch=None, revision=None, patch=None,
if isinstance(revision, int):
revision = str(revision)
if patch is not None:
patch_level = patch[0]
patch_level = int(patch_level)
patch_diff = patch[1]
if len(patch) > 2:
patch_subdir = patch[2]
assert len(patch) > 2
assert int(patch[0]) != -1
self.branch = branch
self.revision = revision
self.patch = patch
Expand Down Expand Up @@ -139,7 +136,7 @@ def asDict(self):
# Constant
result['revision'] = self.revision
# TODO(maruel): Make the patch content a suburl.
result['hasPatch']= self.patch is not None
result['hasPatch'] = self.patch is not None
result['branch'] = self.branch
result['changes'] = [c.asDict() for c in getattr(self, 'changes', [])]
result['project'] = self.project
Expand Down
13 changes: 8 additions & 5 deletions buildbot/util/__init__.py
Expand Up @@ -13,7 +13,7 @@ def naturalSort(l):
def try_int(s):
try:
return int(s)
except:
except ValueError:
return s
def key_func(item):
return [try_int(s) for s in re.split('(\d+)', item)]
Expand Down Expand Up @@ -46,12 +46,13 @@ class ComparableMixin:

compare_attrs = []

class _None: pass
class _None:
pass

def __hash__(self):
alist = [self.__class__] + \
[getattr(self, name, self._None) for name in self.compare_attrs]
return hash(tuple(map(str,alist)))
return hash(tuple(map(str, alist)))

def __cmp__(self, them):
result = cmp(type(self), type(them))
Expand All @@ -63,8 +64,10 @@ def __cmp__(self, them):
return result

assert self.compare_attrs == them.compare_attrs
self_list= [getattr(self, name, self._None) for name in self.compare_attrs]
them_list= [getattr(them, name, self._None) for name in self.compare_attrs]
self_list = [getattr(self, name, self._None)
for name in self.compare_attrs]
them_list = [getattr(them, name, self._None)
for name in self.compare_attrs]
return cmp(self_list, them_list)

# Remove potentially harmful characters from builder name if it is to be
Expand Down
10 changes: 7 additions & 3 deletions buildbot/util/loop.py
Expand Up @@ -99,6 +99,7 @@ def __init__(self):
self._when_quiet_waiters = set()
self._start_timer = None
self._reactor = reactor # seam for tests to use t.i.t.Clock
self._remaining = []

def stopService(self):
if self._start_timer and self._start_timer.active():
Expand Down Expand Up @@ -127,18 +128,21 @@ def _mark_runnable(self, run_everything):
if run_everything:
self._everything_needs_to_run = True
# timers are now redundant, so cancel any existing ones
self._timers.clear() ; self._set_wakeup_timer()
self._timers.clear()
self._set_wakeup_timer()
if self._loop_running:
return
self._loop_running = True
self._start_timer = self._reactor.callLater(0, self._loop_start)

# subclasses must implement get_processors()
def get_processors(self):
raise Exception('subclasses must implement get_processors()')

def _loop_start(self):
if self._everything_needs_to_run:
self._everything_needs_to_run = False
self._timers.clear() ; self._set_wakeup_timer()
self._timers.clear()
self._set_wakeup_timer()
self._remaining = list(self.get_processors())
else:
self._remaining = []
Expand Down
3 changes: 2 additions & 1 deletion pylintrc
Expand Up @@ -52,6 +52,7 @@ load-plugins=
# R0902: Too many instance attributes (N/7)
# R0903: Too few public methods (N/2)
# R0904: Too many public methods (N/20)
# R0911: Too many return statements (N/6)
# R0912: Too many branches (N/12)
# R0913: Too many arguments (N/5)
# R0914: Too many local variables (N/15)
Expand All @@ -78,7 +79,7 @@ load-plugins=
# built-in.
# W0704: Except doesn't do anything Used when an except clause does nothing but
# "pass" and there is no "else" clause.
disable=C0103,C0111,C0301,C0302,I0011,R0201,R0801,R0902,R0903,R0904,R0912,R0913,R0914,R0915,W0102,W0141,W0142,W0212,W0232,W0511,W0602,W0603,W0613,W0622,W0704
disable=C0103,C0111,C0301,C0302,I0011,R0201,R0801,R0902,R0903,R0904,R0911,R0912,R0913,R0914,R0915,W0102,W0141,W0142,W0212,W0232,W0511,W0602,W0603,W0613,W0622,W0704


[REPORTS]
Expand Down

0 comments on commit 139e54e

Please sign in to comment.