# HG changeset patch # User Martin Geisler # Date 2010-11-10 23:08:09 # Node ID 34034e55424fec7a171806786ca836856d28fc99 # Parent e80128e40c044ea6619c3dc160df69ad36a8e5ff check-code: using and/or/not as a function is bad style diff --git a/contrib/check-code.py b/contrib/check-code.py --- a/contrib/check-code.py +++ b/contrib/check-code.py @@ -118,6 +118,9 @@ pypats = [ "linebreak after :"), (r'class\s[^(]:', "old-style class, use class foo(object)"), (r'^\s+del\(', "del isn't a function"), + (r'\band\(', "and isn't a function"), + (r'\bor\(', "or isn't a function"), + (r'\bnot\(', "not isn't a function"), (r'^\s+except\(', "except isn't a function"), (r',]', "unneeded trailing ',' in list"), # (r'class\s[A-Z][^\(]*\((?!Exception)', diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1120,7 +1120,7 @@ def debugpushkey(ui, repopath, namespace key, old, new = keyinfo r = target.pushkey(namespace, key, old, new) ui.status(str(r) + '\n') - return not(r) + return not r else: for k, v in target.listkeys(namespace).iteritems(): ui.write("%s\t%s\n" % (k.encode('string-escape'), diff --git a/mercurial/demandimport.py b/mercurial/demandimport.py --- a/mercurial/demandimport.py +++ b/mercurial/demandimport.py @@ -111,7 +111,7 @@ def _demandimport(name, globals=None, lo mod = getattr(mod, comp) for x in fromlist: # set requested submodules for demand load - if not(hasattr(mod, x)): + if not hasattr(mod, x): setattr(mod, x, _demandmod(x, mod.__dict__, locals)) return mod