stdlib: add argument default values (#9501)

This commit is contained in:
Jelle Zijlstra
2023-01-18 00:37:34 -08:00
committed by GitHub
parent 6cb934291f
commit ddfaca3200
272 changed files with 2529 additions and 2467 deletions

View File

@@ -70,16 +70,21 @@ class _Call(tuple[Any, ...]):
def __new__(
cls: type[Self],
value: _CallValue = ...,
name: str | None = ...,
parent: Any | None = ...,
two: bool = ...,
from_kall: bool = ...,
name: str | None = "",
parent: Any | None = None,
two: bool = False,
from_kall: bool = True,
) -> Self: ...
name: Any
parent: Any
from_kall: Any
def __init__(
self, value: _CallValue = ..., name: str | None = ..., parent: Any | None = ..., two: bool = ..., from_kall: bool = ...
self,
value: _CallValue = ...,
name: str | None = None,
parent: Any | None = None,
two: bool = False,
from_kall: bool = True,
) -> None: ...
def __eq__(self, other: object) -> bool: ...
def __ne__(self, __other: object) -> bool: ...
@@ -106,17 +111,17 @@ class NonCallableMock(Base, Any):
def __new__(__cls: type[Self], *args: Any, **kw: Any) -> Self: ...
def __init__(
self,
spec: list[str] | object | type[object] | None = ...,
wraps: Any | None = ...,
name: str | None = ...,
spec_set: list[str] | object | type[object] | None = ...,
parent: NonCallableMock | None = ...,
_spec_state: Any | None = ...,
_new_name: str = ...,
_new_parent: NonCallableMock | None = ...,
_spec_as_instance: bool = ...,
_eat_self: bool | None = ...,
unsafe: bool = ...,
spec: list[str] | object | type[object] | None = None,
wraps: Any | None = None,
name: str | None = None,
spec_set: list[str] | object | type[object] | None = None,
parent: NonCallableMock | None = None,
_spec_state: Any | None = None,
_new_name: str = "",
_new_parent: NonCallableMock | None = None,
_spec_as_instance: bool = False,
_eat_self: bool | None = None,
unsafe: bool = False,
**kwargs: Any,
) -> None: ...
def __getattr__(self, name: str) -> Any: ...
@@ -124,11 +129,11 @@ class NonCallableMock(Base, Any):
def __setattr__(self, name: str, value: Any) -> None: ...
def __dir__(self) -> list[str]: ...
if sys.version_info >= (3, 8):
def _calls_repr(self, prefix: str = ...) -> str: ...
def _calls_repr(self, prefix: str = "Calls") -> str: ...
def assert_called_with(self, *args: Any, **kwargs: Any) -> None: ...
def assert_not_called(self) -> None: ...
def assert_called_once_with(self, *args: Any, **kwargs: Any) -> None: ...
def _format_mock_failure_message(self, args: Any, kwargs: Any, action: str = ...) -> str: ...
def _format_mock_failure_message(self, args: Any, kwargs: Any, action: str = "call") -> str: ...
else:
def assert_called_with(_mock_self, *args: Any, **kwargs: Any) -> None: ...
def assert_not_called(_mock_self) -> None: ...
@@ -141,13 +146,13 @@ class NonCallableMock(Base, Any):
def assert_called(_mock_self) -> None: ...
def assert_called_once(_mock_self) -> None: ...
def reset_mock(self, visited: Any = ..., *, return_value: bool = ..., side_effect: bool = ...) -> None: ...
def reset_mock(self, visited: Any = None, *, return_value: bool = False, side_effect: bool = False) -> None: ...
def _extract_mock_name(self) -> str: ...
def _get_call_signature_from_name(self, name: str) -> Any: ...
def assert_any_call(self, *args: Any, **kwargs: Any) -> None: ...
def assert_has_calls(self, calls: Sequence[_Call], any_order: bool = ...) -> None: ...
def mock_add_spec(self, spec: Any, spec_set: bool = ...) -> None: ...
def _mock_add_spec(self, spec: Any, spec_set: bool, _spec_as_instance: bool = ..., _eat_self: bool = ...) -> None: ...
def assert_has_calls(self, calls: Sequence[_Call], any_order: bool = False) -> None: ...
def mock_add_spec(self, spec: Any, spec_set: bool = False) -> None: ...
def _mock_add_spec(self, spec: Any, spec_set: bool, _spec_as_instance: bool = False, _eat_self: bool = False) -> None: ...
def attach_mock(self, mock: NonCallableMock, attribute: str) -> None: ...
def configure_mock(self, **kwargs: Any) -> None: ...
return_value: Any
@@ -165,16 +170,16 @@ class CallableMixin(Base):
side_effect: Any
def __init__(
self,
spec: Any | None = ...,
side_effect: Any | None = ...,
spec: Any | None = None,
side_effect: Any | None = None,
return_value: Any = ...,
wraps: Any | None = ...,
name: Any | None = ...,
spec_set: Any | None = ...,
parent: Any | None = ...,
_spec_state: Any | None = ...,
_new_name: Any = ...,
_new_parent: Any | None = ...,
wraps: Any | None = None,
name: Any | None = None,
spec_set: Any | None = None,
parent: Any | None = None,
_spec_state: Any | None = None,
_new_name: Any = "",
_new_parent: Any | None = None,
**kwargs: Any,
) -> None: ...
if sys.version_info >= (3, 8):
@@ -212,7 +217,7 @@ class _patch(Generic[_T]):
new_callable: Any | None,
kwargs: Mapping[str, Any],
*,
unsafe: bool = ...,
unsafe: bool = False,
) -> None: ...
else:
def __init__(
@@ -258,7 +263,7 @@ class _patch_dict:
in_dict: Any
values: Any
clear: Any
def __init__(self, in_dict: Any, values: Any = ..., clear: Any = ..., **kwargs: Any) -> None: ...
def __init__(self, in_dict: Any, values: Any = ..., clear: Any = False, **kwargs: Any) -> None: ...
def __call__(self, f: Any) -> Any: ...
if sys.version_info >= (3, 10):
def decorate_callable(self, f: _F) -> _F: ...
@@ -361,7 +366,7 @@ if sys.version_info >= (3, 8):
def assert_awaited_with(self, *args: Any, **kwargs: Any) -> None: ...
def assert_awaited_once_with(self, *args: Any, **kwargs: Any) -> None: ...
def assert_any_await(self, *args: Any, **kwargs: Any) -> None: ...
def assert_has_awaits(self, calls: Iterable[_Call], any_order: bool = ...) -> None: ...
def assert_has_awaits(self, calls: Iterable[_Call], any_order: bool = False) -> None: ...
def assert_not_awaited(self) -> None: ...
def reset_mock(self, *args: Any, **kwargs: Any) -> None: ...
await_count: int
@@ -381,7 +386,7 @@ class MagicProxy:
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
def create_mock(self) -> Any: ...
def __get__(self, obj: Any, _type: Any | None = ...) -> Any: ...
def __get__(self, obj: Any, _type: Any | None = None) -> Any: ...
class _ANY:
def __eq__(self, other: object) -> Literal[True]: ...
@@ -392,12 +397,12 @@ ANY: Any
if sys.version_info >= (3, 10):
def create_autospec(
spec: Any,
spec_set: Any = ...,
instance: Any = ...,
_parent: Any | None = ...,
_name: Any | None = ...,
spec_set: Any = False,
instance: Any = False,
_parent: Any | None = None,
_name: Any | None = None,
*,
unsafe: bool = ...,
unsafe: bool = False,
**kwargs: Any,
) -> Any: ...
@@ -416,18 +421,18 @@ class _SpecState:
def __init__(
self,
spec: Any,
spec_set: Any = ...,
parent: Any | None = ...,
name: Any | None = ...,
ids: Any | None = ...,
instance: Any = ...,
spec_set: Any = False,
parent: Any | None = None,
name: Any | None = None,
ids: Any | None = None,
instance: Any = False,
) -> None: ...
def mock_open(mock: Any | None = ..., read_data: Any = ...) -> Any: ...
def mock_open(mock: Any | None = None, read_data: Any = "") -> Any: ...
class PropertyMock(Mock):
if sys.version_info >= (3, 8):
def __get__(self: Self, obj: _T, obj_type: type[_T] | None = ...) -> Self: ...
def __get__(self: Self, obj: _T, obj_type: type[_T] | None = None) -> Self: ...
else:
def __get__(self: Self, obj: _T, obj_type: type[_T] | None) -> Self: ...