[flake8-type-checking] Fix false positives for typing.Annotated (#14311)

This commit is contained in:
David Salvisberg 2024-11-13 13:17:52 +01:00 committed by GitHub
parent f789b12705
commit 89aa804b2d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 51 additions and 5 deletions

View file

@ -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

View file

@ -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

View file

@ -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