-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
bugSomething isn't workingSomething isn't workingruleImplementing or modifying a lint ruleImplementing or modifying a lint rule
Description
Summary
When running UP045 it doesn't seem to trigger on types within cast which when paired with TC006 leads to inconsistent representations.
Versions
$ ruff --version
ruff 0.12.10
$ python --version
Python 3.11.13eCLI Command
$ ruff check --select TC006,UP045,I <file_with_contents_below>.pyMinimum reproducer
from __future__ import annotations
from typing import Any, Optional, cast
def cast_example(input_item: Any) -> str | None:
"""
Shows rule inconsistency.
Original implementation
def cast_example(input_item: Any) -> Optional[str]:
return cast(Optional[str], input_item)
"""
return cast("Optional[str]", input_item)Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingruleImplementing or modifying a lint ruleImplementing or modifying a lint rule