Address flake8 3.x violations

Before we bump the minimum version, fix the violations it will
introduce. Nothing odd here.

Change-Id: I0392cd596b7476a3e6c8e832e8559c13e32ebf0b
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
This commit is contained in:
Stephen Finucane 2019-12-11 17:17:47 +00:00
parent 51eadb6698
commit b6bca99c62
3 changed files with 7 additions and 7 deletions

View File

@ -59,14 +59,14 @@ def hacking_has_license(physical_line, filename, lines, line_number):
# skip files that are < 10 lines, which isn't enough for a license to fit
# this allows us to handle empty files, as well as not fail on the Okay
# doctests.
if line_number is 1 and len(lines) > 10 and _project_is_apache():
if line_number == 1 and len(lines) > 10 and _project_is_apache():
for idx, line in enumerate(lines):
# if it's more than 10 characters in, it's probably not in the
# header
if 0 <= line.find('Licensed under the Apache License') < 10:
license_found = True
license_found = True
if 0 <= line.find('SPDX-License-Identifier:') < 10:
license_found = True
license_found = True
if not license_found:
return (0, "H102: Apache 2.0 license header not found")
@ -83,7 +83,7 @@ def hacking_has_correct_license(physical_line, filename, lines, line_number):
# skip files that are < 10 lines, which isn't enough for a license to fit
# this allows us to handle empty files, as well as not fail on the Okay
# doctests.
if line_number is 1 and len(lines) > 10 and _project_is_apache():
if line_number == 1 and len(lines) > 10 and _project_is_apache():
for idx, line in enumerate(lines):
column = line.find('Licensed under the Apache License')
if (0 < column < 10 and not

View File

@ -118,7 +118,7 @@ def hacking_docstring_summary(physical_line, previous_logical, tokens):
# not a multi line docstring
return
lines = docstring.split('\n')
if len(lines) > 1 and len(lines[1].strip()) is not 0:
if len(lines) > 1 and len(lines[1].strip()) != 0:
# docstrings get tokenized on the last line of the docstring, so
# we don't know the exact position.
return (0, "H405: multi line docstring "

View File

@ -224,5 +224,5 @@ def hacking_no_old_style_class(logical_line, noqa):
return
line = core.import_normalize(logical_line.strip())
if line.startswith("class ") and not RE_NEW_STYLE_CLASS.match(line):
yield (0, "H238: old style class declaration, "
"use new style (inherit from `object`)")
yield (0, "H238: old style class declaration, "
"use new style (inherit from `object`)")