mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-15 08:17:08 +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 = ...
|
||||
output_transaction: 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, ...] = ...
|
||||
stealth_options: Tuple[str, ...] = ...
|
||||
stdout: OutputWrapper = ...
|
||||
|
||||
@@ -96,7 +96,9 @@ class _BaseQuerySet(Generic[_T], Sized):
|
||||
def union(self: _QS, *other_qs: Any, all: bool = ...) -> _QS: ...
|
||||
def intersection(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 prefetch_related(self: _QS, *lookups: Any) -> _QS: ...
|
||||
# TODO: return type
|
||||
|
||||
@@ -6,11 +6,14 @@ from django.views.generic.base import View
|
||||
from django.utils.functional import classproperty as classproperty
|
||||
|
||||
_T = TypeVar("_T", bound=Union[View, Callable]) # Any callable
|
||||
_CallableType = TypeVar("_CallableType", bound=Callable)
|
||||
|
||||
class classonlymethod(classmethod): ...
|
||||
|
||||
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(middleware_class: type) -> Callable: ...
|
||||
def available_attrs(fn: 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