Mercurial > public > mercurial-scm > hg-stable
diff contrib/check-code.py @ 49036:55d132525155
check-code: remove ban on old-style classes
In Python 3, `class foo:` is equivalent to `class foo(object):`. So
we can allow the former form now.
Differential Revision: https://phab.mercurial-scm.org/D12351
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Mon, 21 Feb 2022 13:03:43 -0700 |
parents | 82f1c46cce5c |
children | 642e31cb55f0 |
line wrap: on
line diff
--- a/contrib/check-code.py Mon Feb 21 12:46:27 2022 -0700 +++ b/contrib/check-code.py Mon Feb 21 13:03:43 2022 -0700 @@ -343,16 +343,6 @@ "linebreak after :", ), ( - r'class\s[^( \n]+:', - "old-style class, use class foo(object)", - r'#.*old-style', - ), - ( - r'class\s[^( \n]+\(\):', - "class foo() creates old style object, use class foo(object)", - r'#.*old-style', - ), - ( r'\b(%s)\(' % '|'.join(k for k in keyword.kwlist if k not in ('print', 'exec')), "Python keyword is not a function",