diff contrib/check-code.py @ 13076:a861c7155f09

check-code: single check for Python keywords used as a function This replaces the specific checks for del/and/or/not/except and additionally checks other Python keywords.
author Thomas Arendsen Hein <thomas@jtah.de>
date Fri, 03 Dec 2010 12:04:31 +0100
parents 637627f31c74
children 07d08c130892
line wrap: on
line diff
--- a/contrib/check-code.py	Fri Dec 03 11:30:45 2010 +0100
+++ b/contrib/check-code.py	Fri Dec 03 12:04:31 2010 +0100
@@ -119,11 +119,8 @@
     (r'^\s*(if|while|def|class|except|try)\s[^[]*:\s*[^\]#\s]+',
      "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'\b(%s)\(' % '|'.join(keyword.kwlist),
+     "Python keyword is not a function"),
     (r',]', "unneeded trailing ',' in list"),
 #    (r'class\s[A-Z][^\(]*\((?!Exception)',
 #     "don't capitalize non-exception classes"),