1
1
import sys
2
2
from _typeshed import Self
3
+ from contextlib import _GeneratorContextManager
3
4
from typing import Any , Awaitable , Callable , Generic , Iterable , Mapping , Sequence , TypeVar , overload
4
5
from typing_extensions import Literal
5
6
@@ -75,11 +76,15 @@ class _Sentinel:
75
76
sentinel : Any
76
77
DEFAULT : Any
77
78
79
+ _ArgsKwargs = tuple [tuple [Any , ...], Mapping [str , Any ]]
80
+ _NameArgsKwargs = tuple [str , tuple [Any , ...], Mapping [str , Any ]]
81
+ _CallValue = str | tuple [Any , ...] | Mapping [str , Any ] | _ArgsKwargs | _NameArgsKwargs
82
+
78
83
class _Call (tuple [Any , ...]):
79
84
def __new__ (
80
85
cls : type [Self ],
81
- value : Any = ...,
82
- name : Any | None = ...,
86
+ value : _CallValue = ...,
87
+ name : str | None = ...,
83
88
parent : Any | None = ...,
84
89
two : bool = ...,
85
90
from_kall : bool = ...,
@@ -88,7 +93,7 @@ class _Call(tuple[Any, ...]):
88
93
parent : Any
89
94
from_kall : Any
90
95
def __init__ (
91
- self , value : Any = ..., name : Any | None = ..., parent : Any | None = ..., two : bool = ..., from_kall : bool = ...
96
+ self , value : _CallValue = ..., name : str | None = ..., parent : Any | None = ..., two : bool = ..., from_kall : bool = ...
92
97
) -> None : ...
93
98
def __eq__ (self , other : object ) -> bool : ...
94
99
def __ne__ (self , __other : object ) -> bool : ...
@@ -97,9 +102,9 @@ class _Call(tuple[Any, ...]):
97
102
def __getattribute__ (self , attr : str ) -> Any : ...
98
103
if sys .version_info >= (3 , 8 ):
99
104
@property
100
- def args (self ): ...
105
+ def args (self ) -> tuple [ Any , ...] : ...
101
106
@property
102
- def kwargs (self ): ...
107
+ def kwargs (self ) -> Mapping [ str , Any ] : ...
103
108
104
109
def call_list (self ) -> Any : ...
105
110
@@ -244,7 +249,9 @@ class _patch(Generic[_T]):
244
249
@overload
245
250
def __call__ (self , func : Callable [..., _R ]) -> Callable [..., _R ]: ...
246
251
if sys .version_info >= (3 , 8 ):
247
- def decoration_helper (self , patched , args , keywargs ): ...
252
+ def decoration_helper (
253
+ self , patched : _patch [Any ], args : Sequence [Any ], keywargs : Any
254
+ ) -> _GeneratorContextManager [tuple [Sequence [Any ], Any ]]: ...
248
255
249
256
def decorate_class (self , klass : _TT ) -> _TT : ...
250
257
def decorate_callable (self , func : Callable [..., _R ]) -> Callable [..., _R ]: ...
@@ -428,14 +435,14 @@ if sys.version_info >= (3, 8):
428
435
class AsyncMock (AsyncMockMixin , AsyncMagicMixin , Mock ): ... # type: ignore # argument disparities between base classes
429
436
430
437
class MagicProxy :
431
- name : Any
438
+ name : str
432
439
parent : Any
433
- def __init__ (self , name , parent ) -> None : ...
440
+ def __init__ (self , name : str , parent : Any ) -> None : ...
434
441
if sys .version_info < (3 , 8 ):
435
442
def __call__ (self , * args : Any , ** kwargs : Any ) -> Any : ...
436
443
437
- def create_mock (self ): ...
438
- def __get__ (self , obj , _type : Any | None = ...): ...
444
+ def create_mock (self ) -> Any : ...
445
+ def __get__ (self , obj : Any , _type : Any | None = ...) -> Any : ...
439
446
440
447
class _ANY :
441
448
def __eq__ (self , other : object ) -> Literal [True ]: ...
0 commit comments