mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 18:58:04 +00:00
[flake8-type-checking] Fix false positives for typing.Annotated
(#14311)
This commit is contained in:
parent
f789b12705
commit
89aa804b2d
7 changed files with 51 additions and 5 deletions
|
@ -90,3 +90,14 @@ def f():
|
|||
|
||||
def func(self) -> DataFrame | list[Series]:
|
||||
pass
|
||||
|
||||
|
||||
def f():
|
||||
from typing import Annotated
|
||||
|
||||
from fastapi import Depends
|
||||
|
||||
from .foo import get_foo
|
||||
|
||||
def test_annotated_non_typing_reference(user: Annotated[str, Depends(get_foo)]):
|
||||
pass
|
||||
|
|
|
@ -85,3 +85,14 @@ def f():
|
|||
|
||||
def test_optional_literal_no_removal(arg: Optional[Literal["red", "blue"]]):
|
||||
pass
|
||||
|
||||
|
||||
def f():
|
||||
from typing import Annotated
|
||||
|
||||
from fastapi import Depends
|
||||
|
||||
from .foo import get_foo
|
||||
|
||||
def test_annotated_non_typing_reference(user: Annotated[str, Depends(get_foo)]):
|
||||
pass
|
||||
|
|
|
@ -42,3 +42,14 @@ def f():
|
|||
def test_attribute_typing_literal(arg: models.AbstractBaseUser[Literal["admin"]]):
|
||||
pass
|
||||
|
||||
|
||||
def f():
|
||||
from typing import Annotated
|
||||
|
||||
from fastapi import Depends
|
||||
|
||||
from .foo import get_foo
|
||||
|
||||
def test_annotated_non_typing_reference(user: Annotated[str, Depends(get_foo)]):
|
||||
pass
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue