mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 20:54:28 +08:00
Add get_origin annotations (#9811)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
@@ -20,6 +20,11 @@ from types import (
|
||||
)
|
||||
from typing_extensions import Never as _Never, ParamSpec as _ParamSpec, final as _final
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
from types import UnionType
|
||||
if sys.version_info >= (3, 9):
|
||||
from types import GenericAlias
|
||||
|
||||
__all__ = [
|
||||
"AbstractSet",
|
||||
"Any",
|
||||
@@ -745,9 +750,21 @@ else:
|
||||
) -> dict[str, Any]: ...
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
def get_origin(tp: Any) -> Any | None: ...
|
||||
def get_args(tp: Any) -> tuple[Any, ...]: ...
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
@overload
|
||||
def get_origin(tp: ParamSpecArgs | ParamSpecKwargs) -> ParamSpec: ...
|
||||
@overload
|
||||
def get_origin(tp: UnionType) -> type[UnionType]: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
@overload
|
||||
def get_origin(tp: GenericAlias) -> type: ...
|
||||
@overload
|
||||
def get_origin(tp: Any) -> Any | None: ...
|
||||
else:
|
||||
def get_origin(tp: Any) -> Any | None: ...
|
||||
|
||||
@overload
|
||||
def cast(typ: Type[_T], val: Any) -> _T: ...
|
||||
@overload
|
||||
|
||||
Reference in New Issue
Block a user