From b74e8b91e11360782223fd0da79941fc4efaec6b Mon Sep 17 00:00:00 2001 From: Danny Sepler Date: Sat, 8 Oct 2022 23:50:50 -0400 Subject: E231 should work with tuples in brackets --- pycodestyle.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pycodestyle.py b/pycodestyle.py index 542272c..2119d06 100755 --- a/pycodestyle.py +++ b/pycodestyle.py @@ -506,6 +506,7 @@ def missing_whitespace(logical_line): Okay: [a, b] Okay: (3,) + Okay: a[3,] = 1 Okay: a[1:4] Okay: a[:4] Okay: a[1:] @@ -523,7 +524,7 @@ def missing_whitespace(logical_line): if char == ':' and before.count('[') > before.count(']') and \ before.rfind('{') < before.rfind('['): continue # Slice syntax, no space required - if char == ',' and next_char == ')': + if char == ',' and next_char in ')]': continue # Allow tuple with only one element: (3,) if char == ':' and next_char == '=' and sys.version_info >= (3, 8): continue # Allow assignment expression -- cgit v1.2.1