Skip to content

Commit 2149572

Browse files
committed
Add proxied functions for Promise.
Although there is nothing defined in `Promise` itself, the only instances of `Promise` are created by the `lazy` function, with magic methods defined on it. https://github.com/django/django/blob/3.2.6/django/utils/functional.py#L84-L191. Signed-off-by: Zixuan James Li <[email protected]>
1 parent f3d5cd1 commit 2149572

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

django-stubs/utils/functional.pyi

+19-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,25 @@ class cached_property(Generic[_T]):
2020
@overload
2121
def __get__(self, instance: object, cls: Type[Any] = ...) -> _T: ...
2222

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

2543
_C = TypeVar("_C", bound=Callable)
2644

0 commit comments

Comments
 (0)