Mypy/Typing
from __future__ import annotations
from typing import Any, Dict, List, Literal, Union
Dict[str, str] = None
List[str]
tuple[str, str]
Literal["a", "b", "c"]
mypy .
mypy --show-error-codes prog.py
mypy . --ignore-missing-imports --follow-imports=silent --install-types --non-interactive
mypy --ignore-missing-imports --follow-imports=silent --install-types --non-interactive test.py
typed_lines = [[], [], [], [], []] # type: ignore
f.name # type: ignore[attr-defined]
To skip an entire file
# type: ignore
Ignore in line
# type: ignore[assignment]
# type: ignore[arg-type]
# type: ignore[call-overload]
# type: ignore[index]
# type: ignore[name-defined]
# type: ignore[misc]
# type: ignore[no-redef]
# type: ignore[operator]
# type: ignore[var-annotated]