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 2, 2022
1 parent f3d5cd1 commit 2149572
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion django-stubs/utils/functional.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,25 @@ 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]]: ...
@classmethod
def __prepare_class__(cls) -> None: ...
@classmethod
def __promise__(cls, method_name: str) -> Callable: ...
def __text_cast(self) -> str: ...
def __bytes_cast(self) -> bytes: ...
def __bytes_cast_encoded(self) -> bytes: ...
def __cast(self) -> Union[bytes, str]: ...
def __lt__(self, other: Any) -> bool: ...
def __hash__(self) -> int: ...
def __mod__(self, rhs: Any) -> str: ...
def __add__(self, other: Any) -> str: ...
def __radd__(self, other: Any) -> str: ...
def __deepcopy__(self, memo: Any): ...

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

Expand Down

0 comments on commit 2149572

Please sign in to comment.