mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 13:25:17 +00:00

## Summary Implements `Y064` from `flake8-pyi` and its autofix. ## Test Plan `cargo test` / `cargo insta review`
19 lines
648 B
Python
19 lines
648 B
Python
from typing import Final, Literal
|
|
|
|
x: Final[Literal[True]] # PYI064
|
|
y: Final[Literal[None]] = None # PYI064
|
|
z: Final[Literal["this is a really long literal, that won't be rendered in the issue text"]] # PYI064
|
|
|
|
# This should be fixable, and marked as safe
|
|
w1: Final[Literal[123]] # PYI064
|
|
|
|
# This should not be fixable
|
|
w2: Final[Literal[123]] = "random value" # PYI064
|
|
|
|
n1: Final[Literal[True, False]] # No issue here
|
|
n2: Literal[True] # No issue here
|
|
|
|
PlatformName = Literal["linux", "macos", "windows"]
|
|
PLATFORMS: Final[set[PlatformName]] = {"linux", "macos", "windows"} # No issue here
|
|
|
|
foo: Final[{1, 2, 3}] = {1, 2, 3} # No issue here
|