check-code: drop the `safehasattr` rule
authorPierre-Yves David <pierre-yves.david@octobus.net>
Thu, 08 Dec 2022 15:33:19 +0100
changeset 50927 7a8ea1397816
parent 50926 bc9c9ed0659d
child 50928 d718eddf01d9
check-code: drop the `safehasattr` rule Since we no longer supports Python 2 we no longer needs to use a custom function to compensate the short comings of the global `hasattr` function in it. We cannot use the Python 3 `hasattr` function instead.
contrib/check-code.py
--- a/contrib/check-code.py	Fri Sep 01 16:36:13 2023 +0200
+++ b/contrib/check-code.py	Thu Dec 08 15:33:19 2022 +0100
@@ -383,12 +383,6 @@
             "use True/False for constant Boolean expression",
         ),
         (r'^\s*if False(:| +and)', 'Remove code instead of using `if False`'),
-        (
-            r'(?:(?<!def)\s+|\()hasattr\(',
-            'hasattr(foo, bar) is broken on py2, use util.safehasattr(foo, bar) '
-            'instead',
-            r'#.*hasattr-py3-only',
-        ),
         (r'opener\([^)]*\).read\(', "use opener.read() instead"),
         (r'opener\([^)]*\).write\(', "use opener.write() instead"),
         (r'(?i)descend[e]nt', "the proper spelling is descendAnt"),