E126: asks for less indent on one-line protocol functions
Open
Nobody has claimed this yet.
help wanted
needs patch
needs test
- Dominant language
- Python
- Stars
- 5.2k
- Forks
- 754
- PR merge metrics
- No merged PRs in 30d
Description
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the report with the shown t.py examples and the pycodestyle --ignore=E704 command. Trace the E126 check to understand why the one-line protocol function is flagged, then verify that the intended indentation is accepted without weakening other continuation-indent checks.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100