Skip to content

pass-statement-stub-body (PYI009)#

Derived from the flake8-pyi linter.

Fix is always available.

What it does#

Checks for pass statements in empty stub bodies.

Why is this bad?#

For consistency, empty stub bodies should contain ... instead of pass.

Additionally, an ellipsis better conveys the intent of the stub body (that the body has been implemented, but has been intentionally left blank to document the interface).

Example#

def foo(bar: int) -> list[int]:
    pass

Use instead:

def foo(bar: int) -> list[int]: ...