mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-82979 PY-81028 Adjust the heuristic for implicit type aliases to recognize Annotated and Literal
Namely, that `Annotated` can contain arbitrary expressions and that `Literal` might contain boolean and integer literals. GitOrigin-RevId: 6b3d4212679d6556dfe1d4905f06a78e2769b4e2
This commit is contained in:
committed by
intellij-monorepo-bot
parent
d281245b4b
commit
5e6b043e8c
+4
@@ -0,0 +1,4 @@
|
||||
from m import StrictStr
|
||||
|
||||
|
||||
s: StrictStr
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
from typing import Annotated
|
||||
|
||||
|
||||
StrictStr = Annotated[str, object()]
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
from sample import HttpOk, Http400, Http404
|
||||
|
||||
|
||||
def foo() -> HttpOk[None] | Http400 | Http404:
|
||||
pass
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
from typing import Literal, TypeVar
|
||||
|
||||
Code = TypeVar("Code", bound=int)
|
||||
Response = TypeVar("Response", bound=list | str | None)
|
||||
Error = TypeVar("Error", default=str, bound= str | None)
|
||||
|
||||
Http = tuple[Code, Response]
|
||||
HttpOk = Http[Literal[200], Response]
|
||||
Http400 = Http[Literal[400], Error]
|
||||
Http401 = Http[Literal[401], Error]
|
||||
Http403 = Http[Literal[403], Error]
|
||||
Http404 = Http[Literal[404], Error]
|
||||
Http422 = Http[Literal[422], ErrorResponse[list[ErrorDetails]]]
|
||||
Http500 = Http[Literal[500], Literal["Internal Server Error"]]
|
||||
Reference in New Issue
Block a user