Skip to content

Allow hanging indents for one-line stub definitions#1315

Closed
lin-hongkuan wants to merge 1 commit into
PyCQA:mainfrom
lin-hongkuan:codex/allow-one-line-protocol-hang
Closed

Allow hanging indents for one-line stub definitions#1315
lin-hongkuan wants to merge 1 commit into
PyCQA:mainfrom
lin-hongkuan:codex/allow-one-line-protocol-hang

Conversation

@lin-hongkuan

Copy link
Copy Markdown

Fixes #956.

Summary

  • treat one-line def ...: ... stubs as definitions with a body for continuation indentation
  • keep the existing E704 report for one-line definitions while avoiding the false E126 report
  • add a regression fixture for a Protocol.__call__ stub with hanging-indented parameters

Tests

  • python -m pytest tests/test_data.py -q
  • python -m pytest tests -q
  • python -m pycodestyle --statistics pycodestyle.py
  • git diff --check

@asottile asottile closed this Jun 25, 2026
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

Successfully merging this pull request may close these issues.

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

2 participants