summaryrefslogtreecommitdiff
path: root/pycodestyle.py
diff options
context:
space:
mode:
authorAntony Lee <anntzer.lee@gmail.com>2020-02-26 00:33:24 +0100
committerAntony Lee <anntzer.lee@gmail.com>2020-02-26 13:56:02 +0100
commitb36fba61bdcbfe336afe53838eb85dde530e6f69 (patch)
tree861fa7b870c98ed528f002f7064f0af850209992 /pycodestyle.py
parent68cc24fbe60ce31e2f9b40dc6dd484b2abf3a705 (diff)
downloadpep8-b36fba61bdcbfe336afe53838eb85dde530e6f69.tar.gz
Support visual indent of continuation lines after with/assert/raise.
"with" is likely the most common case, and this indentation is explicitly given as example by PEP8 (under "maximum line length").
Diffstat (limited to 'pycodestyle.py')
-rwxr-xr-xpycodestyle.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/pycodestyle.py b/pycodestyle.py
index 705ba25..b9a37f0 100755
--- a/pycodestyle.py
+++ b/pycodestyle.py
@@ -695,6 +695,9 @@ def continued_indentation(logical_line, tokens, indent_level, hang_closing,
elif (token_type in (tokenize.STRING, tokenize.COMMENT) or
text in ('u', 'ur', 'b', 'br')):
indent_chances[start[1]] = str
+ # visual indent after assert/raise/with
+ elif not row and not depth and text in ["assert", "raise", "with"]:
+ indent_chances[end[1] + 1] = True
# special case for the "if" statement because len("if (") == 4
elif not indent_chances and not row and not depth and text == 'if':
indent_chances[end[1] + 1] = True