comparison contrib/check-code.py @ 16416:c3aedd526d53 stable

mq: replace hasattr() with util.safehasattr(), update check-code.py
author Patrick Mezard <patrick@mezard.eu>
date Fri, 13 Apr 2012 15:07:13 +0200
parents f64b25f147d7
children 9b26d541e972
comparison
equal deleted inserted replaced
16396:03e408a122c4 16416:c3aedd526d53
175 (r' is\s+(not\s+)?["\'0-9-]', "object comparison with literal"), 175 (r' is\s+(not\s+)?["\'0-9-]', "object comparison with literal"),
176 (r' [=!]=\s+(True|False|None)', 176 (r' [=!]=\s+(True|False|None)',
177 "comparison with singleton, use 'is' or 'is not' instead"), 177 "comparison with singleton, use 'is' or 'is not' instead"),
178 (r'^\s*(while|if) [01]:', 178 (r'^\s*(while|if) [01]:',
179 "use True/False for constant Boolean expression"), 179 "use True/False for constant Boolean expression"),
180 (r'(?<!def)\s+hasattr', 180 (r'(?:(?<!def)\s+|\()hasattr',
181 'hasattr(foo, bar) is broken, use util.safehasattr(foo, bar) instead'), 181 'hasattr(foo, bar) is broken, use util.safehasattr(foo, bar) instead'),
182 (r'opener\([^)]*\).read\(', 182 (r'opener\([^)]*\).read\(',
183 "use opener.read() instead"), 183 "use opener.read() instead"),
184 (r'BaseException', 'not in Py2.4, use Exception'), 184 (r'BaseException', 'not in Py2.4, use Exception'),
185 (r'os\.path\.relpath', 'os.path.relpath is not in Py2.5'), 185 (r'os\.path\.relpath', 'os.path.relpath is not in Py2.5'),