check-code: allow skipping hasattr check in py3-only code
hasattr is safe in Python 3, and in an upcoming patch we can't use
util.safehasattr.
--- a/contrib/check-code.py Mon May 22 01:17:49 2017 -0700
+++ b/contrib/check-code.py Sun May 21 13:34:42 2017 -0700
@@ -300,7 +300,8 @@
(r'^\s*(while|if) [01]:',
"use True/False for constant Boolean expression"),
(r'(?:(?<!def)\s+|\()hasattr\(',
- 'hasattr(foo, bar) is broken, use util.safehasattr(foo, bar) instead'),
+ '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\(',