mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-27 05:12:10 +08:00
stdlib: add argument default values (#9501)
This commit is contained in:
@@ -165,10 +165,10 @@ modulesbyfile: dict[str, Any]
|
||||
_GetMembersPredicate: TypeAlias = Callable[[Any], bool]
|
||||
_GetMembersReturn: TypeAlias = list[tuple[str, Any]]
|
||||
|
||||
def getmembers(object: object, predicate: _GetMembersPredicate | None = ...) -> _GetMembersReturn: ...
|
||||
def getmembers(object: object, predicate: _GetMembersPredicate | None = None) -> _GetMembersReturn: ...
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
def getmembers_static(object: object, predicate: _GetMembersPredicate | None = ...) -> _GetMembersReturn: ...
|
||||
def getmembers_static(object: object, predicate: _GetMembersPredicate | None = None) -> _GetMembersReturn: ...
|
||||
|
||||
def getmodulename(path: str) -> str | None: ...
|
||||
def ismodule(object: object) -> TypeGuard[ModuleType]: ...
|
||||
@@ -269,12 +269,12 @@ _SourceObjectType: TypeAlias = Union[
|
||||
]
|
||||
|
||||
def findsource(object: _SourceObjectType) -> tuple[list[str], int]: ...
|
||||
def getabsfile(object: _SourceObjectType, _filename: str | None = ...) -> str: ...
|
||||
def getabsfile(object: _SourceObjectType, _filename: str | None = None) -> str: ...
|
||||
def getblock(lines: Sequence[str]) -> Sequence[str]: ...
|
||||
def getdoc(object: object) -> str | None: ...
|
||||
def getcomments(object: object) -> str | None: ...
|
||||
def getfile(object: _SourceObjectType) -> str: ...
|
||||
def getmodule(object: object, _filename: str | None = ...) -> ModuleType | None: ...
|
||||
def getmodule(object: object, _filename: str | None = None) -> ModuleType | None: ...
|
||||
def getsourcefile(object: _SourceObjectType) -> str | None: ...
|
||||
def getsourcelines(object: _SourceObjectType) -> tuple[list[str], int]: ...
|
||||
def getsource(object: _SourceObjectType) -> str: ...
|
||||
@@ -290,10 +290,10 @@ if sys.version_info >= (3, 10):
|
||||
def signature(
|
||||
obj: _IntrospectableCallable,
|
||||
*,
|
||||
follow_wrapped: bool = ...,
|
||||
globals: Mapping[str, Any] | None = ...,
|
||||
locals: Mapping[str, Any] | None = ...,
|
||||
eval_str: bool = ...,
|
||||
follow_wrapped: bool = True,
|
||||
globals: Mapping[str, Any] | None = None,
|
||||
locals: Mapping[str, Any] | None = None,
|
||||
eval_str: bool = False,
|
||||
) -> Signature: ...
|
||||
|
||||
else:
|
||||
@@ -304,7 +304,7 @@ class _empty: ...
|
||||
|
||||
class Signature:
|
||||
def __init__(
|
||||
self, parameters: Sequence[Parameter] | None = ..., *, return_annotation: Any = ..., __validate_parameters__: bool = ...
|
||||
self, parameters: Sequence[Parameter] | None = None, *, return_annotation: Any = ..., __validate_parameters__: bool = True
|
||||
) -> None: ...
|
||||
empty = _empty
|
||||
@property
|
||||
@@ -322,10 +322,10 @@ class Signature:
|
||||
cls: type[Self],
|
||||
obj: _IntrospectableCallable,
|
||||
*,
|
||||
follow_wrapped: bool = ...,
|
||||
globals: Mapping[str, Any] | None = ...,
|
||||
locals: Mapping[str, Any] | None = ...,
|
||||
eval_str: bool = ...,
|
||||
follow_wrapped: bool = True,
|
||||
globals: Mapping[str, Any] | None = None,
|
||||
locals: Mapping[str, Any] | None = None,
|
||||
eval_str: bool = False,
|
||||
) -> Self: ...
|
||||
else:
|
||||
@classmethod
|
||||
@@ -337,9 +337,9 @@ if sys.version_info >= (3, 10):
|
||||
def get_annotations(
|
||||
obj: Callable[..., object] | type[Any] | ModuleType,
|
||||
*,
|
||||
globals: Mapping[str, Any] | None = ...,
|
||||
locals: Mapping[str, Any] | None = ...,
|
||||
eval_str: bool = ...,
|
||||
globals: Mapping[str, Any] | None = None,
|
||||
locals: Mapping[str, Any] | None = None,
|
||||
eval_str: bool = False,
|
||||
) -> dict[str, Any]: ...
|
||||
|
||||
# The name is the same as the enum's name in CPython
|
||||
@@ -400,7 +400,7 @@ class BoundArguments:
|
||||
# TODO: The actual return type should be list[_ClassTreeItem] but mypy doesn't
|
||||
# seem to be supporting this at the moment:
|
||||
# _ClassTreeItem = list[_ClassTreeItem] | Tuple[type, Tuple[type, ...]]
|
||||
def getclasstree(classes: list[type], unique: bool = ...) -> list[Any]: ...
|
||||
def getclasstree(classes: list[type], unique: bool = False) -> list[Any]: ...
|
||||
def walktree(classes: list[type], children: Mapping[type[Any], list[type]], parent: type[Any] | None) -> list[Any]: ...
|
||||
|
||||
class Arguments(NamedTuple):
|
||||
@@ -436,7 +436,7 @@ class ArgInfo(NamedTuple):
|
||||
locals: dict[str, Any]
|
||||
|
||||
def getargvalues(frame: FrameType) -> ArgInfo: ...
|
||||
def formatannotation(annotation: object, base_module: str | None = ...) -> str: ...
|
||||
def formatannotation(annotation: object, base_module: str | None = None) -> str: ...
|
||||
def formatannotationrelativeto(object: object) -> Callable[[object], str]: ...
|
||||
|
||||
if sys.version_info < (3, 11):
|
||||
@@ -476,7 +476,7 @@ class ClosureVars(NamedTuple):
|
||||
unbound: AbstractSet[str]
|
||||
|
||||
def getclosurevars(func: _IntrospectableCallable) -> ClosureVars: ...
|
||||
def unwrap(func: Callable[..., Any], *, stop: Callable[[Callable[..., Any]], Any] | None = ...) -> Any: ...
|
||||
def unwrap(func: Callable[..., Any], *, stop: Callable[[Callable[..., Any]], Any] | None = None) -> Any: ...
|
||||
|
||||
#
|
||||
# The interpreter stack
|
||||
@@ -500,7 +500,7 @@ if sys.version_info >= (3, 11):
|
||||
code_context: list[str] | None,
|
||||
index: int | None,
|
||||
*,
|
||||
positions: dis.Positions | None = ...,
|
||||
positions: dis.Positions | None = None,
|
||||
) -> Self: ...
|
||||
|
||||
class _FrameInfo(NamedTuple):
|
||||
@@ -522,7 +522,7 @@ if sys.version_info >= (3, 11):
|
||||
code_context: list[str] | None,
|
||||
index: int | None,
|
||||
*,
|
||||
positions: dis.Positions | None = ...,
|
||||
positions: dis.Positions | None = None,
|
||||
) -> Self: ...
|
||||
|
||||
else:
|
||||
@@ -541,13 +541,13 @@ else:
|
||||
code_context: list[str] | None
|
||||
index: int | None # type: ignore[assignment]
|
||||
|
||||
def getframeinfo(frame: FrameType | TracebackType, context: int = ...) -> Traceback: ...
|
||||
def getouterframes(frame: Any, context: int = ...) -> list[FrameInfo]: ...
|
||||
def getinnerframes(tb: TracebackType, context: int = ...) -> list[FrameInfo]: ...
|
||||
def getframeinfo(frame: FrameType | TracebackType, context: int = 1) -> Traceback: ...
|
||||
def getouterframes(frame: Any, context: int = 1) -> list[FrameInfo]: ...
|
||||
def getinnerframes(tb: TracebackType, context: int = 1) -> list[FrameInfo]: ...
|
||||
def getlineno(frame: FrameType) -> int: ...
|
||||
def currentframe() -> FrameType | None: ...
|
||||
def stack(context: int = ...) -> list[FrameInfo]: ...
|
||||
def trace(context: int = ...) -> list[FrameInfo]: ...
|
||||
def stack(context: int = 1) -> list[FrameInfo]: ...
|
||||
def trace(context: int = 1) -> list[FrameInfo]: ...
|
||||
|
||||
#
|
||||
# Fetching attributes statically
|
||||
|
||||
Reference in New Issue
Block a user