mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-19 10:21:14 +08:00
Implement @cached_property attribute inference (#292)
This commit is contained in:
committed by
Maksim Kurnikov
parent
7ba578f6b2
commit
6f296b0a91
@@ -1,16 +1,21 @@
|
||||
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
|
||||
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union, TypeVar, Generic, overload
|
||||
from functools import wraps as wraps # noqa: F401
|
||||
|
||||
from django.db.models.base import Model
|
||||
|
||||
def curry(_curried_func: Any, *args: Any, **kwargs: Any): ...
|
||||
|
||||
class cached_property:
|
||||
func: Callable = ...
|
||||
_T = TypeVar("_T")
|
||||
|
||||
class cached_property(Generic[_T]):
|
||||
func: Callable[..., _T] = ...
|
||||
__doc__: Any = ...
|
||||
name: str = ...
|
||||
def __init__(self, func: Callable, name: Optional[str] = ...) -> None: ...
|
||||
def __get__(self, instance: Any, cls: Type[Any] = ...) -> Any: ...
|
||||
def __init__(self, func: Callable[..., _T], name: Optional[str] = ...): ...
|
||||
@overload
|
||||
def __get__(self, instance: None, cls: Type[Any] = ...) -> "cached_property[_T]": ...
|
||||
@overload
|
||||
def __get__(self, instance: object, cls: Type[Any] = ...) -> _T: ...
|
||||
|
||||
class Promise: ...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user