summaryrefslogtreecommitdiff
path: root/osprofiler/hacking/checks.py
diff options
context:
space:
mode:
authorAndreas Jaeger <aj@suse.com>2020-06-02 17:07:50 +0200
committerAndreas Jaeger <aj@suse.com>2020-06-02 17:07:50 +0200
commit1d77244f18bd69308cce1de8b182eb10c8106aa9 (patch)
tree0f11baa429314178a55d85ecdbb6828276459b8d /osprofiler/hacking/checks.py
parentc4c57a168028465b86de4ead0d5662943c6021b8 (diff)
downloadosprofiler-1d77244f18bd69308cce1de8b182eb10c8106aa9.tar.gz
Fix pep8 failures
With an updated flake8, we get some new warnings. Update hacking directly to version 3.1.0 and fix the problems found. Note that before this change, flake8 used the default "ignore" list, this now adds a new ignore list. Change-Id: Iccbf4f30eb4e542d3824b7782f43eacda29c5a90
Diffstat (limited to 'osprofiler/hacking/checks.py')
-rw-r--r--osprofiler/hacking/checks.py23
1 files changed, 12 insertions, 11 deletions
diff --git a/osprofiler/hacking/checks.py b/osprofiler/hacking/checks.py
index c77e91d..b31a47d 100644
--- a/osprofiler/hacking/checks.py
+++ b/osprofiler/hacking/checks.py
@@ -166,8 +166,8 @@ def assert_equal_none(logical_line, filename):
N322
"""
- res = (re_assert_equal_start_with_none.search(logical_line) or
- re_assert_equal_end_with_none.search(logical_line))
+ res = (re_assert_equal_start_with_none.search(logical_line)
+ or re_assert_equal_end_with_none.search(logical_line))
if res:
yield (0, "N322 assertEqual(A, None) or assertEqual(None, A) "
"sentences not allowed, you should use assertIsNone(A) "
@@ -185,8 +185,9 @@ def assert_true_or_false_with_in(logical_line, filename):
N323
"""
- res = (re_assert_true_false_with_in_or_not_in.search(logical_line) or
- re_assert_true_false_with_in_or_not_in_spaces.search(logical_line))
+ res = (re_assert_true_false_with_in_or_not_in.search(logical_line)
+ or re_assert_true_false_with_in_or_not_in_spaces.search(
+ logical_line))
if res:
yield (0, "N323 assertTrue/assertFalse(A in/not in B)sentences not "
"allowed, you should use assertIn(A, B) or assertNotIn(A, B)"
@@ -204,8 +205,8 @@ def assert_equal_in(logical_line, filename):
N324
"""
- res = (re_assert_equal_in_end_with_true_or_false.search(logical_line) or
- re_assert_equal_in_start_with_true_or_false.search(logical_line))
+ res = (re_assert_equal_in_end_with_true_or_false.search(logical_line)
+ or re_assert_equal_in_start_with_true_or_false.search(logical_line))
if res:
yield (0, "N324: Use assertIn/NotIn(A, B) rather than "
"assertEqual(A in/not in B, True/False) when checking "
@@ -226,8 +227,8 @@ def check_quotes(logical_line, filename):
check_tripple = (
lambda line, i, char: (
- i + 2 < len(line) and
- (char == line[i] == line[i + 1] == line[i + 2])
+ i + 2 < len(line)
+ and (char == line[i] == line[i + 1] == line[i + 2])
)
)
@@ -291,9 +292,9 @@ def check_dict_formatting_in_string(logical_line, tokens):
# NOTE(stpierre): Can't use @skip_ignored_lines here because it's
# a stupid decorator that only works on functions that take
# (logical_line, filename) as arguments.
- if (not logical_line or
- logical_line.startswith("#") or
- logical_line.endswith("# noqa")):
+ if (not logical_line
+ or logical_line.startswith("#")
+ or logical_line.endswith("# noqa")):
return
current_string = ""