mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-17 17:35:59 +08:00
Update decorators.pyi to match Django 3.1 (#576)
* Update decorators.pyi to match Django 3.1 This commit resembles the state of the file in Django 3.1. Unfortunately, this is not even compatible with Django 3.0 which misses the sync* and async* decorators. * Update decorators.pyi * Fixes lint Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
This commit is contained in:
@@ -39,7 +39,7 @@ class BaseCommand:
|
|||||||
help: str = ...
|
help: str = ...
|
||||||
output_transaction: bool = ...
|
output_transaction: bool = ...
|
||||||
requires_migrations_checks: bool = ...
|
requires_migrations_checks: bool = ...
|
||||||
requires_system_checks: Union[bool, List[Tags], Tuple[Tags, ...], str] = ...
|
requires_system_checks: Union[bool, List[Tags], Tuple[Tags, ...], str] = ...
|
||||||
base_stealth_options: Tuple[str, ...] = ...
|
base_stealth_options: Tuple[str, ...] = ...
|
||||||
stealth_options: Tuple[str, ...] = ...
|
stealth_options: Tuple[str, ...] = ...
|
||||||
stdout: OutputWrapper = ...
|
stdout: OutputWrapper = ...
|
||||||
|
|||||||
@@ -96,7 +96,9 @@ class _BaseQuerySet(Generic[_T], Sized):
|
|||||||
def union(self: _QS, *other_qs: Any, all: bool = ...) -> _QS: ...
|
def union(self: _QS, *other_qs: Any, all: bool = ...) -> _QS: ...
|
||||||
def intersection(self: _QS, *other_qs: Any) -> _QS: ...
|
def intersection(self: _QS, *other_qs: Any) -> _QS: ...
|
||||||
def difference(self: _QS, *other_qs: Any) -> _QS: ...
|
def difference(self: _QS, *other_qs: Any) -> _QS: ...
|
||||||
def select_for_update(self: _QS, nowait: bool = ..., skip_locked: bool = ..., of: Sequence[str] = ..., no_key: bool = ...) -> _QS: ...
|
def select_for_update(
|
||||||
|
self: _QS, nowait: bool = ..., skip_locked: bool = ..., of: Sequence[str] = ..., no_key: bool = ...
|
||||||
|
) -> _QS: ...
|
||||||
def select_related(self: _QS, *fields: Any) -> _QS: ...
|
def select_related(self: _QS, *fields: Any) -> _QS: ...
|
||||||
def prefetch_related(self: _QS, *lookups: Any) -> _QS: ...
|
def prefetch_related(self: _QS, *lookups: Any) -> _QS: ...
|
||||||
# TODO: return type
|
# TODO: return type
|
||||||
|
|||||||
@@ -6,11 +6,14 @@ from django.views.generic.base import View
|
|||||||
from django.utils.functional import classproperty as classproperty
|
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
|
||||||
|
_CallableType = TypeVar("_CallableType", bound=Callable)
|
||||||
|
|
||||||
class classonlymethod(classmethod): ...
|
class classonlymethod(classmethod): ...
|
||||||
|
|
||||||
def method_decorator(decorator: Union[Callable, Iterable[Callable]], name: str = ...) -> Callable[[_T], _T]: ...
|
def method_decorator(decorator: Union[Callable, Iterable[Callable]], name: str = ...) -> Callable[[_T], _T]: ...
|
||||||
def decorator_from_middleware_with_args(middleware_class: type) -> Callable: ...
|
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 make_middleware_decorator(middleware_class: Type[MiddlewareMixin]) -> Callable: ...
|
def make_middleware_decorator(middleware_class: Type[MiddlewareMixin]) -> Callable: ...
|
||||||
|
def sync_and_async_middleware(func: _CallableType) -> _CallableType: ...
|
||||||
|
def sync_only_middleware(func: _CallableType) -> _CallableType: ...
|
||||||
|
def async_only_middleware(func: _CallableType) -> _CallableType: ...
|
||||||
|
|||||||
Reference in New Issue
Block a user