diff --git a/hacking/checks/comments.py b/hacking/checks/comments.py index 619c9cca..4034c1a7 100644 --- a/hacking/checks/comments.py +++ b/hacking/checks/comments.py @@ -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 diff --git a/hacking/checks/docstrings.py b/hacking/checks/docstrings.py index 6c6b894a..c419fa9b 100644 --- a/hacking/checks/docstrings.py +++ b/hacking/checks/docstrings.py @@ -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 " diff --git a/hacking/checks/python23.py b/hacking/checks/python23.py index 4315cab8..91bc6396 100644 --- a/hacking/checks/python23.py +++ b/hacking/checks/python23.py @@ -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`)")