Mercurial > public > mercurial-scm > hg-stable
comparison contrib/check-code.py @ 25028:62c2786b4327
check-code: allow print and exec as a function
This is required to move forward on python3 compatibility.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Wed, 13 May 2015 11:39:48 -0700 |
parents | ded7302e1c83 |
children | e0ce8d8630f3 |
comparison
equal
deleted
inserted
replaced
25027:297ea0df75d0 | 25028:62c2786b4327 |
---|---|
236 (r'^\s*(if|while|def|class|except|try)\s[^[\n]*:\s*[^\\n]#\s]+', | 236 (r'^\s*(if|while|def|class|except|try)\s[^[\n]*:\s*[^\\n]#\s]+', |
237 "linebreak after :"), | 237 "linebreak after :"), |
238 (r'class\s[^( \n]+:', "old-style class, use class foo(object)"), | 238 (r'class\s[^( \n]+:', "old-style class, use class foo(object)"), |
239 (r'class\s[^( \n]+\(\):', | 239 (r'class\s[^( \n]+\(\):', |
240 "class foo() not available in Python 2.4, use class foo(object)"), | 240 "class foo() not available in Python 2.4, use class foo(object)"), |
241 (r'\b(%s)\(' % '|'.join(keyword.kwlist), | 241 (r'\b(%s)\(' % '|'.join(k for k in keyword.kwlist |
242 if k not in ('print', 'exec')), | |
242 "Python keyword is not a function"), | 243 "Python keyword is not a function"), |
243 (r',]', "unneeded trailing ',' in list"), | 244 (r',]', "unneeded trailing ',' in list"), |
244 # (r'class\s[A-Z][^\(]*\((?!Exception)', | 245 # (r'class\s[A-Z][^\(]*\((?!Exception)', |
245 # "don't capitalize non-exception classes"), | 246 # "don't capitalize non-exception classes"), |
246 # (r'in range\(', "use xrange"), | 247 # (r'in range\(', "use xrange"), |