Skip to content

Commit

Permalink
Add proxied functions for Promise.
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
PIG208 committed Aug 8, 2022
1 parent 30ed713 commit b2dceae
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion django-stubs/utils/functional.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,16 @@ class cached_property(Generic[_T]):
@overload
def __get__(self, instance: object, cls: Type[Any] = ...) -> _T: ...

class Promise: ...
# Promise is only subclassed by a proxy class defined in the lazy function
# so it makes sense for it to have all the methods available in that proxy class
class Promise:
def __init__(self, args: Any, kw: Any) -> None: ...
def __reduce__(self) -> Tuple[Any, Tuple[Any]]: ...
def __lt__(self, other: Any) -> bool: ...
def __mod__(self, rhs: Any) -> Any: ...
def __add__(self, other: Any) -> Any: ...
def __radd__(self, other: Any) -> Any: ...
def __deepcopy__(self, memo: Any): ...

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

Expand Down

0 comments on commit b2dceae

Please sign in to comment.