Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 21e174a

Browse files
authored
inspect: update for py310 (#5296)
1 parent 0db864f commit 21e174a

1 file changed

Lines changed: 35 additions & 3 deletions

File tree

stdlib/inspect.pyi

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,18 @@ def indentsize(line: str) -> int: ...
105105
#
106106
# Introspecting callables with the Signature object
107107
#
108-
def signature(obj: Callable[..., Any], *, follow_wrapped: bool = ...) -> Signature: ...
108+
if sys.version_info >= (3, 10):
109+
def signature(
110+
obj: Callable[..., Any],
111+
*,
112+
follow_wrapped: bool = ...,
113+
globals: Optional[Mapping[str, Any]] = ...,
114+
locals: Optional[Mapping[str, Any]] = ...,
115+
eval_str: bool = ...,
116+
) -> Signature: ...
117+
118+
else:
119+
def signature(obj: Callable[..., Any], *, follow_wrapped: bool = ...) -> Signature: ...
109120

110121
class Signature:
111122
def __init__(self, parameters: Optional[Sequence[Parameter]] = ..., *, return_annotation: Any = ...) -> None: ...
@@ -119,8 +130,29 @@ class Signature:
119130
def bind(self, *args: Any, **kwargs: Any) -> BoundArguments: ...
120131
def bind_partial(self, *args: Any, **kwargs: Any) -> BoundArguments: ...
121132
def replace(self, *, parameters: Optional[Sequence[Parameter]] = ..., return_annotation: Any = ...) -> Signature: ...
122-
@classmethod
123-
def from_callable(cls, obj: Callable[..., Any], *, follow_wrapped: bool = ...) -> Signature: ...
133+
if sys.version_info >= (3, 10):
134+
@classmethod
135+
def from_callable(
136+
cls,
137+
obj: Callable[..., Any],
138+
*,
139+
follow_wrapped: bool = ...,
140+
globals: Optional[Mapping[str, Any]] = ...,
141+
locals: Optional[Mapping[str, Any]] = ...,
142+
eval_str: bool = ...,
143+
) -> Signature: ...
144+
else:
145+
@classmethod
146+
def from_callable(cls, obj: Callable[..., Any], *, follow_wrapped: bool = ...) -> Signature: ...
147+
148+
if sys.version_info >= (3, 10):
149+
def get_annotations(
150+
obj: Union[Callable[..., Any], Type[Any], ModuleType],
151+
*,
152+
globals: Optional[Mapping[str, Any]] = ...,
153+
locals: Optional[Mapping[str, Any]] = ...,
154+
eval_str: bool = ...,
155+
) -> Dict[str, Any]: ...
124156

125157
# The name is the same as the enum's name in CPython
126158
class _ParameterKind(enum.IntEnum):

0 commit comments

Comments
 (0)