# HG changeset patch # User Thomas Arendsen Hein # Date 2010-12-03 11:04:31 # Node ID a861c7155f09cefec06c8300d0d580774b729dc6 # Parent d73c3034deeee24e97cd09f8c51fce1be03a3426 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. diff --git a/contrib/check-code.py b/contrib/check-code.py --- a/contrib/check-code.py +++ b/contrib/check-code.py @@ -119,11 +119,8 @@ pypats = [ (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"),