mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-24 04:41:31 +08:00
third iteration of stubs
This commit is contained in:
@@ -6,7 +6,7 @@ class BaseEngine:
|
||||
dirs: Any = ...
|
||||
app_dirs: Any = ...
|
||||
def __init__(
|
||||
self, params: Dict[str, Union[str, List[str], bool, List[Any]]]
|
||||
self, params: Dict[str, Union[List[str], bool, str]]
|
||||
) -> None: ...
|
||||
@property
|
||||
def app_dirname(self) -> None: ...
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -14,7 +14,7 @@ class TemplateStrings(BaseEngine):
|
||||
template_dirs: Tuple[str]
|
||||
app_dirname: str = ...
|
||||
def __init__(
|
||||
self, params: Dict[str, Union[List[Any], bool, str, Dict[Any, Any]]]
|
||||
self, params: Dict[str, Union[Dict[Any, Any], List[Any], bool, str]]
|
||||
) -> None: ...
|
||||
def from_string(self, template_code: str) -> Template: ...
|
||||
def get_template(self, template_name: str) -> Template: ...
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
from datetime import time
|
||||
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
|
||||
|
||||
from jinja2.environment import Template
|
||||
from jinja2.exceptions import TemplateSyntaxError
|
||||
|
||||
from django.http.request import HttpRequest
|
||||
from django.views.generic.base import TemplateView
|
||||
|
||||
from .base import BaseEngine
|
||||
|
||||
@@ -17,7 +19,12 @@ class Jinja2(BaseEngine):
|
||||
app_dirname: str = ...
|
||||
context_processors: List[str] = ...
|
||||
env: jinja2.environment.Environment = ...
|
||||
def __init__(self, params: Dict[str, Any]) -> None: ...
|
||||
def __init__(
|
||||
self,
|
||||
params: Dict[
|
||||
str, Union[Dict[str, Union[List[str], bool]], List[str], bool, str]
|
||||
],
|
||||
) -> None: ...
|
||||
def from_string(self, template_code: str) -> Template: ...
|
||||
def get_template(self, template_name: str) -> Template: ...
|
||||
def template_context_processors(self) -> List[Callable]: ...
|
||||
@@ -28,7 +35,610 @@ class Template:
|
||||
origin: django.template.backends.jinja2.Origin = ...
|
||||
def __init__(self, template: Template, backend: Jinja2) -> None: ...
|
||||
def render(
|
||||
self, context: Any = ..., request: Optional[HttpRequest] = ...
|
||||
self,
|
||||
context: Optional[
|
||||
Union[
|
||||
Dict[
|
||||
str,
|
||||
Dict[
|
||||
str,
|
||||
Optional[
|
||||
Union[
|
||||
Dict[str, int],
|
||||
List[
|
||||
Tuple[
|
||||
None,
|
||||
List[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[Any, Any],
|
||||
time,
|
||||
int,
|
||||
str,
|
||||
],
|
||||
]
|
||||
],
|
||||
int,
|
||||
]
|
||||
],
|
||||
bool,
|
||||
str,
|
||||
]
|
||||
],
|
||||
],
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
Dict[
|
||||
str,
|
||||
Optional[
|
||||
Union[
|
||||
Dict[str, str],
|
||||
List[
|
||||
Dict[
|
||||
str,
|
||||
Optional[
|
||||
Union[Dict[Any, Any], bool, str]
|
||||
],
|
||||
]
|
||||
],
|
||||
bool,
|
||||
str,
|
||||
]
|
||||
],
|
||||
],
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[Any, Any],
|
||||
List[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[Any, Any],
|
||||
List[
|
||||
Union[
|
||||
Tuple[
|
||||
None,
|
||||
List[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[Any, Any],
|
||||
bool,
|
||||
str,
|
||||
],
|
||||
]
|
||||
],
|
||||
int,
|
||||
],
|
||||
Tuple[
|
||||
None,
|
||||
List[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, bool],
|
||||
bool,
|
||||
str,
|
||||
],
|
||||
]
|
||||
],
|
||||
int,
|
||||
],
|
||||
]
|
||||
],
|
||||
List[str],
|
||||
bool,
|
||||
str,
|
||||
],
|
||||
]
|
||||
],
|
||||
List[str],
|
||||
bool,
|
||||
str,
|
||||
],
|
||||
],
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[Any, Any],
|
||||
List[
|
||||
Tuple[
|
||||
None,
|
||||
List[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[Any, Any], bool, time, str
|
||||
],
|
||||
]
|
||||
],
|
||||
int,
|
||||
]
|
||||
],
|
||||
List[str],
|
||||
bool,
|
||||
str,
|
||||
],
|
||||
],
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[Any, Any],
|
||||
List[
|
||||
Union[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[Any, Any],
|
||||
List[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[Any, Any],
|
||||
bool,
|
||||
str,
|
||||
],
|
||||
]
|
||||
],
|
||||
bool,
|
||||
str,
|
||||
],
|
||||
],
|
||||
Dict[str, Union[Dict[Any, Any], bool, str]],
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, bool],
|
||||
List[
|
||||
Union[
|
||||
Tuple[
|
||||
None,
|
||||
List[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[
|
||||
Any, Any
|
||||
],
|
||||
bool,
|
||||
str,
|
||||
],
|
||||
]
|
||||
],
|
||||
int,
|
||||
],
|
||||
Tuple[
|
||||
None,
|
||||
List[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[
|
||||
str,
|
||||
bool,
|
||||
],
|
||||
bool,
|
||||
str,
|
||||
],
|
||||
]
|
||||
],
|
||||
int,
|
||||
],
|
||||
]
|
||||
],
|
||||
List[str],
|
||||
bool,
|
||||
str,
|
||||
],
|
||||
],
|
||||
]
|
||||
],
|
||||
bool,
|
||||
str,
|
||||
],
|
||||
],
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[Any, Any],
|
||||
List[
|
||||
Union[
|
||||
Tuple[
|
||||
None,
|
||||
List[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[Any, Any], bool, str
|
||||
],
|
||||
]
|
||||
],
|
||||
int,
|
||||
],
|
||||
Tuple[
|
||||
str,
|
||||
List[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[Any, Any], bool, str
|
||||
],
|
||||
]
|
||||
],
|
||||
int,
|
||||
],
|
||||
]
|
||||
],
|
||||
List[str],
|
||||
bool,
|
||||
str,
|
||||
],
|
||||
],
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[Any, Any],
|
||||
List[
|
||||
Union[
|
||||
Tuple[
|
||||
None,
|
||||
List[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[Any, Any], bool, str
|
||||
],
|
||||
]
|
||||
],
|
||||
int,
|
||||
],
|
||||
Tuple[
|
||||
str,
|
||||
List[
|
||||
Union[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[Any, Any],
|
||||
bool,
|
||||
str,
|
||||
],
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, bool],
|
||||
bool,
|
||||
str,
|
||||
],
|
||||
],
|
||||
]
|
||||
],
|
||||
int,
|
||||
],
|
||||
]
|
||||
],
|
||||
List[str],
|
||||
bool,
|
||||
str,
|
||||
],
|
||||
],
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[Any, Any],
|
||||
List[
|
||||
Union[
|
||||
Tuple[
|
||||
None,
|
||||
List[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, bool], bool, str
|
||||
],
|
||||
]
|
||||
],
|
||||
int,
|
||||
],
|
||||
Tuple[
|
||||
str,
|
||||
List[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[Any, Any], bool, str
|
||||
],
|
||||
]
|
||||
],
|
||||
int,
|
||||
],
|
||||
]
|
||||
],
|
||||
List[str],
|
||||
bool,
|
||||
str,
|
||||
],
|
||||
],
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, bool],
|
||||
List[
|
||||
Union[
|
||||
Tuple[
|
||||
None,
|
||||
List[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[Any, Any], bool, str
|
||||
],
|
||||
]
|
||||
],
|
||||
int,
|
||||
],
|
||||
Tuple[
|
||||
None,
|
||||
List[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, bool], bool, str
|
||||
],
|
||||
]
|
||||
],
|
||||
int,
|
||||
],
|
||||
]
|
||||
],
|
||||
List[str],
|
||||
bool,
|
||||
str,
|
||||
],
|
||||
],
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, bool],
|
||||
List[
|
||||
Union[
|
||||
Tuple[
|
||||
None,
|
||||
List[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, bool], bool, str
|
||||
],
|
||||
]
|
||||
],
|
||||
int,
|
||||
],
|
||||
Tuple[
|
||||
str,
|
||||
List[
|
||||
Union[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[Any, Any],
|
||||
bool,
|
||||
str,
|
||||
],
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, bool],
|
||||
bool,
|
||||
str,
|
||||
],
|
||||
],
|
||||
]
|
||||
],
|
||||
int,
|
||||
],
|
||||
]
|
||||
],
|
||||
List[str],
|
||||
bool,
|
||||
str,
|
||||
],
|
||||
],
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, str],
|
||||
List[Dict[str, Union[Dict[str, str], bool, str]]],
|
||||
List[str],
|
||||
bool,
|
||||
str,
|
||||
],
|
||||
],
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, str],
|
||||
List[
|
||||
Union[
|
||||
Tuple[
|
||||
None,
|
||||
List[
|
||||
Dict[
|
||||
str,
|
||||
Union[Dict[Any, Any], int, str],
|
||||
]
|
||||
],
|
||||
int,
|
||||
],
|
||||
Tuple[
|
||||
None,
|
||||
List[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, bool], int, str
|
||||
],
|
||||
]
|
||||
],
|
||||
int,
|
||||
],
|
||||
]
|
||||
],
|
||||
List[str],
|
||||
bool,
|
||||
str,
|
||||
],
|
||||
],
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, str],
|
||||
List[
|
||||
Union[
|
||||
Tuple[
|
||||
None,
|
||||
List[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, Union[bool, str]],
|
||||
bool,
|
||||
str,
|
||||
],
|
||||
]
|
||||
],
|
||||
int,
|
||||
],
|
||||
Tuple[
|
||||
None,
|
||||
List[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, str], bool, str
|
||||
],
|
||||
]
|
||||
],
|
||||
int,
|
||||
],
|
||||
]
|
||||
],
|
||||
List[str],
|
||||
bool,
|
||||
str,
|
||||
],
|
||||
],
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, str],
|
||||
List[
|
||||
Union[
|
||||
Tuple[
|
||||
None,
|
||||
List[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, str], bool, str
|
||||
],
|
||||
]
|
||||
],
|
||||
int,
|
||||
],
|
||||
Tuple[
|
||||
str,
|
||||
List[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, str], bool, str
|
||||
],
|
||||
]
|
||||
],
|
||||
int,
|
||||
],
|
||||
Tuple[
|
||||
str,
|
||||
List[
|
||||
Union[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[
|
||||
str,
|
||||
Union[bool, str],
|
||||
],
|
||||
bool,
|
||||
str,
|
||||
],
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, str],
|
||||
bool,
|
||||
str,
|
||||
],
|
||||
],
|
||||
]
|
||||
],
|
||||
int,
|
||||
],
|
||||
]
|
||||
],
|
||||
List[str],
|
||||
bool,
|
||||
str,
|
||||
],
|
||||
],
|
||||
],
|
||||
Dict[str, TemplateView],
|
||||
Dict[str, str],
|
||||
]
|
||||
] = ...,
|
||||
request: Optional[HttpRequest] = ...,
|
||||
) -> str: ...
|
||||
|
||||
class Origin:
|
||||
@@ -38,4 +648,4 @@ class Origin:
|
||||
|
||||
def get_exception_info(
|
||||
exception: TemplateSyntaxError
|
||||
) -> Dict[str, Union[str, List[Tuple[int, str]], int]]: ...
|
||||
) -> Dict[str, Union[List[Tuple[int, str]], int, str]]: ...
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -6,10 +6,10 @@ from django.utils.functional import SimpleLazyObject
|
||||
|
||||
|
||||
def csrf(request: HttpRequest) -> Dict[str, SimpleLazyObject]: ...
|
||||
def debug(request: HttpRequest) -> Dict[str, Union[bool, Callable]]: ...
|
||||
def debug(request: HttpRequest) -> Dict[str, Union[Callable, bool]]: ...
|
||||
def i18n(
|
||||
request: WSGIRequest
|
||||
) -> Dict[str, Union[List[Tuple[str, str]], str, bool]]: ...
|
||||
) -> Dict[str, Union[List[Tuple[str, str]], bool, str]]: ...
|
||||
def tz(request: HttpRequest) -> Dict[str, str]: ...
|
||||
def static(request: HttpRequest) -> Dict[str, str]: ...
|
||||
def media(request: Any): ...
|
||||
|
||||
@@ -1,8 +1,46 @@
|
||||
from datetime import date, time, timedelta
|
||||
from datetime import date, datetime, time, timedelta
|
||||
from decimal import Decimal
|
||||
from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union
|
||||
from io import BytesIO
|
||||
from sqlite3 import OperationalError
|
||||
from typing import (Any, Callable, Dict, Iterator, List, Optional, Tuple, Type,
|
||||
Union)
|
||||
|
||||
from django.contrib.admin.helpers import AdminErrorList
|
||||
from django.contrib.admin.options import ModelAdmin
|
||||
from django.contrib.admin.templatetags.admin_list import ResultList
|
||||
from django.contrib.admin.templatetags.base import InclusionAdminNode
|
||||
from django.contrib.admin.views.main import ChangeList
|
||||
from django.contrib.auth.views import LoginView
|
||||
from django.core.files.uploadedfile import InMemoryUploadedFile
|
||||
from django.core.files.uploadhandler import FileUploadHandler
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.db.backends.sqlite3.base import (DatabaseWrapper,
|
||||
SQLiteCursorWrapper)
|
||||
from django.db.backends.utils import CursorWrapper
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.options import Options
|
||||
from django.db.models.query import QuerySet
|
||||
from django.db.utils import OperationalError
|
||||
from django.http.multipartparser import LazyStream, MultiPartParser
|
||||
from django.http.response import HttpResponse
|
||||
from django.template.backends.django import DjangoTemplates, Template
|
||||
from django.template.base import Node, Template
|
||||
from django.template.context import RequestContext
|
||||
from django.template.exceptions import TemplateDoesNotExist
|
||||
from django.template.loader_tags import BlockContext, BlockNode
|
||||
from django.test.client import FakePayload, RequestFactory
|
||||
from django.urls.resolvers import ResolverMatch, URLResolver
|
||||
from django.utils.datastructures import MultiValueDict
|
||||
from django.utils.feedgenerator import Enclosure, Rss201rev2Feed
|
||||
from django.utils.functional import cached_property
|
||||
from django.utils.safestring import SafeText
|
||||
from django.utils.xmlutils import SimplerXMLGenerator
|
||||
from django.views.debug import CallableSettingWrapper, ExceptionReporter
|
||||
from django.views.generic.base import TemplateResponseMixin, TemplateView
|
||||
from django.views.generic.dates import BaseDateDetailView
|
||||
from django.views.generic.detail import DetailView
|
||||
from django.views.generic.edit import DeleteView, ModelFormMixin
|
||||
from django.views.generic.list import MultipleObjectTemplateResponseMixin
|
||||
|
||||
from .base import Variable, VariableDoesNotExist
|
||||
from .library import Library
|
||||
@@ -15,7 +53,7 @@ def capfirst(value: str) -> str: ...
|
||||
def escapejs_filter(value: str) -> SafeText: ...
|
||||
def json_script(value: Dict[str, str], element_id: SafeText) -> SafeText: ...
|
||||
def floatformat(
|
||||
text: Optional[Union[Decimal, float, str]], arg: Union[str, int] = ...
|
||||
text: Optional[Union[Decimal, float, int, str]], arg: Union[int, str] = ...
|
||||
) -> str: ...
|
||||
def iriencode(value: str) -> str: ...
|
||||
def linenumbers(value: str, autoescape: bool = ...) -> SafeText: ...
|
||||
@@ -25,9 +63,9 @@ def slugify(value: str) -> SafeText: ...
|
||||
def stringformat(value: Any, arg: str) -> str: ...
|
||||
def title(value: str) -> str: ...
|
||||
def truncatechars(value: str, arg: Union[SafeText, int]) -> str: ...
|
||||
def truncatechars_html(value: str, arg: Union[str, int]) -> str: ...
|
||||
def truncatewords(value: str, arg: Union[str, int]) -> str: ...
|
||||
def truncatewords_html(value: str, arg: Union[str, int]) -> str: ...
|
||||
def truncatechars_html(value: str, arg: Union[int, str]) -> str: ...
|
||||
def truncatewords(value: str, arg: Union[int, str]) -> str: ...
|
||||
def truncatewords_html(value: str, arg: Union[int, str]) -> str: ...
|
||||
def upper(value: str) -> str: ...
|
||||
def urlencode(value: str, safe: Optional[SafeText] = ...) -> str: ...
|
||||
def urlize(value: str, autoescape: bool = ...) -> SafeText: ...
|
||||
@@ -48,43 +86,79 @@ def safe(value: str) -> SafeText: ...
|
||||
def safeseq(value: List[str]) -> List[SafeText]: ...
|
||||
def striptags(value: str) -> str: ...
|
||||
def dictsort(
|
||||
value: Any, arg: Union[str, int]
|
||||
value: Union[
|
||||
Dict[str, int],
|
||||
List[Dict[str, Dict[str, Union[int, str]]]],
|
||||
List[Dict[str, Union[int, str]]],
|
||||
List[Tuple[str, str]],
|
||||
List[int],
|
||||
int,
|
||||
str,
|
||||
],
|
||||
arg: Union[int, str],
|
||||
) -> Union[
|
||||
List[Tuple[str, str]],
|
||||
List[Dict[str, Union[int, str]]],
|
||||
str,
|
||||
List[Dict[str, Dict[str, Union[int, str]]]],
|
||||
List[Dict[str, Union[int, str]]],
|
||||
List[Tuple[str, str]],
|
||||
str,
|
||||
]: ...
|
||||
def dictsortreversed(
|
||||
value: Any, arg: Union[str, int]
|
||||
) -> Union[str, List[Tuple[str, str]], List[Dict[str, Union[int, str]]]]: ...
|
||||
def first(value: Union[str, List[int], List[str]]) -> Union[str, int]: ...
|
||||
value: Union[
|
||||
Dict[str, int],
|
||||
List[Dict[str, Union[int, str]]],
|
||||
List[Tuple[str, str]],
|
||||
List[int],
|
||||
int,
|
||||
str,
|
||||
],
|
||||
arg: Union[int, str],
|
||||
) -> Union[List[Dict[str, Union[int, str]]], List[Tuple[str, str]], str]: ...
|
||||
def first(value: Union[List[int], List[str], str]) -> Union[int, str]: ...
|
||||
def join(value: Any, arg: str, autoescape: bool = ...) -> Any: ...
|
||||
def last(value: List[str]) -> str: ...
|
||||
def length(value: Any) -> int: ...
|
||||
def length_is(value: Any, arg: Union[SafeText, int]) -> Union[bool, str]: ...
|
||||
def length(
|
||||
value: Optional[
|
||||
Union[
|
||||
List[Optional[Union[Dict[Any, Any], int, str]]],
|
||||
AdminErrorList,
|
||||
QuerySet,
|
||||
int,
|
||||
str,
|
||||
]
|
||||
]
|
||||
) -> int: ...
|
||||
def length_is(
|
||||
value: Optional[
|
||||
Union[
|
||||
List[Callable],
|
||||
List[Optional[Union[Dict[Any, Any], int, str]]],
|
||||
Tuple[str, str],
|
||||
int,
|
||||
str,
|
||||
]
|
||||
],
|
||||
arg: Union[SafeText, int],
|
||||
) -> Union[bool, str]: ...
|
||||
def random(value: List[str]) -> str: ...
|
||||
def slice_filter(value: Any, arg: str) -> Any: ...
|
||||
def unordered_list(
|
||||
value: Union[
|
||||
List[Union[List[str], str]],
|
||||
List[Union[str, List[SafeText]]],
|
||||
Iterator[Any],
|
||||
List[Union[str, List[Union[List[str], str]]]],
|
||||
List[Union[str, List[Union[str, List[Union[List[str], str]]]]]],
|
||||
List[Union[List[Union[List[Union[List[str], str]], str]], str]],
|
||||
List[Union[List[Union[List[str], str]], str]],
|
||||
],
|
||||
autoescape: bool = ...,
|
||||
) -> SafeText: ...
|
||||
def add(
|
||||
value: Union[List[int], int, str, date, Tuple[int, int]],
|
||||
arg: Union[List[int], int, timedelta, str, Tuple[int, int]],
|
||||
) -> Union[List[int], int, str, date, Tuple[int, int, int, int]]: ...
|
||||
def get_digit(value: Union[str, int], arg: int) -> Union[str, int]: ...
|
||||
value: Union[List[int], Tuple[int, int], date, int, str],
|
||||
arg: Union[List[int], Tuple[int, int], timedelta, int, str],
|
||||
) -> Union[List[int], Tuple[int, int, int, int], date, int, str]: ...
|
||||
def get_digit(value: Union[int, str], arg: int) -> Union[int, str]: ...
|
||||
def date(
|
||||
value: Optional[Union[time, str, date]], arg: Optional[str] = ...
|
||||
value: Optional[Union[date, time, str]], arg: Optional[str] = ...
|
||||
) -> str: ...
|
||||
def time(
|
||||
value: Optional[Union[time, str, date]], arg: Optional[str] = ...
|
||||
value: Optional[Union[date, time, str]], arg: Optional[str] = ...
|
||||
) -> str: ...
|
||||
def timesince_filter(
|
||||
value: Optional[date], arg: Optional[date] = ...
|
||||
@@ -93,16 +167,130 @@ def timeuntil_filter(
|
||||
value: Optional[date], arg: Optional[date] = ...
|
||||
) -> str: ...
|
||||
def default(
|
||||
value: Optional[Union[str, int]], arg: Union[str, int]
|
||||
) -> Union[str, int]: ...
|
||||
value: Optional[Union[int, str]], arg: Union[int, str]
|
||||
) -> Union[int, str]: ...
|
||||
def default_if_none(
|
||||
value: Optional[str], arg: Union[str, int]
|
||||
) -> Union[str, int]: ...
|
||||
value: Optional[str], arg: Union[int, str]
|
||||
) -> Union[int, str]: ...
|
||||
def divisibleby(value: int, arg: int) -> bool: ...
|
||||
def yesno(
|
||||
value: Optional[int], arg: Optional[str] = ...
|
||||
) -> Optional[Union[str, bool]]: ...
|
||||
def filesizeformat(bytes_: Union[str, complex, int]) -> str: ...
|
||||
) -> Optional[Union[bool, str]]: ...
|
||||
def filesizeformat(bytes_: Union[complex, int, str]) -> str: ...
|
||||
def pluralize(value: Any, arg: str = ...) -> str: ...
|
||||
def phone2numeric_filter(value: str) -> str: ...
|
||||
def pprint(value: Any) -> str: ...
|
||||
def pprint(
|
||||
value: Optional[
|
||||
Union[
|
||||
Callable,
|
||||
Dict[int, None],
|
||||
Dict[
|
||||
str, Optional[Union[List[Enclosure], List[str], datetime, str]]
|
||||
],
|
||||
Dict[str, Optional[Union[TemplateResponseMixin, int]]],
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[
|
||||
str,
|
||||
Optional[
|
||||
Union[Dict[Any, Any], Dict[str, None], int, str]
|
||||
],
|
||||
],
|
||||
Tuple[str, Dict[str, bytes]],
|
||||
],
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, Union[List[str], bool, str]],
|
||||
Dict[str, Union[List[str], str]],
|
||||
],
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
Union[Dict[str, Union[List[str], str]], Dict[str, str]],
|
||||
],
|
||||
date,
|
||||
int,
|
||||
],
|
||||
],
|
||||
Dict[str, Union[Dict[str, str], str]],
|
||||
Dict[str, Union[Tuple[int, int], BytesIO, FakePayload, int, str]],
|
||||
Dict[
|
||||
str,
|
||||
Union[django.db.backends.base.DatabaseWrapper, CursorWrapper],
|
||||
],
|
||||
Dict[str, bytes],
|
||||
Dict[str, Model],
|
||||
Dict[str, BlockNode],
|
||||
Exception,
|
||||
List[Callable],
|
||||
List[Dict[str, Union[Dict[str, List[str]], List[str], bool, str]]],
|
||||
List[Tuple[str, str]],
|
||||
List[ChangeList],
|
||||
List[DjangoTemplates],
|
||||
List[TemplateDoesNotExist],
|
||||
List[Enclosure],
|
||||
List[int],
|
||||
List[str],
|
||||
Tuple,
|
||||
Type[
|
||||
Union[
|
||||
ValueError,
|
||||
bool,
|
||||
ResultList,
|
||||
InclusionAdminNode,
|
||||
LoginView,
|
||||
OperationalError,
|
||||
URLResolver,
|
||||
MultiValueDict,
|
||||
TemplateView,
|
||||
BaseDateDetailView,
|
||||
DetailView,
|
||||
DeleteView,
|
||||
ModelFormMixin,
|
||||
MultipleObjectTemplateResponseMixin,
|
||||
OperationalError,
|
||||
]
|
||||
],
|
||||
BytesIO,
|
||||
bytes,
|
||||
date,
|
||||
ModelAdmin,
|
||||
ChangeList,
|
||||
InMemoryUploadedFile,
|
||||
FileUploadHandler,
|
||||
WSGIRequest,
|
||||
django.db.backends.base.SQLiteCursorWrapper,
|
||||
CursorWrapper,
|
||||
Model,
|
||||
Options,
|
||||
QuerySet,
|
||||
LazyStream,
|
||||
MultiPartParser,
|
||||
HttpResponse,
|
||||
DjangoTemplates,
|
||||
Template,
|
||||
Node,
|
||||
Template,
|
||||
RequestContext,
|
||||
BlockContext,
|
||||
FakePayload,
|
||||
RequestFactory,
|
||||
ResolverMatch,
|
||||
URLResolver,
|
||||
Rss201rev2Feed,
|
||||
cached_property,
|
||||
SimplerXMLGenerator,
|
||||
CallableSettingWrapper,
|
||||
ExceptionReporter,
|
||||
TemplateResponseMixin,
|
||||
int,
|
||||
str,
|
||||
]
|
||||
]
|
||||
) -> str: ...
|
||||
|
||||
@@ -1,10 +1,24 @@
|
||||
from collections import namedtuple
|
||||
from datetime import date
|
||||
from typing import Any, Dict, List, Optional, Tuple, Union
|
||||
from datetime import date, time
|
||||
from decimal import Decimal
|
||||
from sqlite3 import OperationalError
|
||||
from typing import Any, Dict, List, Optional, Set, Tuple, Union
|
||||
|
||||
from django.contrib.admin.helpers import ActionForm, AdminForm
|
||||
from django.contrib.auth.context_processors import PermLookupDict, PermWrapper
|
||||
from django.contrib.messages.storage.base import BaseStorage
|
||||
from django.core.exceptions import FieldDoesNotExist
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.fields import AutoField
|
||||
from django.db.models.query import QuerySet
|
||||
from django.forms.boundfield import BoundField
|
||||
from django.template.base import FilterExpression, NodeList, Parser, Token
|
||||
from django.template.context import Context, RequestContext
|
||||
from django.template.exceptions import TemplateDoesNotExist
|
||||
from django.template.library import Library
|
||||
from django.urls.resolvers import URLPattern, URLResolver
|
||||
from django.utils.datastructures import MultiValueDict
|
||||
from django.utils.safestring import SafeText
|
||||
|
||||
from .base import (BLOCK_TAG_END, BLOCK_TAG_START, COMMENT_TAG_END,
|
||||
@@ -78,21 +92,21 @@ class FirstOfNode(Node):
|
||||
def render(self, context: Context) -> str: ...
|
||||
|
||||
class ForNode(Node):
|
||||
loopvars: Union[str, List[str]]
|
||||
loopvars: Union[List[str], str]
|
||||
origin: django.template.base.Origin
|
||||
sequence: Union[str, django.template.base.FilterExpression]
|
||||
sequence: Union[django.template.base.FilterExpression, str]
|
||||
token: django.template.base.Token
|
||||
child_nodelists: Any = ...
|
||||
is_reversed: bool = ...
|
||||
nodelist_loop: Union[django.template.base.NodeList, List[str]] = ...
|
||||
nodelist_empty: Union[django.template.base.NodeList, List[str]] = ...
|
||||
nodelist_loop: List[str] = ...
|
||||
nodelist_empty: List[str] = ...
|
||||
def __init__(
|
||||
self,
|
||||
loopvars: Union[str, List[str]],
|
||||
sequence: Union[str, FilterExpression],
|
||||
loopvars: Union[List[str], str],
|
||||
sequence: Union[FilterExpression, str],
|
||||
is_reversed: bool,
|
||||
nodelist_loop: Union[NodeList, List[str]],
|
||||
nodelist_empty: Optional[Union[NodeList, List[str]]] = ...,
|
||||
nodelist_loop: List[str],
|
||||
nodelist_empty: Optional[List[str]] = ...,
|
||||
) -> None: ...
|
||||
def render(self, context: Context) -> SafeText: ...
|
||||
|
||||
@@ -108,20 +122,20 @@ class IfChangedNode(Node):
|
||||
def render(self, context: Context) -> str: ...
|
||||
|
||||
class IfEqualNode(Node):
|
||||
nodelist_false: Union[django.template.base.NodeList, List[Any]]
|
||||
nodelist_true: Union[django.template.base.NodeList, List[Any]]
|
||||
nodelist_false: List[Any]
|
||||
nodelist_true: List[Any]
|
||||
origin: django.template.base.Origin
|
||||
token: django.template.base.Token
|
||||
var1: Union[str, django.template.base.FilterExpression]
|
||||
var2: Union[str, django.template.base.FilterExpression]
|
||||
var1: Union[django.template.base.FilterExpression, str]
|
||||
var2: Union[django.template.base.FilterExpression, str]
|
||||
child_nodelists: Any = ...
|
||||
negate: bool = ...
|
||||
def __init__(
|
||||
self,
|
||||
var1: Union[str, FilterExpression],
|
||||
var2: Union[str, FilterExpression],
|
||||
nodelist_true: Union[NodeList, List[Any]],
|
||||
nodelist_false: Union[NodeList, List[Any]],
|
||||
var1: Union[FilterExpression, str],
|
||||
var2: Union[FilterExpression, str],
|
||||
nodelist_true: List[Any],
|
||||
nodelist_false: List[Any],
|
||||
negate: bool,
|
||||
) -> None: ...
|
||||
def render(self, context: Context) -> SafeText: ...
|
||||
@@ -129,22 +143,19 @@ class IfEqualNode(Node):
|
||||
class IfNode(Node):
|
||||
origin: django.template.base.Origin
|
||||
token: django.template.base.Token
|
||||
conditions_nodelists: Union[
|
||||
List[
|
||||
conditions_nodelists: List[
|
||||
Union[
|
||||
Tuple[None, django.template.base.NodeList],
|
||||
Tuple[
|
||||
django.template.defaulttags.TemplateLiteral,
|
||||
django.template.base.NodeList,
|
||||
]
|
||||
],
|
||||
List[
|
||||
Tuple[django.template.base.NodeList, django.template.base.NodeList]
|
||||
],
|
||||
],
|
||||
]
|
||||
] = ...
|
||||
def __init__(
|
||||
self,
|
||||
conditions_nodelists: Union[
|
||||
List[Tuple[TemplateLiteral, NodeList]],
|
||||
List[Tuple[NodeList, NodeList]],
|
||||
conditions_nodelists: List[
|
||||
Union[Tuple[None, NodeList], Tuple[TemplateLiteral, NodeList]]
|
||||
],
|
||||
) -> None: ...
|
||||
def __iter__(self) -> None: ...
|
||||
@@ -178,8 +189,14 @@ class RegroupNode(Node):
|
||||
var_name: str,
|
||||
) -> None: ...
|
||||
def resolve_expression(
|
||||
self, obj: Dict[str, Union[str, int, List[str], date]], context: Context
|
||||
) -> Union[str, int]: ...
|
||||
self,
|
||||
obj: Union[
|
||||
Dict[str, Union[List[str], str]],
|
||||
Dict[str, Union[int, str]],
|
||||
Dict[str, date],
|
||||
],
|
||||
context: Context,
|
||||
) -> Union[int, str]: ...
|
||||
def render(self, context: Context) -> str: ...
|
||||
|
||||
class LoadNode(Node):
|
||||
@@ -261,15 +278,15 @@ class WidthRatioNode(Node):
|
||||
class WithNode(Node):
|
||||
origin: django.template.base.Origin
|
||||
token: django.template.base.Token
|
||||
nodelist: Union[django.template.base.NodeList, List[Any]] = ...
|
||||
extra_context: Dict[
|
||||
str, Union[django.template.base.FilterExpression, str]
|
||||
nodelist: List[Any] = ...
|
||||
extra_context: Union[
|
||||
Dict[str, django.template.base.FilterExpression], Dict[str, str]
|
||||
] = ...
|
||||
def __init__(
|
||||
self,
|
||||
var: Optional[str],
|
||||
name: Optional[str],
|
||||
nodelist: Union[NodeList, List[Any]],
|
||||
nodelist: List[Any],
|
||||
extra_context: Optional[Dict[str, FilterExpression]] = ...,
|
||||
) -> None: ...
|
||||
def render(self, context: Context) -> Any: ...
|
||||
@@ -291,7 +308,50 @@ class TemplateLiteral(Literal):
|
||||
text: str = ...
|
||||
def __init__(self, value: FilterExpression, text: str) -> None: ...
|
||||
def display(self) -> str: ...
|
||||
def eval(self, context: Context) -> Any: ...
|
||||
def eval(
|
||||
self, context: Context
|
||||
) -> Optional[
|
||||
Union[
|
||||
AttributeError,
|
||||
Dict[str, Union[List[Tuple[int, SafeText]], int, str]],
|
||||
KeyError,
|
||||
List[List[Union[URLPattern, URLResolver]]],
|
||||
List[Tuple[str, str]],
|
||||
List[
|
||||
Union[
|
||||
Dict[str, Union[List[Any], str]],
|
||||
Dict[
|
||||
str, Union[List[Dict[str, Union[List[Any], str]]], str]
|
||||
],
|
||||
]
|
||||
],
|
||||
List[BoundField],
|
||||
List[TemplateDoesNotExist],
|
||||
List[int],
|
||||
List[str],
|
||||
Set[Any],
|
||||
Tuple,
|
||||
TypeError,
|
||||
date,
|
||||
time,
|
||||
Decimal,
|
||||
ActionForm,
|
||||
AdminForm,
|
||||
PermLookupDict,
|
||||
PermWrapper,
|
||||
BaseStorage,
|
||||
FieldDoesNotExist,
|
||||
WSGIRequest,
|
||||
Model,
|
||||
AutoField,
|
||||
QuerySet,
|
||||
MultiValueDict,
|
||||
float,
|
||||
int,
|
||||
OperationalError,
|
||||
str,
|
||||
]
|
||||
]: ...
|
||||
|
||||
class TemplateIfParser(IfParser):
|
||||
current_token: django.template.defaulttags.TemplateLiteral
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from datetime import date, time, timedelta
|
||||
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
|
||||
|
||||
from django.template.base import Origin, Template
|
||||
@@ -18,13 +19,24 @@ class Engine:
|
||||
dirs: List[str] = ...
|
||||
app_dirs: bool = ...
|
||||
autoescape: bool = ...
|
||||
context_processors: Union[Tuple[str], List[str]] = ...
|
||||
context_processors: Union[List[str], Tuple[str]] = ...
|
||||
debug: bool = ...
|
||||
loaders: Union[
|
||||
List[List[Union[str, Dict[str, str]]]],
|
||||
List[Union[Tuple[str, Dict[str, str]], str]],
|
||||
List[Tuple[str, List[str]]],
|
||||
List[Tuple[str, List[Tuple[str, Dict[str, str]]]]],
|
||||
List[List[Union[Dict[str, str], str]]],
|
||||
List[
|
||||
Union[
|
||||
Tuple[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, str],
|
||||
List[Any],
|
||||
List[Tuple[str, Dict[str, str]]],
|
||||
List[str],
|
||||
],
|
||||
],
|
||||
str,
|
||||
]
|
||||
],
|
||||
] = ...
|
||||
string_if_invalid: str = ...
|
||||
file_charset: str = ...
|
||||
@@ -36,14 +48,25 @@ class Engine:
|
||||
self,
|
||||
dirs: Optional[List[str]] = ...,
|
||||
app_dirs: bool = ...,
|
||||
context_processors: Optional[Union[Tuple[str], List[str]]] = ...,
|
||||
context_processors: Optional[Union[List[str], Tuple[str]]] = ...,
|
||||
debug: bool = ...,
|
||||
loaders: Optional[
|
||||
Union[
|
||||
List[List[Union[str, Dict[str, str]]]],
|
||||
List[Union[Tuple[str, Dict[str, str]], str]],
|
||||
List[Tuple[str, List[str]]],
|
||||
List[Tuple[str, List[Tuple[str, Dict[str, str]]]]],
|
||||
List[List[Union[Dict[str, str], str]]],
|
||||
List[
|
||||
Union[
|
||||
Tuple[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, str],
|
||||
List[Any],
|
||||
List[Tuple[str, Dict[str, str]]],
|
||||
List[str],
|
||||
],
|
||||
],
|
||||
str,
|
||||
]
|
||||
],
|
||||
]
|
||||
] = ...,
|
||||
string_if_invalid: str = ...,
|
||||
@@ -63,26 +86,34 @@ class Engine:
|
||||
def get_template_loaders(
|
||||
self,
|
||||
template_loaders: Union[
|
||||
List[Union[Tuple[str, Dict[str, str]], str]],
|
||||
List[List[Union[str, Dict[str, str]]]],
|
||||
List[Tuple[str, List[str]]],
|
||||
List[Tuple[str, List[Tuple[str, Dict[str, str]]]]],
|
||||
List[List[Union[Dict[str, str], str]]],
|
||||
List[
|
||||
Union[
|
||||
Tuple[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, str],
|
||||
List[Any],
|
||||
List[Tuple[str, Dict[str, str]]],
|
||||
List[str],
|
||||
],
|
||||
],
|
||||
str,
|
||||
]
|
||||
],
|
||||
],
|
||||
) -> List[Loader]: ...
|
||||
def find_template_loader(
|
||||
self,
|
||||
loader: Union[
|
||||
List[Union[Dict[str, str], str]],
|
||||
Tuple[
|
||||
str,
|
||||
Union[
|
||||
List[Tuple[str, Dict[str, str]]],
|
||||
Dict[str, str],
|
||||
List[Any],
|
||||
List[str],
|
||||
Dict[str, str], List[Tuple[str, Dict[str, str]]], List[str]
|
||||
],
|
||||
],
|
||||
str,
|
||||
List[Union[str, Dict[str, str]]],
|
||||
],
|
||||
) -> Loader: ...
|
||||
def find_template(
|
||||
@@ -91,6 +122,50 @@ class Engine:
|
||||
def from_string(self, template_code: str) -> Template: ...
|
||||
def get_template(self, template_name: str) -> Template: ...
|
||||
def render_to_string(
|
||||
self, template_name: str, context: Any = ...
|
||||
self,
|
||||
template_name: str,
|
||||
context: Optional[
|
||||
Union[
|
||||
Dict[str, Callable],
|
||||
Dict[str, Dict[Union[int, str], str]],
|
||||
Dict[str, Dict[str, Callable]],
|
||||
Dict[str, Dict[str, Dict[str, str]]],
|
||||
Dict[str, Dict[str, List[Tuple[str, int]]]],
|
||||
Dict[str, Dict[str, Tuple[str, str, str, str]]],
|
||||
Dict[str, List[Dict[str, Union[List[int], int]]]],
|
||||
Dict[str, List[Dict[str, Union[List[str], str]]]],
|
||||
Dict[str, List[Dict[str, Union[int, str]]]],
|
||||
Dict[str, List[Dict[str, date]]],
|
||||
Dict[str, List[List[Tuple[int, str]]]],
|
||||
Dict[str, List[Template]],
|
||||
Dict[str, Optional[int]],
|
||||
Dict[str, Optional[str]],
|
||||
Dict[
|
||||
str, Tuple[Dict[str, str], Dict[str, str], Dict[str, str]]
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
Tuple[
|
||||
Tuple[str, Union[int, str]], Tuple[str, Union[int, str]]
|
||||
],
|
||||
],
|
||||
Dict[str, Tuple[int, int]],
|
||||
Dict[str, Tuple[str, str]],
|
||||
Dict[str, Union[Dict[str, int], List[Union[List[str], str]]]],
|
||||
Dict[str, Union[Dict[str, int], str]],
|
||||
Dict[
|
||||
str,
|
||||
Union[List[Optional[Union[Dict[Any, Any], int, str]]], int],
|
||||
],
|
||||
Dict[str, Union[List[Union[List[SafeText], str]], str]],
|
||||
Dict[str, Union[List[int], str]],
|
||||
Dict[str, Union[date, timedelta]],
|
||||
Dict[str, Union[float, int]],
|
||||
Dict[str, Union[int, str]],
|
||||
Dict[str, time],
|
||||
Dict[str, Template],
|
||||
Dict[str, range],
|
||||
]
|
||||
] = ...,
|
||||
) -> SafeText: ...
|
||||
def select_template(self, template_name_list: List[str]) -> Template: ...
|
||||
|
||||
@@ -10,7 +10,7 @@ class TemplateDoesNotExist(Exception):
|
||||
chain: List[django.template.exceptions.TemplateDoesNotExist] = ...
|
||||
def __init__(
|
||||
self,
|
||||
msg: Union[str, Origin],
|
||||
msg: Union[Origin, str],
|
||||
tried: Optional[List[Tuple[Origin, str]]] = ...,
|
||||
backend: Optional[BaseEngine] = ...,
|
||||
chain: Optional[List[TemplateDoesNotExist]] = ...,
|
||||
|
||||
@@ -16,26 +16,26 @@ class Library:
|
||||
def __init__(self) -> None: ...
|
||||
def tag(
|
||||
self,
|
||||
name: Optional[Union[str, Callable]] = ...,
|
||||
name: Optional[Union[Callable, str]] = ...,
|
||||
compile_function: Optional[Union[Callable, str]] = ...,
|
||||
) -> Callable: ...
|
||||
def tag_function(self, func: Callable) -> Callable: ...
|
||||
def filter(
|
||||
self,
|
||||
name: Optional[Union[str, Callable]] = ...,
|
||||
filter_func: Optional[Union[str, Callable]] = ...,
|
||||
name: Optional[Union[Callable, str]] = ...,
|
||||
filter_func: Optional[Union[Callable, str]] = ...,
|
||||
**flags: Any
|
||||
) -> Callable: ...
|
||||
def filter_function(self, func: Callable, **flags: Any) -> Callable: ...
|
||||
def simple_tag(
|
||||
self,
|
||||
func: Optional[Union[str, Callable]] = ...,
|
||||
func: Optional[Union[Callable, str]] = ...,
|
||||
takes_context: Optional[bool] = ...,
|
||||
name: Optional[str] = ...,
|
||||
) -> Callable: ...
|
||||
def inclusion_tag(
|
||||
self,
|
||||
filename: Union[str, Template],
|
||||
filename: Union[Template, str],
|
||||
func: None = ...,
|
||||
takes_context: Optional[bool] = ...,
|
||||
name: Optional[str] = ...,
|
||||
@@ -56,14 +56,8 @@ class TagHelperNode(Node):
|
||||
def get_resolved_arguments(
|
||||
self, context: Context
|
||||
) -> Union[
|
||||
Tuple[
|
||||
Union[Dict[str, int], Dict[str, Union[int, SafeText]]],
|
||||
Union[Dict[str, int], Dict[str, Union[int, SafeText]]],
|
||||
],
|
||||
Tuple[
|
||||
Union[Dict[Any, Any], Dict[str, SafeText]],
|
||||
Union[Dict[Any, Any], Dict[str, SafeText]],
|
||||
],
|
||||
Tuple[Dict[Any, Any], Dict[Any, Any]],
|
||||
Tuple[List[int], Dict[str, Union[SafeText, int]]],
|
||||
]: ...
|
||||
|
||||
class SimpleNode(TagHelperNode):
|
||||
@@ -91,14 +85,14 @@ class InclusionNode(TagHelperNode):
|
||||
origin: django.template.base.Origin
|
||||
takes_context: Optional[bool]
|
||||
token: django.template.base.Token
|
||||
filename: Union[str, django.template.base.Template] = ...
|
||||
filename: Union[django.template.base.Template, str] = ...
|
||||
def __init__(
|
||||
self,
|
||||
func: Callable,
|
||||
takes_context: Optional[bool],
|
||||
args: List[FilterExpression],
|
||||
kwargs: Dict[str, FilterExpression],
|
||||
filename: Optional[Union[str, Template]],
|
||||
filename: Optional[Union[Template, str]],
|
||||
) -> None: ...
|
||||
def render(self, context: Context) -> SafeText: ...
|
||||
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
from typing import Any, List, Optional, Union
|
||||
from typing import Any, Dict, List, Optional, Union
|
||||
|
||||
from django.contrib.auth.base_user import AbstractBaseUser
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.db.models.manager import Manager
|
||||
from django.db.models.query import QuerySet
|
||||
from django.forms.forms import Form
|
||||
from django.template.backends.django import Template
|
||||
from django.template.backends.dummy import Template
|
||||
from django.template.backends.jinja2 import Template
|
||||
@@ -12,11 +16,19 @@ def get_template(
|
||||
template_name: str, using: Optional[str] = ...
|
||||
) -> Union[Template, Template, Template]: ...
|
||||
def select_template(
|
||||
template_name_list: Union[str, List[str]], using: Optional[str] = ...
|
||||
template_name_list: Union[List[str], str], using: Optional[str] = ...
|
||||
) -> Union[Template, Template, Template]: ...
|
||||
def render_to_string(
|
||||
template_name: Union[str, List[str]],
|
||||
context: Any = ...,
|
||||
template_name: Union[List[str], str],
|
||||
context: Optional[
|
||||
Union[
|
||||
Dict[str, Optional[str]],
|
||||
Dict[str, Union[AbstractBaseUser, str]],
|
||||
Dict[str, Union[Manager, QuerySet]],
|
||||
Dict[str, Union[Form, str]],
|
||||
Dict[str, bool],
|
||||
]
|
||||
] = ...,
|
||||
request: Optional[WSGIRequest] = ...,
|
||||
using: Optional[str] = ...,
|
||||
) -> str: ...
|
||||
|
||||
@@ -9,12 +9,20 @@ from .base import Loader as BaseLoader
|
||||
class Loader(BaseLoader):
|
||||
engine: django.template.engine.Engine
|
||||
template_cache: Dict[Any, Any] = ...
|
||||
get_template_cache: Dict[
|
||||
str,
|
||||
Union[
|
||||
django.template.base.Template,
|
||||
Type[django.template.exceptions.TemplateDoesNotExist],
|
||||
django.template.exceptions.TemplateDoesNotExist,
|
||||
get_template_cache: Union[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Type[django.template.exceptions.TemplateDoesNotExist],
|
||||
django.template.base.Template,
|
||||
],
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
django.template.base.Template,
|
||||
django.template.exceptions.TemplateDoesNotExist,
|
||||
],
|
||||
],
|
||||
] = ...
|
||||
loaders: List[django.template.loaders.base.Loader] = ...
|
||||
|
||||
@@ -15,5 +15,5 @@ class Loader(BaseLoader):
|
||||
def get_dirs(self) -> Union[List[bytes], List[str]]: ...
|
||||
def get_contents(self, origin: Origin) -> Any: ...
|
||||
def get_template_sources(
|
||||
self, template_name: Union[str, bytes]
|
||||
self, template_name: Union[bytes, str]
|
||||
) -> Iterator[Origin]: ...
|
||||
|
||||
@@ -1,11 +1,20 @@
|
||||
from http.cookies import SimpleCookie
|
||||
from datetime import date, datetime
|
||||
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
from django.contrib.sites.requests import RequestSite
|
||||
from django.core.paginator import Page, Paginator
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.query import QuerySet
|
||||
from django.forms.forms import BaseForm
|
||||
from django.http import HttpResponse
|
||||
from django.http.request import HttpRequest
|
||||
from django.template.backends.django import Template
|
||||
from django.template.backends.jinja2 import Template
|
||||
from django.utils.safestring import SafeText
|
||||
from django.views.generic.base import TemplateResponseMixin
|
||||
from django.views.generic.detail import DetailView
|
||||
from django.views.generic.list import (ListView,
|
||||
MultipleObjectTemplateResponseMixin)
|
||||
|
||||
from .loader import get_template, select_template
|
||||
|
||||
@@ -18,33 +27,145 @@ class SimpleTemplateResponse(HttpResponse):
|
||||
status_code: int
|
||||
rendering_attrs: Any = ...
|
||||
template_name: Union[
|
||||
str, django.template.backends.django.Template, List[str]
|
||||
List[str], django.template.backends.django.Template, str
|
||||
] = ...
|
||||
context_data: Optional[
|
||||
Union[Dict[str, str], Dict[str, Union[int, Callable]]]
|
||||
Union[Dict[str, Union[Callable, int]], Dict[str, str]]
|
||||
] = ...
|
||||
using: Optional[str] = ...
|
||||
def __init__(
|
||||
self,
|
||||
template: Union[str, Template, List[str]],
|
||||
context: Any = ...,
|
||||
template: Union[List[str], Template, str],
|
||||
context: Optional[
|
||||
Union[
|
||||
Dict[
|
||||
str, Optional[Union[List[Dict[str, str]], bool, ListView]]
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
Optional[
|
||||
Union[
|
||||
bool,
|
||||
date,
|
||||
Page,
|
||||
Paginator,
|
||||
QuerySet,
|
||||
MultipleObjectTemplateResponseMixin,
|
||||
]
|
||||
],
|
||||
],
|
||||
Dict[str, Union[Callable, int]],
|
||||
Dict[str, Union[Dict[str, str], DetailView]],
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
List[Dict[str, Optional[Union[datetime, Model, str]]]],
|
||||
bool,
|
||||
Page,
|
||||
Paginator,
|
||||
ListView,
|
||||
],
|
||||
],
|
||||
Dict[str, Union[List[str], str]],
|
||||
Dict[
|
||||
str,
|
||||
Union[RequestSite, BaseForm, TemplateResponseMixin, str],
|
||||
],
|
||||
Dict[str, Union[Model, BaseForm, TemplateResponseMixin, str]],
|
||||
MagicMock,
|
||||
]
|
||||
] = ...,
|
||||
content_type: Optional[str] = ...,
|
||||
status: Optional[int] = ...,
|
||||
charset: None = ...,
|
||||
charset: Optional[str] = ...,
|
||||
using: Optional[str] = ...,
|
||||
) -> None: ...
|
||||
def resolve_template(
|
||||
self, template: Union[str, List[str]]
|
||||
self, template: Union[List[str], Template, str]
|
||||
) -> Union[Template, Template]: ...
|
||||
def resolve_context(self, context: Any) -> Any: ...
|
||||
def resolve_context(
|
||||
self,
|
||||
context: Optional[
|
||||
Union[
|
||||
Dict[
|
||||
str, Optional[Union[List[Dict[str, str]], bool, ListView]]
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
Optional[
|
||||
Union[
|
||||
bool,
|
||||
date,
|
||||
Page,
|
||||
Paginator,
|
||||
QuerySet,
|
||||
MultipleObjectTemplateResponseMixin,
|
||||
]
|
||||
],
|
||||
],
|
||||
Dict[str, Union[Callable, int]],
|
||||
Dict[str, Union[Dict[str, str], DetailView]],
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
List[Dict[str, Optional[Union[datetime, Model, str]]]],
|
||||
bool,
|
||||
Page,
|
||||
Paginator,
|
||||
ListView,
|
||||
],
|
||||
],
|
||||
Dict[str, Union[List[str], str]],
|
||||
Dict[
|
||||
str,
|
||||
Union[RequestSite, BaseForm, TemplateResponseMixin, str],
|
||||
],
|
||||
Dict[str, Union[Model, BaseForm, TemplateResponseMixin, str]],
|
||||
MagicMock,
|
||||
]
|
||||
],
|
||||
) -> Optional[
|
||||
Union[
|
||||
Dict[str, Optional[Union[List[Dict[str, str]], bool, ListView]]],
|
||||
Dict[
|
||||
str,
|
||||
Optional[
|
||||
Union[
|
||||
bool,
|
||||
date,
|
||||
Page,
|
||||
Paginator,
|
||||
QuerySet,
|
||||
MultipleObjectTemplateResponseMixin,
|
||||
]
|
||||
],
|
||||
],
|
||||
Dict[str, Union[Callable, int]],
|
||||
Dict[str, Union[Dict[str, str], DetailView]],
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
List[Dict[str, Optional[Union[datetime, Model, str]]]],
|
||||
bool,
|
||||
Page,
|
||||
Paginator,
|
||||
ListView,
|
||||
],
|
||||
],
|
||||
Dict[str, Union[List[str], str]],
|
||||
Dict[str, Union[RequestSite, BaseForm, TemplateResponseMixin, str]],
|
||||
Dict[str, Union[Model, BaseForm, TemplateResponseMixin, str]],
|
||||
MagicMock,
|
||||
]
|
||||
]: ...
|
||||
@property
|
||||
def rendered_content(self) -> SafeText: ...
|
||||
def rendered_content(self) -> str: ...
|
||||
def add_post_render_callback(self, callback: Callable) -> None: ...
|
||||
content: Any = ...
|
||||
def render(self) -> TemplateResponse: ...
|
||||
def render(self) -> SimpleTemplateResponse: ...
|
||||
@property
|
||||
def is_rendered(self) -> bool: ...
|
||||
def __iter__(self): ...
|
||||
def __iter__(self) -> Any: ...
|
||||
@property
|
||||
def content(self): ...
|
||||
@content.setter
|
||||
@@ -54,16 +175,88 @@ class TemplateResponse(SimpleTemplateResponse):
|
||||
client: django.test.client.Client
|
||||
closed: bool
|
||||
context: django.template.context.RequestContext
|
||||
context_data: Any
|
||||
context_data: Optional[
|
||||
Union[
|
||||
Dict[
|
||||
str,
|
||||
Optional[
|
||||
Union[
|
||||
List[Dict[str, str]],
|
||||
bool,
|
||||
django.views.generic.list.ListView,
|
||||
]
|
||||
],
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
Optional[
|
||||
Union[
|
||||
bool,
|
||||
datetime.date,
|
||||
django.core.paginator.Page,
|
||||
django.core.paginator.Paginator,
|
||||
django.db.models.query.QuerySet,
|
||||
django.views.generic.list.MultipleObjectTemplateResponseMixin,
|
||||
]
|
||||
],
|
||||
],
|
||||
Dict[str, Union[Callable, int]],
|
||||
Dict[
|
||||
str,
|
||||
Union[Dict[str, str], django.views.generic.detail.DetailView],
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
List[
|
||||
Dict[
|
||||
str,
|
||||
Optional[
|
||||
Union[
|
||||
datetime.datetime,
|
||||
django.db.models.base.Model,
|
||||
str,
|
||||
]
|
||||
],
|
||||
]
|
||||
],
|
||||
bool,
|
||||
django.core.paginator.Page,
|
||||
django.core.paginator.Paginator,
|
||||
django.views.generic.list.ListView,
|
||||
],
|
||||
],
|
||||
Dict[str, Union[List[str], str]],
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
django.contrib.sites.requests.RequestSite,
|
||||
django.forms.forms.BaseForm,
|
||||
django.views.generic.base.TemplateResponseMixin,
|
||||
str,
|
||||
],
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
django.db.models.base.Model,
|
||||
django.forms.forms.BaseForm,
|
||||
django.views.generic.base.TemplateResponseMixin,
|
||||
str,
|
||||
],
|
||||
],
|
||||
unittest.mock.MagicMock,
|
||||
]
|
||||
]
|
||||
cookies: http.cookies.SimpleCookie
|
||||
csrf_cookie_set: bool
|
||||
json: functools.partial
|
||||
redirect_chain: List[Tuple[str, int]]
|
||||
request: Dict[str, str]
|
||||
request: Dict[str, Union[django.test.client.FakePayload, int, str]]
|
||||
resolver_match: django.utils.functional.SimpleLazyObject
|
||||
status_code: int
|
||||
template_name: Union[
|
||||
str, django.template.backends.django.Template, List[str]
|
||||
List[str], django.template.backends.django.Template, str
|
||||
]
|
||||
templates: List[django.template.base.Template]
|
||||
using: Optional[str]
|
||||
@@ -72,8 +265,46 @@ class TemplateResponse(SimpleTemplateResponse):
|
||||
def __init__(
|
||||
self,
|
||||
request: HttpRequest,
|
||||
template: Union[str, Template, List[str]],
|
||||
context: Any = ...,
|
||||
template: Union[List[str], Template, str],
|
||||
context: Optional[
|
||||
Union[
|
||||
Dict[
|
||||
str, Optional[Union[List[Dict[str, str]], bool, ListView]]
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
Optional[
|
||||
Union[
|
||||
bool,
|
||||
date,
|
||||
Page,
|
||||
Paginator,
|
||||
QuerySet,
|
||||
MultipleObjectTemplateResponseMixin,
|
||||
]
|
||||
],
|
||||
],
|
||||
Dict[str, Union[Callable, int]],
|
||||
Dict[str, Union[Dict[str, str], DetailView]],
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
List[Dict[str, Optional[Union[datetime, Model, str]]]],
|
||||
bool,
|
||||
Page,
|
||||
Paginator,
|
||||
ListView,
|
||||
],
|
||||
],
|
||||
Dict[str, Union[List[str], str]],
|
||||
Dict[
|
||||
str,
|
||||
Union[RequestSite, BaseForm, TemplateResponseMixin, str],
|
||||
],
|
||||
Dict[str, Union[Model, BaseForm, TemplateResponseMixin, str]],
|
||||
MagicMock,
|
||||
]
|
||||
] = ...,
|
||||
content_type: Optional[str] = ...,
|
||||
status: Optional[int] = ...,
|
||||
charset: None = ...,
|
||||
|
||||
@@ -40,9 +40,9 @@ class IfParser:
|
||||
def __init__(
|
||||
self,
|
||||
tokens: Union[
|
||||
List[Union[int, str, List[int]]],
|
||||
List[Union[None, str, List[int]]],
|
||||
List[Union[int, str, None]],
|
||||
List[Optional[Union[List[int], str]]],
|
||||
List[Optional[Union[int, str]]],
|
||||
List[Union[List[int], int, str]],
|
||||
],
|
||||
) -> None: ...
|
||||
def translate_token(
|
||||
|
||||
@@ -10,7 +10,7 @@ class InvalidTemplateEngineError(ImproperlyConfigured): ...
|
||||
class EngineHandler:
|
||||
templates: collections.OrderedDict
|
||||
def __init__(
|
||||
self, templates: List[Dict[str, Union[str, Dict[str, bool]]]] = ...
|
||||
self, templates: List[Dict[str, Union[Dict[str, bool], str]]] = ...
|
||||
) -> None: ...
|
||||
def templates(self) -> OrderedDict: ...
|
||||
def __getitem__(self, alias: str) -> BaseEngine: ...
|
||||
|
||||
Reference in New Issue
Block a user