mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-09 22:34:17 +00:00
whitelist a bandit false positive and improve type annotation
This commit is contained in:
parent
89b0bb87d7
commit
dcd37ec3d4
2 changed files with 6 additions and 6 deletions
|
|
@ -385,11 +385,11 @@ def token_is_newline(token):
|
||||||
|
|
||||||
|
|
||||||
def count_parentheses(current_parentheses_count, token_text):
|
def count_parentheses(current_parentheses_count, token_text):
|
||||||
|
# type: (int, str) -> int
|
||||||
"""Count the number of parentheses."""
|
"""Count the number of parentheses."""
|
||||||
current_parentheses_count = current_parentheses_count or 0
|
if token_text in "([{": # nosec
|
||||||
if token_text in "([{":
|
|
||||||
return current_parentheses_count + 1
|
return current_parentheses_count + 1
|
||||||
elif token_text in "}])":
|
elif token_text in "}])": # nosec
|
||||||
return current_parentheses_count - 1
|
return current_parentheses_count - 1
|
||||||
return current_parentheses_count
|
return current_parentheses_count
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -337,9 +337,9 @@ def test_log_token(token, log_string):
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('current_count, token_text, expected', [
|
@pytest.mark.parametrize('current_count, token_text, expected', [
|
||||||
(None, '(', 1),
|
(0, '(', 1),
|
||||||
(None, '[', 1),
|
(0, '[', 1),
|
||||||
(None, '{', 1),
|
(0, '{', 1),
|
||||||
(1, ')', 0),
|
(1, ')', 0),
|
||||||
(1, ']', 0),
|
(1, ']', 0),
|
||||||
(1, '}', 0),
|
(1, '}', 0),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue