PyCQA/pycodestyle

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

Offen

#956 geöffnet am 05.08.2020

 (1 Kommentar) (1 Reaktion) (0 zugewiesene Personen)Python (809 Forks)batch import
help wantedneeds patchneeds test

Repository-Metriken

Stars
 (4.941 Sterne)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

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

Contributor Guide