From 4a37706b95a49ff61a44202f9775146de1e895db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Gr=C3=B6nholm?= Date: Fri, 8 Apr 2016 14:54:57 +0300 Subject: Fix false E251 error involving square brackets Fixed a case where a comma is erroneously interpreted as an argument separator when square brackets are used in an argument annotation with a default value. Closes #496 --- pep8.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pep8.py') diff --git a/pep8.py b/pep8.py index ec19dc5..8ec21e1 100755 --- a/pep8.py +++ b/pep8.py @@ -794,9 +794,9 @@ def whitespace_around_named_parameter_equals(logical_line, tokens): if start != prev_end: yield (prev_end, message) if token_type == tokenize.OP: - if text == '(': + if text in '([': parens += 1 - elif text == ')': + elif text in ')]': parens -= 1 elif in_def and text == ':' and parens == 1: annotated_func_arg = True -- cgit v1.2.1