inspect: update for py310 (#5296)

This commit is contained in:
Shantanu
2021-05-02 06:21:03 -07:00
committed by GitHub
parent 0db864f6b5
commit 21e174a192

View File

@@ -105,7 +105,18 @@ def indentsize(line: str) -> int: ...
#
# Introspecting callables with the Signature object
#
def signature(obj: Callable[..., Any], *, follow_wrapped: bool = ...) -> Signature: ...
if sys.version_info >= (3, 10):
def signature(
obj: Callable[..., Any],
*,
follow_wrapped: bool = ...,
globals: Optional[Mapping[str, Any]] = ...,
locals: Optional[Mapping[str, Any]] = ...,
eval_str: bool = ...,
) -> Signature: ...
else:
def signature(obj: Callable[..., Any], *, follow_wrapped: bool = ...) -> Signature: ...
class Signature:
def __init__(self, parameters: Optional[Sequence[Parameter]] = ..., *, return_annotation: Any = ...) -> None: ...
@@ -119,8 +130,29 @@ class Signature:
def bind(self, *args: Any, **kwargs: Any) -> BoundArguments: ...
def bind_partial(self, *args: Any, **kwargs: Any) -> BoundArguments: ...
def replace(self, *, parameters: Optional[Sequence[Parameter]] = ..., return_annotation: Any = ...) -> Signature: ...
@classmethod
def from_callable(cls, obj: Callable[..., Any], *, follow_wrapped: bool = ...) -> Signature: ...
if sys.version_info >= (3, 10):
@classmethod
def from_callable(
cls,
obj: Callable[..., Any],
*,
follow_wrapped: bool = ...,
globals: Optional[Mapping[str, Any]] = ...,
locals: Optional[Mapping[str, Any]] = ...,
eval_str: bool = ...,
) -> Signature: ...
else:
@classmethod
def from_callable(cls, obj: Callable[..., Any], *, follow_wrapped: bool = ...) -> Signature: ...
if sys.version_info >= (3, 10):
def get_annotations(
obj: Union[Callable[..., Any], Type[Any], ModuleType],
*,
globals: Optional[Mapping[str, Any]] = ...,
locals: Optional[Mapping[str, Any]] = ...,
eval_str: bool = ...,
) -> Dict[str, Any]: ...
# The name is the same as the enum's name in CPython
class _ParameterKind(enum.IntEnum):