Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PEP8 backslash exception for with statements is not honored #202

Open
ergoithz opened this issue Aug 28, 2021 · 1 comment
Open

PEP8 backslash exception for with statements is not honored #202

ergoithz opened this issue Aug 28, 2021 · 1 comment

Comments

@ergoithz
Copy link

ergoithz commented Aug 28, 2021

Given this example, explicitly allowed by PEP8 (lit. Backslashes may still be appropriate at times. For example, long, multiple with-statements cannot use implicit continuation, so backslashes are acceptable):

async def fnc():
    async with asdf() as a, \
               bsdf():
        return 1

with asdf() as a, \
     bsdf():
    return 1


with \
  asdf() as a, \
  bsdf():
    return 1

This plugin gives many non-PEP8-compliant false positives:

test_continuation.py:2:1: N400: Found backslash that is used for line breaking
    async with asdf() as a, \
               bsdf():
^
test_continuation.py:6:1: N400: Found backslash that is used for line breaking
with asdf() as a, \
     bsdf():
^
test_continuation.py:11:1: N400: Found backslash that is used for line breaking
with \
  asdf() as a, \
  bsdf():
^
test_continuation.py:12:3: N400: Found backslash that is used for line breaking
with \
  asdf() as a, \
  bsdf():
  ^
@ergoithz ergoithz changed the title with statement exemption is not honored PEP8 backslash exception for with statements is not honored Aug 28, 2021
@153957
Copy link

153957 commented Jul 20, 2022

At least we can now (Python 3.10+) use parentheses in context expressions:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants