Skip to content

default-type-arguments

Pythonstyleno fixdefault: offpython/ruff

Reports Generator[X, None, None] and AsyncGenerator[X, None] when the target_version gives the last arguments a default (3.13 and later).

From Python 3.13 the send and return types of a generator default to None, so Generator[int] means the same as Generator[int, None, None] and AsyncGenerator[int] the same as AsyncGenerator[int, None]. The extra arguments are noise.

To fix, remove the trailing None arguments.

Reported
...
...
x: Generator[int, None, None]
...
pass
...
python:
lint:
rules:
default-type-arguments: warn # off (default), warn, error

Enabled by the presets: python/ruff.

Suppress one line with sudsy-disable-next-line default-type-arguments in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
ruff UP043 full