check-code: using and/or/not as a function is bad style
authorMartin Geisler <mg@lazybytes.net>
Thu, 11 Nov 2010 00:08:09 +0100
changeset 12964 34034e55424f
parent 12963 e80128e40c04
child 12968 609edbc7853f
check-code: using and/or/not as a function is bad style
contrib/check-code.py
mercurial/commands.py
mercurial/demandimport.py
--- a/contrib/check-code.py	Wed Nov 10 15:44:19 2010 +0100
+++ b/contrib/check-code.py	Thu Nov 11 00:08:09 2010 +0100
@@ -118,6 +118,9 @@
      "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)',
--- a/mercurial/commands.py	Wed Nov 10 15:44:19 2010 +0100
+++ b/mercurial/commands.py	Thu Nov 11 00:08:09 2010 +0100
@@ -1120,7 +1120,7 @@
         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'),
--- a/mercurial/demandimport.py	Wed Nov 10 15:44:19 2010 +0100
+++ b/mercurial/demandimport.py	Thu Nov 11 00:08:09 2010 +0100
@@ -111,7 +111,7 @@
             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