Skip to content

non-empty-stub-body (PYI010)#

Derived from the flake8-pyi linter.

Fix is always available.

What it does#

Checks for non-empty function stub bodies.

Why is this bad?#

Stub files are meant to be used as a reference for the interface of a module, and should not contain any implementation details. Thus, the body of a stub function should be empty.


def double(x: int) -> int:
    return x * 2

Use instead:

def double(x: int) -> int: ...