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

E126: asks for less indent on one-line protocol functions #956

Open
asottile opened this issue Aug 5, 2020 · 1 comment
Open

E126: asks for less indent on one-line protocol functions #956

asottile opened this issue Aug 5, 2020 · 1 comment

Comments

@asottile
Copy link
Member

asottile commented Aug 5, 2020

from typing import Protocol


class _LongPollProtocol(Protocol):
    def __call__(
            self,
            foo: str,
            bar: int,
    ) -> int: ...

running pycodestyle on this yields:

$ ~/opt/venv/bin/pycodestyle --version
2.6.0
$ ~/opt/venv/bin/pycodestyle t.py --ignore=E704
t.py:6:13: E126 continuation line over-indented for hanging indent

but interestingly, this indentation is ok if I move the Ellipsis to the next line

from typing import Protocol


class _LongPollProtocol(Protocol):
    def __call__(
            self,
            foo: str,
            bar: int,
    ) -> int:
        ...

I intentionally want to indent the arguments two indents to differentiate between the body of code

@sigmavirus24
Copy link
Member

@PedanticHacker That's probably the worst indentation to consider "proper". It's diametrically opposed to the way most auto-formatters would re-format that code thus putting this project at odds with them.

I think @asottile's preferred style is fine and worth trying to adjust for

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

No branches or pull requests

2 participants