Skip to content

Commit facb1fa

Browse files
committed
Add proxied functions for Promise.
Signed-off-by: Zixuan James Li <[email protected]>
1 parent 37a6a0a commit facb1fa

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

django-stubs/utils/functional.pyi

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,26 @@ class cached_property(Generic[_T]):
1717
@overload
1818
def __get__(self, instance: object, cls: Type[Any] = ...) -> _T: ...
1919

20-
class Promise: ...
20+
# Promise is only subclassed by a proxy class defined in the lazy function
21+
# so it makes sense for it to have all the methods available in that proxy class
22+
class Promise:
23+
def __init__(self, args: Any, kw: Any) -> None: ...
24+
def __reduce__(self) -> Tuple[Any, Tuple[Any]]: ...
25+
@classmethod
26+
def __prepare_class__(cls) -> None: ...
27+
def __promise__(cls, method_name: str) -> Any: ...
28+
def __text_cast(self) -> str: ...
29+
def __bytes_cast(self) -> bytes: ...
30+
def __bytes_cast_encoded(self) -> bytes: ...
31+
def __cast(self) -> Union[bytes, str]: ...
32+
def __lt__(self, other: Any) -> bool: ...
33+
def __hash__(self) -> int: ...
34+
def __mod__(self, rhs: Any) -> str: ...
35+
def __add__(self, other: Any) -> str: ...
36+
def __radd__(self, other: Any) -> str: ...
37+
def __deepcopy__(self, memo: Any): ...
2138

22-
def lazy(func: Union[Callable, Type[str]], *resultclasses: Any) -> Callable: ...
39+
def lazy(func: Union[Callable, Type[str]], *resultclasses: Any) -> Callable[..., Promise]: ...
2340
def lazystr(text: Any): ...
2441
def keep_lazy(*resultclasses: Any) -> Callable: ...
2542
def keep_lazy_text(func: Callable) -> Callable: ...

0 commit comments

Comments
 (0)