-
-
Notifications
You must be signed in to change notification settings - Fork 458
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
39 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,23 @@ | ||
from collections.abc import Callable, Iterable | ||
from typing import TypeVar | ||
from typing import Any, TypeVar | ||
|
||
from django.http.response import HttpResponseBase | ||
from django.utils.deprecation import MiddlewareMixin | ||
from django.views.generic.base import View | ||
from typing_extensions import TypeAlias | ||
|
||
_T = TypeVar("_T", bound=View | Callable) # Any callable | ||
_CallableType = TypeVar("_CallableType", bound=Callable) | ||
_ViewType = TypeVar("_ViewType", bound=View | Callable[..., Any]) # Any callable | ||
_CallableType = TypeVar("_CallableType", bound=Callable[..., Any]) | ||
_DECORATOR: TypeAlias = Callable[..., Callable[..., HttpResponseBase] | Callable[..., Callable[..., HttpResponseBase]]] | ||
|
||
classonlymethod = classmethod | ||
|
||
def method_decorator(decorator: 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 make_middleware_decorator(middleware_class: type[MiddlewareMixin]) -> Callable: ... | ||
def method_decorator( | ||
decorator: _DECORATOR | Iterable[_DECORATOR], name: str = ... | ||
) -> Callable[[_ViewType], _ViewType]: ... | ||
def decorator_from_middleware_with_args(middleware_class: type) -> _DECORATOR: ... | ||
def decorator_from_middleware(middleware_class: type) -> _DECORATOR: ... | ||
def make_middleware_decorator(middleware_class: type[MiddlewareMixin]) -> _DECORATOR: ... | ||
def sync_and_async_middleware(func: _CallableType) -> _CallableType: ... | ||
def sync_only_middleware(func: _CallableType) -> _CallableType: ... | ||
def async_only_middleware(func: _CallableType) -> _CallableType: ... |