mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-11 22:41:55 +08:00
add django 3.1 classproperty
This commit is contained in:
@@ -3,6 +3,8 @@ from typing import Any, Callable, Iterable, Optional, Type, Union, TypeVar
|
|||||||
from django.utils.deprecation import MiddlewareMixin
|
from django.utils.deprecation import MiddlewareMixin
|
||||||
from django.views.generic.base import View
|
from django.views.generic.base import View
|
||||||
|
|
||||||
|
from django.utils.functional import classproperty as classproperty
|
||||||
|
|
||||||
_T = TypeVar("_T", bound=Union[View, Callable]) # Any callable
|
_T = TypeVar("_T", bound=Union[View, Callable]) # Any callable
|
||||||
|
|
||||||
class classonlymethod(classmethod): ...
|
class classonlymethod(classmethod): ...
|
||||||
@@ -12,9 +14,3 @@ def decorator_from_middleware_with_args(middleware_class: type) -> Callable: ...
|
|||||||
def decorator_from_middleware(middleware_class: type) -> Callable: ...
|
def decorator_from_middleware(middleware_class: type) -> Callable: ...
|
||||||
def available_attrs(fn: Callable): ...
|
def available_attrs(fn: Callable): ...
|
||||||
def make_middleware_decorator(middleware_class: Type[MiddlewareMixin]) -> Callable: ...
|
def make_middleware_decorator(middleware_class: Type[MiddlewareMixin]) -> Callable: ...
|
||||||
|
|
||||||
class classproperty:
|
|
||||||
fget: Optional[Callable] = ...
|
|
||||||
def __init__(self, method: Optional[Callable] = ...) -> None: ...
|
|
||||||
def __get__(self, instance: Any, cls: Optional[type] = ...) -> Any: ...
|
|
||||||
def getter(self, method: Callable) -> classproperty: ...
|
|
||||||
|
|||||||
@@ -61,3 +61,9 @@ _PartitionMember = TypeVar("_PartitionMember")
|
|||||||
def partition(
|
def partition(
|
||||||
predicate: Callable, values: List[_PartitionMember]
|
predicate: Callable, values: List[_PartitionMember]
|
||||||
) -> Tuple[List[_PartitionMember], List[_PartitionMember]]: ...
|
) -> Tuple[List[_PartitionMember], List[_PartitionMember]]: ...
|
||||||
|
|
||||||
|
class classproperty:
|
||||||
|
fget: Optional[Callable] = ...
|
||||||
|
def __init__(self, method: Optional[Callable] = ...) -> None: ...
|
||||||
|
def __get__(self, instance: Any, cls: Optional[type] = ...) -> Any: ...
|
||||||
|
def getter(self, method: Callable) -> classproperty: ...
|
||||||
|
|||||||
Reference in New Issue
Block a user