Skip to content

quoted-annotation-in-stub (PYI020)#

Derived from the flake8-pyi linter.

Fix is always available.

What it does#

Checks for quoted type annotations in stub (.pyi) files, which should be avoided.

Why is this bad?#

Stub files are evaluated using annotations semantics, as if from __future__ import annotations were included in the file. As such, quotes are never required for type annotations in stub files, and should be omitted.

Example#

def function() -> "int":
    ...

Use instead:

def function() -> int:
    ...