diff options
| author | Anthony Sottile <asottile@umich.edu> | 2019-05-19 16:45:05 +0000 |
|---|---|---|
| committer | Anthony Sottile <asottile@umich.edu> | 2019-05-19 16:45:05 +0000 |
| commit | b6ba6d4d03109965d3cf5174d5c2e6868d7d92bb (patch) | |
| tree | 84577eb9fba497ea283e9bcfc50cf64506b353ad | |
| parent | 89b0bb87d75906ca0acc9f8889776ce96e836ad0 (diff) | |
| parent | dcd37ec3d483e75616c22efb58655272cc2cfe4f (diff) | |
| download | flake8-b6ba6d4d03109965d3cf5174d5c2e6868d7d92bb.tar.gz | |
Merge branch 'nosec' into 'master'
whitelist a bandit false positive and improve type annotation
See merge request pycqa/flake8!318
| -rw-r--r-- | src/flake8/processor.py | 6 | ||||
| -rw-r--r-- | tests/unit/test_file_processor.py | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/flake8/processor.py b/src/flake8/processor.py index f786b50..09185e5 100644 --- a/src/flake8/processor.py +++ b/src/flake8/processor.py @@ -385,11 +385,11 @@ def token_is_newline(token): def count_parentheses(current_parentheses_count, token_text): + # type: (int, str) -> int """Count the number of parentheses.""" - current_parentheses_count = current_parentheses_count or 0 - if token_text in "([{": + if token_text in "([{": # nosec return current_parentheses_count + 1 - elif token_text in "}])": + elif token_text in "}])": # nosec return current_parentheses_count - 1 return current_parentheses_count diff --git a/tests/unit/test_file_processor.py b/tests/unit/test_file_processor.py index 582abf2..84b051c 100644 --- a/tests/unit/test_file_processor.py +++ b/tests/unit/test_file_processor.py @@ -337,9 +337,9 @@ def test_log_token(token, log_string): @pytest.mark.parametrize('current_count, token_text, expected', [ - (None, '(', 1), - (None, '[', 1), - (None, '{', 1), + (0, '(', 1), + (0, '[', 1), + (0, '{', 1), (1, ')', 0), (1, ']', 0), (1, '}', 0), |
