Skip to content

Commit 7dd623b

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 <p359101898@gmail.com>
1 parent f3d5cd1 commit 7dd623b

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

django-stubs/utils/functional.pyi

+10-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,16 @@ 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+
def __lt__(self, other: Any) -> bool: ...
29+
def __mod__(self, rhs: Any) -> str: ...
30+
def __add__(self, other: Any) -> str: ...
31+
def __radd__(self, other: Any) -> str: ...
32+
def __deepcopy__(self, memo: Any): ...
2433

2534
_C = TypeVar("_C", bound=Callable)
2635

0 commit comments

Comments
 (0)