Skip to content

pass-in-class-body (PYI012)#

Derived from the flake8-pyi linter.

Fix is always available.

What it does#

Checks for the presence of the pass statement within a class body in a stub (.pyi) file.

Why is this bad?#

In stub files, class definitions are intended to provide type hints, but are never actually evaluated. As such, it's unnecessary to include a pass statement in a class body, since it has no effect.

Instead of pass, prefer ... to indicate that the class body is empty and adhere to common stub file conventions.


class MyClass:

Use instead:

class MyClass: