comparison contrib/check-code.py @ 25140:317333e0793c

check-code: fix the error message about 'class foo():' Using 'classs foo():' result in old style object instead of new style object. We do not want old style object so this check is unrelated to 2.4.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Sun, 17 May 2015 17:40:26 -0700
parents 6d3079e9b53f
children 3ea8d6b5e665
comparison
equal deleted inserted replaced
25139:6d3079e9b53f 25140:317333e0793c
232 "don't use camelcase in identifiers"), 232 "don't use camelcase in identifiers"),
233 (r'^\s*(if|while|def|class|except|try)\s[^[\n]*:\s*[^\\n]#\s]+', 233 (r'^\s*(if|while|def|class|except|try)\s[^[\n]*:\s*[^\\n]#\s]+',
234 "linebreak after :"), 234 "linebreak after :"),
235 (r'class\s[^( \n]+:', "old-style class, use class foo(object)"), 235 (r'class\s[^( \n]+:', "old-style class, use class foo(object)"),
236 (r'class\s[^( \n]+\(\):', 236 (r'class\s[^( \n]+\(\):',
237 "class foo() not available in Python 2.4, use class foo(object)"), 237 "class foo() creates old style object, use class foo(object)"),
238 (r'\b(%s)\(' % '|'.join(k for k in keyword.kwlist 238 (r'\b(%s)\(' % '|'.join(k for k in keyword.kwlist
239 if k not in ('print', 'exec')), 239 if k not in ('print', 'exec')),
240 "Python keyword is not a function"), 240 "Python keyword is not a function"),
241 (r',]', "unneeded trailing ',' in list"), 241 (r',]', "unneeded trailing ',' in list"),
242 # (r'class\s[A-Z][^\(]*\((?!Exception)', 242 # (r'class\s[A-Z][^\(]*\((?!Exception)',