Remove "N309 Python 3.x incompatible construct"
This check was implemented as H231 in Hacking 0.6 or newer (I0bd89fa05d88de34ca62ce59f427468ede226126), so the duplicate implementation can be removed. Change-Id: I003d8611621adc53f1afcfd77691f345397670b0
This commit is contained in:
parent
9e9b3328af
commit
33b033d304
|
@ -31,29 +31,6 @@ def import_no_db_in_virt(logical_line, filename):
|
|||
yield (0, "N307: nova.db import not allowed in nova/virt/*")
|
||||
|
||||
|
||||
def except_python3x_compatible(logical_line, filename):
|
||||
"""Check for except statements to be Python 3.x compatible
|
||||
|
||||
As of Python 3.x, the construct "except x,y:" has been removed.
|
||||
|
||||
N308
|
||||
"""
|
||||
|
||||
def is_old_style_except(logical_line):
|
||||
# Should match:
|
||||
# except ProcessExecutionError, exn:
|
||||
# Should not match:
|
||||
# except UncodeError:
|
||||
# except (x,y):
|
||||
return (',' in logical_line
|
||||
and ')' not in logical_line.rpartition(',')[2])
|
||||
|
||||
if ("except " in logical_line
|
||||
and logical_line.endswith(':')
|
||||
and is_old_style_except(logical_line)):
|
||||
yield(0, "N308: Python 3.x incompatible 'except x,y:' construct")
|
||||
|
||||
|
||||
def no_db_session_in_public_api(logical_line, filename):
|
||||
if "db/api.py" in filename or "db/sqlalchemy/api.py" in filename:
|
||||
if session_check.match(logical_line):
|
||||
|
@ -72,6 +49,5 @@ def use_timeutils_utcnow(logical_line):
|
|||
|
||||
def factory(register):
|
||||
register(import_no_db_in_virt)
|
||||
register(except_python3x_compatible)
|
||||
register(no_db_session_in_public_api)
|
||||
register(use_timeutils_utcnow)
|
||||
|
|
Loading…
Reference in New Issue