summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanny Sepler <dannysepler@gmail.com>2022-10-08 23:50:50 -0400
committerDanny Sepler <dannysepler@gmail.com>2022-10-08 23:50:50 -0400
commitb74e8b91e11360782223fd0da79941fc4efaec6b (patch)
treea6c2765bd5f01ab3ae5148eb3d8dff6388136dd8
parente1a0055f2bbc5ec756399f29ca80c676e48cdb25 (diff)
downloadpep8-b74e8b91e11360782223fd0da79941fc4efaec6b.tar.gz
E231 should work with tuples in brackets
-rwxr-xr-xpycodestyle.py3
1 files changed, 2 insertions, 1 deletions
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