Summary
The following code shows how ruff check --isolated (0.8.2 through 0.11.3) falsely interprets variables used in arguments to Annotated as "unused" (exact same code in the playground):
from typing import Annotated, Literal
def type_annotations_from_tuple():
annos = (str, "foo", "bar") # unused? really?
return Annotated[annos]
def type_annotations_from_filtered_tuple():
annos = (str, None, "foo", None, "bar") # still unused?
return Annotated[tuple([a for a in annos if a is not None])]
def literals_from_tuple():
string_literals = ("foo", "bar")
return Literal[string_literals] # but this counts as "used"?
Version
at least >=0.8.2, <=0.11.3