Skip to content

PYI026/type-alias-without-annotation false positives with None in Enum #11117

@Avasam

Description

@Avasam
class VariablePolicy(Enum):
    EXPAND_DISTRIBUTED_VARIABLES = "expand_distributed_variables"
    NONE = None
    SAVE_VARIABLE_DEVICES = "save_variable_devices"

(taken from https://github.com/python/typeshed/blob/ed7f35a2bc53610d5166cbccbb965fc97cfdbac4/stubs/tensorflow/tensorflow/saved_model/experimental.pyi#L34-L37 )

Running ruff check --fix --select=PYI026 results in:

stubs\tensorflow\tensorflow\saved_model\experimental.pyi:36:5: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g., `NONE: TypeAlias = None`
Found 1 error.
[*] 1 fixable with the `--fix` option.

Version: ruff 0.4.1

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingruleImplementing or modifying a lint rule

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions