From c8f3bc26a29bb04641ed5bf967b1dce632c97a0e Mon Sep 17 00:00:00 2001 From: Ian Cordasco Date: Thu, 30 Jun 2016 06:40:29 -0500 Subject: [PATCH] Clean up check signatures Flake8 3.0 enforces the check signature contract that was detailed in 2.x. To prepare Hacking for Flake8 3.0's release, we need to clean up our signatures and stop requesting both logical_line and physical_line, especially when we don't use both in each of those cases. Change-Id: Id55eadb66599a9bf240c837dafa88737aa024a16 Closes-bug: 1597729 --- hacking/checks/dictlist.py | 2 +- hacking/checks/except_checks.py | 4 ++-- hacking/checks/imports.py | 2 +- hacking/checks/python23.py | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/hacking/checks/dictlist.py b/hacking/checks/dictlist.py index 790d0242..0d0da9f0 100644 --- a/hacking/checks/dictlist.py +++ b/hacking/checks/dictlist.py @@ -22,7 +22,7 @@ LOCALS_TEXT_MAP = { @core.flake8ext -def hacking_no_locals(logical_line, physical_line, tokens, noqa): +def hacking_no_locals(logical_line, tokens, noqa): """Do not use locals() or self.__dict__ for string formatting. Okay: 'locals()' diff --git a/hacking/checks/except_checks.py b/hacking/checks/except_checks.py index b53e2231..62071840 100644 --- a/hacking/checks/except_checks.py +++ b/hacking/checks/except_checks.py @@ -20,7 +20,7 @@ RE_ASSERT_RAISES_EXCEPTION = re.compile(r"self\.assertRaises\(Exception[,\)]") @core.flake8ext -def hacking_except_format(logical_line, physical_line, noqa): +def hacking_except_format(logical_line, noqa): r"""Check for 'except:'. OpenStack HACKING guide recommends not using except: @@ -38,7 +38,7 @@ def hacking_except_format(logical_line, physical_line, noqa): @core.flake8ext -def hacking_except_format_assert(logical_line, physical_line, noqa): +def hacking_except_format_assert(logical_line, noqa): r"""Check for 'assertRaises(Exception'. OpenStack HACKING guide recommends not using assertRaises(Exception...): diff --git a/hacking/checks/imports.py b/hacking/checks/imports.py index 3d8c08b0..13a0c216 100644 --- a/hacking/checks/imports.py +++ b/hacking/checks/imports.py @@ -18,7 +18,7 @@ RE_RELATIVE_IMPORT = re.compile('^from\s*[.]') @core.flake8ext -def hacking_import_rules(logical_line, physical_line, filename, noqa): +def hacking_import_rules(logical_line, filename, noqa): r"""Check for imports. OpenStack HACKING guide recommends one import per line: diff --git a/hacking/checks/python23.py b/hacking/checks/python23.py index 77048519..6c42c138 100644 --- a/hacking/checks/python23.py +++ b/hacking/checks/python23.py @@ -21,7 +21,7 @@ RE_PRINT = re.compile(r"\bprint(?:$|\s+[^\(])") @core.skip_on_py3 @core.flake8ext -def hacking_python3x_except_compatible(logical_line, physical_line, noqa): +def hacking_python3x_except_compatible(logical_line, noqa): r"""Check for except statements to be Python 3.x compatible As of Python 3.x, the construct 'except x,y:' has been removed. @@ -78,7 +78,7 @@ def hacking_python3x_octal_literals(logical_line, tokens, noqa): @core.skip_on_py3 @core.flake8ext -def hacking_python3x_print_function(logical_line, physical_line, noqa): +def hacking_python3x_print_function(logical_line, noqa): r"""Check that all print occurrences look like print functions. Check that all occurrences of print look like functions, not @@ -143,7 +143,7 @@ def hacking_no_assert_underscore(logical_line, tokens, noqa): @core.flake8ext -def hacking_python3x_metaclass(logical_line, physical_line, noqa): +def hacking_python3x_metaclass(logical_line, noqa): r"""Check for metaclass to be Python 3.x compatible. Okay: @six.add_metaclass(Meta)\nclass Foo(object):\n pass