mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-10 05:51:53 +08:00
initial commit
This commit is contained in:
14
django/template/backends/base.pyi
Normal file
14
django/template/backends/base.pyi
Normal file
@@ -0,0 +1,14 @@
|
||||
from typing import (
|
||||
Dict,
|
||||
Iterator,
|
||||
List,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class BaseEngine:
|
||||
def __init__(self, params: Dict[str, Union[str, bool, List[str]]]) -> None: ...
|
||||
def iter_template_filenames(self, template_name: str) -> Iterator[str]: ...
|
||||
@cached_property
|
||||
def template_dirs(self) -> Tuple: ...
|
||||
48
django/template/backends/django.pyi
Normal file
48
django/template/backends/django.pyi
Normal file
@@ -0,0 +1,48 @@
|
||||
from django.http.request import HttpRequest
|
||||
from django.template.base import Template
|
||||
from django.template.exceptions import TemplateDoesNotExist
|
||||
from django.utils.safestring import SafeText
|
||||
from typing import (
|
||||
Any,
|
||||
Dict,
|
||||
Iterator,
|
||||
Optional,
|
||||
)
|
||||
|
||||
|
||||
def copy_exception(
|
||||
exc: TemplateDoesNotExist,
|
||||
backend: Optional[DjangoTemplates] = ...
|
||||
) -> TemplateDoesNotExist: ...
|
||||
|
||||
|
||||
def get_installed_libraries() -> Dict[str, str]: ...
|
||||
|
||||
|
||||
def get_package_libraries(pkg: Any) -> Iterator[str]: ...
|
||||
|
||||
|
||||
def reraise(
|
||||
exc: TemplateDoesNotExist,
|
||||
backend: DjangoTemplates
|
||||
): ...
|
||||
|
||||
|
||||
class DjangoTemplates:
|
||||
def __init__(self, params: Dict[str, Any]) -> None: ...
|
||||
def from_string(self, template_code: str) -> Template: ...
|
||||
def get_template(self, template_name: str) -> Template: ...
|
||||
def get_templatetag_libraries(self, custom_libraries: Dict[str, str]) -> Dict[str, str]: ...
|
||||
|
||||
|
||||
class Template:
|
||||
def __init__(
|
||||
self,
|
||||
template: Template,
|
||||
backend: DjangoTemplates
|
||||
) -> None: ...
|
||||
def render(
|
||||
self,
|
||||
context: Any = ...,
|
||||
request: Optional[HttpRequest] = ...
|
||||
) -> SafeText: ...
|
||||
19
django/template/backends/dummy.pyi
Normal file
19
django/template/backends/dummy.pyi
Normal file
@@ -0,0 +1,19 @@
|
||||
from django.http.request import HttpRequest
|
||||
from typing import (
|
||||
Dict,
|
||||
Optional,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class Template:
|
||||
def render(
|
||||
self,
|
||||
context: Optional[Dict[str, str]] = ...,
|
||||
request: Optional[HttpRequest] = ...
|
||||
) -> str: ...
|
||||
|
||||
|
||||
class TemplateStrings:
|
||||
def __init__(self, params: Dict[str, Union[bool, str]]) -> None: ...
|
||||
def get_template(self, template_name: str) -> Template: ...
|
||||
5
django/template/backends/utils.pyi
Normal file
5
django/template/backends/utils.pyi
Normal file
@@ -0,0 +1,5 @@
|
||||
from django.http.request import HttpRequest
|
||||
from django.utils.safestring import SafeText
|
||||
|
||||
|
||||
def csrf_input(request: HttpRequest) -> SafeText: ...
|
||||
186
django/template/base.pyi
Normal file
186
django/template/base.pyi
Normal file
@@ -0,0 +1,186 @@
|
||||
from django.template.backends.dummy import TemplateStrings
|
||||
from django.template.context import Context
|
||||
from django.template.defaulttags import LoadNode
|
||||
from django.template.engine import Engine
|
||||
from django.template.exceptions import TemplateSyntaxError
|
||||
from django.template.library import Library
|
||||
from django.template.loader_tags import (
|
||||
BlockNode,
|
||||
ExtendsNode,
|
||||
)
|
||||
from django.template.loaders.base import Loader
|
||||
from django.utils.safestring import SafeText
|
||||
from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
Dict,
|
||||
Iterator,
|
||||
List,
|
||||
Optional,
|
||||
Tuple,
|
||||
Type,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
def linebreak_iter(template_source: str) -> Iterator[int]: ...
|
||||
|
||||
|
||||
def render_value_in_context(value: Any, context: Context) -> str: ...
|
||||
|
||||
|
||||
def token_kwargs(
|
||||
bits: List[str],
|
||||
parser: Parser,
|
||||
support_legacy: bool = ...
|
||||
) -> Dict[str, FilterExpression]: ...
|
||||
|
||||
|
||||
class DebugLexer:
|
||||
def tokenize(self) -> List[Token]: ...
|
||||
|
||||
|
||||
class FilterExpression:
|
||||
def __init__(self, token: str, parser: Parser) -> None: ...
|
||||
def __str__(self) -> str: ...
|
||||
@staticmethod
|
||||
def args_check(
|
||||
name: str,
|
||||
func: Callable,
|
||||
provided: Union[List[Tuple[bool, SafeText]], List[Tuple[bool, Variable]]]
|
||||
) -> bool: ...
|
||||
def resolve(
|
||||
self,
|
||||
context: Union[Dict[str, Dict[str, str]], Context],
|
||||
ignore_failures: bool = ...
|
||||
) -> Any: ...
|
||||
|
||||
|
||||
class Lexer:
|
||||
def __init__(self, template_string: str) -> None: ...
|
||||
def create_token(
|
||||
self,
|
||||
token_string: str,
|
||||
position: Optional[Tuple[int, int]],
|
||||
lineno: int,
|
||||
in_tag: bool
|
||||
) -> Token: ...
|
||||
def tokenize(self) -> List[Token]: ...
|
||||
|
||||
|
||||
class Node:
|
||||
def get_nodes_by_type(
|
||||
self,
|
||||
nodetype: Type[Node]
|
||||
) -> Union[List[VariableNode], List[BlockNode], List[LoadNode], List[ExtendsNode]]: ...
|
||||
def render_annotated(self, context: Context) -> Union[str, int]: ...
|
||||
|
||||
|
||||
class NodeList:
|
||||
def get_nodes_by_type(
|
||||
self,
|
||||
nodetype: Type[Node]
|
||||
) -> Union[List[BlockNode], List[VariableNode]]: ...
|
||||
def render(self, context: Context) -> SafeText: ...
|
||||
|
||||
|
||||
class Origin:
|
||||
def __eq__(self, other: Origin) -> bool: ...
|
||||
def __init__(
|
||||
self,
|
||||
name: str,
|
||||
template_name: Optional[str] = ...,
|
||||
loader: Optional[Union[Loader, TemplateStrings]] = ...
|
||||
) -> None: ...
|
||||
@property
|
||||
def loader_name(self) -> Optional[str]: ...
|
||||
|
||||
|
||||
class Parser:
|
||||
def __init__(
|
||||
self,
|
||||
tokens: Union[str, List[Token]],
|
||||
libraries: Optional[Dict[str, Library]] = ...,
|
||||
builtins: List[Library] = ...,
|
||||
origin: Optional[Origin] = ...
|
||||
) -> None: ...
|
||||
def add_library(self, lib: Library) -> None: ...
|
||||
def compile_filter(self, token: str) -> FilterExpression: ...
|
||||
def delete_first_token(self) -> None: ...
|
||||
def error(
|
||||
self,
|
||||
token: Token,
|
||||
e: Union[str, TemplateSyntaxError, RuntimeError]
|
||||
) -> Union[TemplateSyntaxError, RuntimeError]: ...
|
||||
def extend_nodelist(
|
||||
self,
|
||||
nodelist: NodeList,
|
||||
node: Node,
|
||||
token: Token
|
||||
) -> None: ...
|
||||
def find_filter(self, filter_name: str) -> Callable: ...
|
||||
def invalid_block_tag(
|
||||
self,
|
||||
token: Token,
|
||||
command: str,
|
||||
parse_until: Union[Tuple[str], Tuple[str, str]] = ...
|
||||
): ...
|
||||
def next_token(self) -> Token: ...
|
||||
def parse(
|
||||
self,
|
||||
parse_until: Optional[Union[Tuple[str, str, str], Tuple[str], Tuple[str, str]]] = ...
|
||||
) -> NodeList: ...
|
||||
def prepend_token(self, token: Token) -> None: ...
|
||||
def skip_past(self, endtag: str) -> None: ...
|
||||
def unclosed_block_tag(self, parse_until: Union[Tuple[str, str, str], Tuple[str]]): ...
|
||||
|
||||
|
||||
class Template:
|
||||
def __init__(
|
||||
self,
|
||||
template_string: str,
|
||||
origin: Optional[Origin] = ...,
|
||||
name: Optional[str] = ...,
|
||||
engine: Optional[Engine] = ...
|
||||
) -> None: ...
|
||||
def compile_nodelist(self) -> NodeList: ...
|
||||
def get_exception_info(
|
||||
self,
|
||||
exception: Exception,
|
||||
token: Token
|
||||
) -> Dict[str, Union[str, List[Tuple[int, SafeText]], int]]: ...
|
||||
def render(self, context: Context): ...
|
||||
|
||||
|
||||
class TextNode:
|
||||
def __init__(self, s: str) -> None: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def render(self, context: Context) -> str: ...
|
||||
|
||||
|
||||
class Token:
|
||||
def __init__(
|
||||
self,
|
||||
token_type: TokenType,
|
||||
contents: str,
|
||||
position: Optional[Tuple[int, int]] = ...,
|
||||
lineno: Optional[int] = ...
|
||||
) -> None: ...
|
||||
def split_contents(self) -> List[str]: ...
|
||||
|
||||
|
||||
class Variable:
|
||||
def __init__(self, var: str) -> None: ...
|
||||
def _resolve_lookup(self, context: Any) -> Any: ...
|
||||
def resolve(self, context: Any) -> Any: ...
|
||||
|
||||
|
||||
class VariableDoesNotExist:
|
||||
def __init__(self, msg: str, params: Any = ...) -> None: ...
|
||||
def __str__(self) -> str: ...
|
||||
|
||||
|
||||
class VariableNode:
|
||||
def __init__(self, filter_expression: FilterExpression) -> None: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def render(self, context: Context) -> str: ...
|
||||
102
django/template/context.pyi
Normal file
102
django/template/context.pyi
Normal file
@@ -0,0 +1,102 @@
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.http.request import HttpRequest
|
||||
from django.template.base import (
|
||||
Origin,
|
||||
Template,
|
||||
)
|
||||
from django.template.defaulttags import CycleNode
|
||||
from django.template.library import InclusionNode
|
||||
from django.template.loader_tags import BlockContext
|
||||
from itertools import cycle
|
||||
from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
Dict,
|
||||
Iterator,
|
||||
List,
|
||||
Optional,
|
||||
Type,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
def make_context(
|
||||
context: Any,
|
||||
request: Optional[WSGIRequest] = ...,
|
||||
**kwargs
|
||||
) -> Context: ...
|
||||
|
||||
|
||||
class BaseContext:
|
||||
def __contains__(self, key: str) -> bool: ...
|
||||
def __copy__(self) -> BaseContext: ...
|
||||
def __eq__(self, other: Context) -> bool: ...
|
||||
def __getitem__(self, key: Union[str, int]) -> Any: ...
|
||||
def __init__(self, dict_: Any = ...) -> None: ...
|
||||
def __iter__(self) -> None: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def __setitem__(
|
||||
self,
|
||||
key: Union[str, CycleNode, InclusionNode],
|
||||
value: Any
|
||||
) -> None: ...
|
||||
def _reset_dicts(self, value: Any = ...) -> None: ...
|
||||
def flatten(self) -> Dict[str, Union[None, int, str, Dict[str, Union[Type[object], str]]]]: ...
|
||||
def get(self, key: str, otherwise: Optional[int] = ...) -> Any: ...
|
||||
def new(self, values: Any = ...) -> Context: ...
|
||||
def pop(self) -> ContextDict: ...
|
||||
def push(self, *args, **kwargs) -> ContextDict: ...
|
||||
def set_upward(self, key: str, value: Union[str, int]) -> None: ...
|
||||
def setdefault(
|
||||
self,
|
||||
key: str,
|
||||
default: Union[List[Origin], int] = ...
|
||||
) -> Union[List[Origin], int]: ...
|
||||
|
||||
|
||||
class Context:
|
||||
def __copy__(self) -> Context: ...
|
||||
def __init__(
|
||||
self,
|
||||
dict_: Any = ...,
|
||||
autoescape: bool = ...,
|
||||
use_l10n: Optional[bool] = ...,
|
||||
use_tz: None = ...
|
||||
) -> None: ...
|
||||
def bind_template(self, template: Template) -> Iterator[None]: ...
|
||||
def update(self, other_dict: Dict[str, Any]) -> ContextDict: ...
|
||||
|
||||
|
||||
class ContextDict:
|
||||
def __enter__(self) -> ContextDict: ...
|
||||
def __exit__(self, *args, **kwargs) -> None: ...
|
||||
def __init__(self, context: BaseContext, *args, **kwargs) -> None: ...
|
||||
|
||||
|
||||
class RenderContext:
|
||||
def __contains__(self, key: Union[str, CycleNode]) -> bool: ...
|
||||
def __getitem__(
|
||||
self,
|
||||
key: Union[str, CycleNode]
|
||||
) -> Union[List[Origin], BlockContext, cycle]: ...
|
||||
def __iter__(self): ...
|
||||
def get(
|
||||
self,
|
||||
key: Union[str, InclusionNode],
|
||||
otherwise: None = ...
|
||||
) -> Optional[Union[BlockContext, Template]]: ...
|
||||
def push_state(self, template: Template, isolated_context: bool = ...) -> Iterator[None]: ...
|
||||
|
||||
|
||||
class RequestContext:
|
||||
def __init__(
|
||||
self,
|
||||
request: HttpRequest,
|
||||
dict_: None = ...,
|
||||
processors: Optional[List[Callable]] = ...,
|
||||
use_l10n: None = ...,
|
||||
use_tz: None = ...,
|
||||
autoescape: bool = ...
|
||||
) -> None: ...
|
||||
def bind_template(self, template: Template) -> Iterator[None]: ...
|
||||
def new(self, values: Any = ...) -> RequestContext: ...
|
||||
22
django/template/context_processors.pyi
Normal file
22
django/template/context_processors.pyi
Normal file
@@ -0,0 +1,22 @@
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.http.request import HttpRequest
|
||||
from django.utils.functional import SimpleLazyObject
|
||||
from typing import (
|
||||
Callable,
|
||||
Dict,
|
||||
List,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
def csrf(request: HttpRequest) -> Dict[str, SimpleLazyObject]: ...
|
||||
|
||||
|
||||
def debug(request: HttpRequest) -> Dict[str, Union[bool, Callable]]: ...
|
||||
|
||||
|
||||
def i18n(request: WSGIRequest) -> Dict[str, Union[List[Tuple[str, str]], str, bool]]: ...
|
||||
|
||||
|
||||
def request(request: HttpRequest) -> Dict[str, HttpRequest]: ...
|
||||
199
django/template/defaultfilters.pyi
Normal file
199
django/template/defaultfilters.pyi
Normal file
@@ -0,0 +1,199 @@
|
||||
from datetime import (
|
||||
date,
|
||||
time,
|
||||
timedelta,
|
||||
)
|
||||
from django.utils.safestring import SafeText
|
||||
from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
Dict,
|
||||
List,
|
||||
Optional,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
def _property_resolver(arg: Union[str, int]) -> Callable: ...
|
||||
|
||||
|
||||
def add(
|
||||
value: Union[str, Tuple[int, int], date, int],
|
||||
arg: Union[int, timedelta, Tuple[int, int], SafeText]
|
||||
) -> Union[str, Tuple[int, int, int, int], date, int]: ...
|
||||
|
||||
|
||||
def addslashes(value: str) -> str: ...
|
||||
|
||||
|
||||
def capfirst(value: str) -> str: ...
|
||||
|
||||
|
||||
def center(value: str, arg: SafeText) -> str: ...
|
||||
|
||||
|
||||
def cut(value: str, arg: str) -> str: ...
|
||||
|
||||
|
||||
def date(value: Optional[Union[time, date, str]], arg: Optional[str] = ...) -> str: ...
|
||||
|
||||
|
||||
def default(value: Optional[Union[str, int]], arg: Union[int, SafeText]) -> Union[str, int]: ...
|
||||
|
||||
|
||||
def default_if_none(value: Optional[str], arg: Union[str, int]) -> Union[str, int]: ...
|
||||
|
||||
|
||||
def dictsort(
|
||||
value: Union[List[Dict[str, Union[str, int]]], List[Dict[str, str]], List[Tuple[str, str]]],
|
||||
arg: Union[str, int]
|
||||
) -> Union[List[Dict[str, Union[str, int]]], List[Dict[str, str]], List[Tuple[str, str]]]: ...
|
||||
|
||||
|
||||
def dictsortreversed(value: str, arg: str) -> str: ...
|
||||
|
||||
|
||||
def divisibleby(value: int, arg: int) -> bool: ...
|
||||
|
||||
|
||||
def escape_filter(value: str) -> SafeText: ...
|
||||
|
||||
|
||||
def escapejs_filter(value: str) -> SafeText: ...
|
||||
|
||||
|
||||
def filesizeformat(bytes_: Union[str, int]) -> str: ...
|
||||
|
||||
|
||||
def first(value: Union[str, List[str]]) -> str: ...
|
||||
|
||||
|
||||
def floatformat(text: Any, arg: Union[str, int] = ...) -> str: ...
|
||||
|
||||
|
||||
def force_escape(value: str) -> SafeText: ...
|
||||
|
||||
|
||||
def get_digit(value: int, arg: int) -> int: ...
|
||||
|
||||
|
||||
def iriencode(value: str) -> str: ...
|
||||
|
||||
|
||||
def join(value: object, arg: str, autoescape: bool = ...) -> object: ...
|
||||
|
||||
|
||||
def json_script(value: Dict[str, str], element_id: SafeText) -> SafeText: ...
|
||||
|
||||
|
||||
def last(value: List[str]) -> str: ...
|
||||
|
||||
|
||||
def length(value: Any) -> int: ...
|
||||
|
||||
|
||||
def length_is(value: Any, arg: Union[int, SafeText]) -> Union[bool, str]: ...
|
||||
|
||||
|
||||
def linebreaks_filter(value: str, autoescape: bool = ...) -> SafeText: ...
|
||||
|
||||
|
||||
def linebreaksbr(value: str, autoescape: bool = ...) -> SafeText: ...
|
||||
|
||||
|
||||
def linenumbers(value: str, autoescape: bool = ...) -> SafeText: ...
|
||||
|
||||
|
||||
def ljust(value: str, arg: Union[int, SafeText]) -> str: ...
|
||||
|
||||
|
||||
def lower(value: str) -> str: ...
|
||||
|
||||
|
||||
def make_list(value: str) -> List[str]: ...
|
||||
|
||||
|
||||
def phone2numeric_filter(value: str) -> str: ...
|
||||
|
||||
|
||||
def pluralize(value: object, arg: str = ...) -> str: ...
|
||||
|
||||
|
||||
def pprint(value: object) -> str: ...
|
||||
|
||||
|
||||
def random(value: Union[List[SafeText], List[str]]) -> str: ...
|
||||
|
||||
|
||||
def rjust(value: str, arg: Union[int, SafeText]) -> str: ...
|
||||
|
||||
|
||||
def safe(value: str) -> SafeText: ...
|
||||
|
||||
|
||||
def safeseq(value: List[str]) -> List[SafeText]: ...
|
||||
|
||||
|
||||
def slice_filter(value: str, arg: str) -> str: ...
|
||||
|
||||
|
||||
def slugify(value: str) -> SafeText: ...
|
||||
|
||||
|
||||
def stringformat(value: object, arg: str) -> str: ...
|
||||
|
||||
|
||||
def striptags(value: str) -> str: ...
|
||||
|
||||
|
||||
def time(value: Optional[Union[time, str, date]], arg: Optional[str] = ...) -> str: ...
|
||||
|
||||
|
||||
def timesince_filter(value: Optional[date], arg: Optional[date] = ...) -> str: ...
|
||||
|
||||
|
||||
def timeuntil_filter(value: date, arg: Optional[date] = ...) -> str: ...
|
||||
|
||||
|
||||
def title(value: str) -> str: ...
|
||||
|
||||
|
||||
def truncatechars(value: str, arg: Union[int, SafeText]) -> str: ...
|
||||
|
||||
|
||||
def truncatechars_html(value: str, arg: Union[str, int]) -> str: ...
|
||||
|
||||
|
||||
def truncatewords(value: str, arg: Union[int, SafeText]) -> str: ...
|
||||
|
||||
|
||||
def truncatewords_html(value: str, arg: int) -> str: ...
|
||||
|
||||
|
||||
def unordered_list(value: Any, autoescape: bool = ...) -> SafeText: ...
|
||||
|
||||
|
||||
def upper(value: str) -> str: ...
|
||||
|
||||
|
||||
def urlencode(value: str, safe: None = ...) -> str: ...
|
||||
|
||||
|
||||
def urlize(value: str, autoescape: bool = ...) -> SafeText: ...
|
||||
|
||||
|
||||
def urlizetrunc(
|
||||
value: str,
|
||||
limit: Union[int, SafeText],
|
||||
autoescape: bool = ...
|
||||
) -> SafeText: ...
|
||||
|
||||
|
||||
def wordcount(value: str) -> int: ...
|
||||
|
||||
|
||||
def wordwrap(value: str, arg: Union[int, SafeText]) -> str: ...
|
||||
|
||||
|
||||
def yesno(value: Optional[int], arg: Optional[str] = ...) -> Optional[str]: ...
|
||||
337
django/template/defaulttags.pyi
Normal file
337
django/template/defaulttags.pyi
Normal file
@@ -0,0 +1,337 @@
|
||||
from datetime import date
|
||||
from django.template.base import (
|
||||
FilterExpression,
|
||||
NodeList,
|
||||
Parser,
|
||||
Token,
|
||||
)
|
||||
from django.template.context import (
|
||||
Context,
|
||||
RequestContext,
|
||||
)
|
||||
from django.template.library import Library
|
||||
from django.utils.safestring import SafeText
|
||||
from typing import (
|
||||
Any,
|
||||
Dict,
|
||||
List,
|
||||
Optional,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
def autoescape(
|
||||
parser: Parser,
|
||||
token: Token
|
||||
) -> AutoEscapeControlNode: ...
|
||||
|
||||
|
||||
def comment(
|
||||
parser: Parser,
|
||||
token: Token
|
||||
) -> CommentNode: ...
|
||||
|
||||
|
||||
def csrf_token(
|
||||
parser: Parser,
|
||||
token: Token
|
||||
) -> CsrfTokenNode: ...
|
||||
|
||||
|
||||
def cycle(
|
||||
parser: Parser,
|
||||
token: Token
|
||||
) -> CycleNode: ...
|
||||
|
||||
|
||||
def do_filter(
|
||||
parser: Parser,
|
||||
token: Token
|
||||
) -> FilterNode: ...
|
||||
|
||||
|
||||
def do_for(
|
||||
parser: Parser,
|
||||
token: Token
|
||||
) -> ForNode: ...
|
||||
|
||||
|
||||
def do_if(parser: Parser, token: Token) -> IfNode: ...
|
||||
|
||||
|
||||
def do_ifequal(
|
||||
parser: Parser,
|
||||
token: Token,
|
||||
negate: bool
|
||||
) -> IfEqualNode: ...
|
||||
|
||||
|
||||
def do_with(
|
||||
parser: Parser,
|
||||
token: Token
|
||||
) -> WithNode: ...
|
||||
|
||||
|
||||
def find_library(parser: Parser, name: str) -> Library: ...
|
||||
|
||||
|
||||
def firstof(
|
||||
parser: Parser,
|
||||
token: Token
|
||||
) -> FirstOfNode: ...
|
||||
|
||||
|
||||
def ifchanged(
|
||||
parser: Parser,
|
||||
token: Token
|
||||
) -> IfChangedNode: ...
|
||||
|
||||
|
||||
def ifequal(
|
||||
parser: Parser,
|
||||
token: Token
|
||||
) -> IfEqualNode: ...
|
||||
|
||||
|
||||
def ifnotequal(
|
||||
parser: Parser,
|
||||
token: Token
|
||||
) -> IfEqualNode: ...
|
||||
|
||||
|
||||
def load(parser: Parser, token: Token) -> LoadNode: ...
|
||||
|
||||
|
||||
def load_from_library(
|
||||
library: Library,
|
||||
label: str,
|
||||
names: List[str]
|
||||
) -> Library: ...
|
||||
|
||||
|
||||
def lorem(
|
||||
parser: Parser,
|
||||
token: Token
|
||||
) -> LoremNode: ...
|
||||
|
||||
|
||||
def now(parser: Parser, token: Token) -> NowNode: ...
|
||||
|
||||
|
||||
def regroup(
|
||||
parser: Parser,
|
||||
token: Token
|
||||
) -> RegroupNode: ...
|
||||
|
||||
|
||||
def resetcycle(
|
||||
parser: Parser,
|
||||
token: Token
|
||||
) -> ResetCycleNode: ...
|
||||
|
||||
|
||||
def spaceless(
|
||||
parser: Parser,
|
||||
token: Token
|
||||
) -> SpacelessNode: ...
|
||||
|
||||
|
||||
def templatetag(
|
||||
parser: Parser,
|
||||
token: Token
|
||||
) -> TemplateTagNode: ...
|
||||
|
||||
|
||||
def url(parser: Parser, token: Token) -> URLNode: ...
|
||||
|
||||
|
||||
def verbatim(
|
||||
parser: Parser,
|
||||
token: Token
|
||||
) -> VerbatimNode: ...
|
||||
|
||||
|
||||
def widthratio(
|
||||
parser: Parser,
|
||||
token: Token
|
||||
) -> WidthRatioNode: ...
|
||||
|
||||
|
||||
class AutoEscapeControlNode:
|
||||
def __init__(self, setting: bool, nodelist: NodeList) -> None: ...
|
||||
def render(self, context: Context) -> SafeText: ...
|
||||
|
||||
|
||||
class CommentNode:
|
||||
def render(self, context: Context) -> str: ...
|
||||
|
||||
|
||||
class CsrfTokenNode:
|
||||
def render(self, context: RequestContext) -> SafeText: ...
|
||||
|
||||
|
||||
class CycleNode:
|
||||
def __init__(
|
||||
self,
|
||||
cyclevars: List[FilterExpression],
|
||||
variable_name: Optional[str] = ...,
|
||||
silent: bool = ...
|
||||
) -> None: ...
|
||||
def render(self, context: Context) -> str: ...
|
||||
def reset(self, context: Context) -> None: ...
|
||||
|
||||
|
||||
class FilterNode:
|
||||
def __init__(
|
||||
self,
|
||||
filter_expr: FilterExpression,
|
||||
nodelist: NodeList
|
||||
) -> None: ...
|
||||
def render(self, context: Context): ...
|
||||
|
||||
|
||||
class FirstOfNode:
|
||||
def __init__(self, variables: List[FilterExpression], asvar: Optional[str] = ...) -> None: ...
|
||||
def render(self, context: Context) -> str: ...
|
||||
|
||||
|
||||
class ForNode:
|
||||
def __init__(
|
||||
self,
|
||||
loopvars: List[str],
|
||||
sequence: FilterExpression,
|
||||
is_reversed: bool,
|
||||
nodelist_loop: NodeList,
|
||||
nodelist_empty: Optional[NodeList] = ...
|
||||
) -> None: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def render(self, context: Context) -> SafeText: ...
|
||||
|
||||
|
||||
class IfChangedNode:
|
||||
def __init__(
|
||||
self,
|
||||
nodelist_true: NodeList,
|
||||
nodelist_false: NodeList,
|
||||
*varlist
|
||||
) -> None: ...
|
||||
def _get_context_stack_frame(self, context: Context) -> Any: ...
|
||||
def render(self, context: Context) -> str: ...
|
||||
|
||||
|
||||
class IfEqualNode:
|
||||
def __init__(
|
||||
self,
|
||||
var1: FilterExpression,
|
||||
var2: FilterExpression,
|
||||
nodelist_true: NodeList,
|
||||
nodelist_false: NodeList,
|
||||
negate: bool
|
||||
) -> None: ...
|
||||
def render(self, context: Context) -> SafeText: ...
|
||||
|
||||
|
||||
class IfNode:
|
||||
def __init__(
|
||||
self,
|
||||
conditions_nodelists: Union[List[Tuple[TemplateLiteral, NodeList]], List[Union[Tuple[TemplateLiteral, NodeList], Tuple[None, NodeList]]]]
|
||||
) -> None: ...
|
||||
def __iter__(self) -> None: ...
|
||||
def __repr__(self) -> str: ...
|
||||
@property
|
||||
def nodelist(self) -> NodeList: ...
|
||||
def render(self, context: Context) -> str: ...
|
||||
|
||||
|
||||
class LoadNode:
|
||||
def render(self, context: Context) -> str: ...
|
||||
|
||||
|
||||
class LoremNode:
|
||||
def __init__(self, count: FilterExpression, method: str, common: bool) -> None: ...
|
||||
def render(self, context: Context) -> str: ...
|
||||
|
||||
|
||||
class NowNode:
|
||||
def __init__(self, format_string: str, asvar: None = ...) -> None: ...
|
||||
def render(self, context: Context) -> str: ...
|
||||
|
||||
|
||||
class RegroupNode:
|
||||
def __init__(
|
||||
self,
|
||||
target: FilterExpression,
|
||||
expression: FilterExpression,
|
||||
var_name: str
|
||||
) -> None: ...
|
||||
def render(self, context: Context) -> str: ...
|
||||
def resolve_expression(
|
||||
self,
|
||||
obj: Dict[str, Union[date, str, int, List[str]]],
|
||||
context: Context
|
||||
) -> Union[str, int]: ...
|
||||
|
||||
|
||||
class ResetCycleNode:
|
||||
def __init__(self, node: CycleNode) -> None: ...
|
||||
def render(self, context: Context) -> str: ...
|
||||
|
||||
|
||||
class SpacelessNode:
|
||||
def __init__(self, nodelist: NodeList) -> None: ...
|
||||
def render(self, context: Context) -> str: ...
|
||||
|
||||
|
||||
class TemplateIfParser:
|
||||
def __init__(self, parser: Parser, *args, **kwargs) -> None: ...
|
||||
def create_var(self, value: str) -> TemplateLiteral: ...
|
||||
|
||||
|
||||
class TemplateLiteral:
|
||||
def __init__(self, value: FilterExpression, text: str) -> None: ...
|
||||
def display(self) -> str: ...
|
||||
def eval(self, context: Context) -> Any: ...
|
||||
|
||||
|
||||
class TemplateTagNode:
|
||||
def __init__(self, tagtype: str) -> None: ...
|
||||
def render(self, context: Context) -> str: ...
|
||||
|
||||
|
||||
class URLNode:
|
||||
def __init__(
|
||||
self,
|
||||
view_name: FilterExpression,
|
||||
args: List[FilterExpression],
|
||||
kwargs: Dict[str, FilterExpression],
|
||||
asvar: Optional[str]
|
||||
) -> None: ...
|
||||
def render(self, context: Context) -> str: ...
|
||||
|
||||
|
||||
class VerbatimNode:
|
||||
def __init__(self, content: SafeText) -> None: ...
|
||||
def render(self, context: Context) -> SafeText: ...
|
||||
|
||||
|
||||
class WidthRatioNode:
|
||||
def __init__(
|
||||
self,
|
||||
val_expr: FilterExpression,
|
||||
max_expr: FilterExpression,
|
||||
max_width: FilterExpression,
|
||||
asvar: Optional[str] = ...
|
||||
) -> None: ...
|
||||
def render(self, context: Context) -> str: ...
|
||||
|
||||
|
||||
class WithNode:
|
||||
def __init__(
|
||||
self,
|
||||
var: None,
|
||||
name: None,
|
||||
nodelist: NodeList,
|
||||
extra_context: Dict[str, FilterExpression] = ...
|
||||
) -> None: ...
|
||||
def render(self, context: Context): ...
|
||||
62
django/template/engine.pyi
Normal file
62
django/template/engine.pyi
Normal file
@@ -0,0 +1,62 @@
|
||||
from django.template.base import (
|
||||
Origin,
|
||||
Template,
|
||||
)
|
||||
from django.template.library import Library
|
||||
from django.template.loaders.base import Loader
|
||||
from django.template.loaders.cached import Loader
|
||||
from django.template.loaders.filesystem import Loader
|
||||
from django.template.loaders.locmem import Loader
|
||||
from django.utils.safestring import SafeText
|
||||
from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
Dict,
|
||||
List,
|
||||
Optional,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class Engine:
|
||||
def __init__(
|
||||
self,
|
||||
dirs: Optional[List[str]] = ...,
|
||||
app_dirs: bool = ...,
|
||||
context_processors: Optional[Union[Tuple[str, str], List[str]]] = ...,
|
||||
debug: bool = ...,
|
||||
loaders: Any = ...,
|
||||
string_if_invalid: str = ...,
|
||||
file_charset: str = ...,
|
||||
libraries: Optional[Dict[str, str]] = ...,
|
||||
builtins: Optional[List[str]] = ...,
|
||||
autoescape: bool = ...
|
||||
) -> None: ...
|
||||
def find_template(
|
||||
self,
|
||||
name: str,
|
||||
dirs: None = ...,
|
||||
skip: Optional[List[Origin]] = ...
|
||||
) -> Tuple[Template, Origin]: ...
|
||||
def find_template_loader(
|
||||
self,
|
||||
loader: Union[str, Tuple[str, List[Tuple[str, Dict[str, str]]]], Tuple[str, Dict[str, str]], Tuple[str, List[str]]]
|
||||
) -> Loader: ...
|
||||
def from_string(self, template_code: str) -> Template: ...
|
||||
@staticmethod
|
||||
def get_default() -> Engine: ...
|
||||
def get_template(self, template_name: str) -> Template: ...
|
||||
def get_template_builtins(self, builtins: List[str]) -> List[Library]: ...
|
||||
def get_template_libraries(self, libraries: Dict[str, str]) -> Dict[str, Library]: ...
|
||||
def get_template_loaders(self, template_loaders: Any) -> Any: ...
|
||||
def render_to_string(self, template_name: str, context: Any = ...) -> SafeText: ...
|
||||
def select_template(self, template_name_list: List[str]) -> Template: ...
|
||||
@cached_property
|
||||
def template_context_processors(
|
||||
self
|
||||
) -> Union[Tuple[Callable, Callable, Callable], Tuple[Callable, Callable, Callable, Callable, Callable], Tuple[Callable, Callable], Tuple[Callable]]: ...
|
||||
@cached_property
|
||||
def template_loaders(
|
||||
self
|
||||
) -> Union[List[Loader], List[Loader], List[Loader]]: ...
|
||||
18
django/template/exceptions.pyi
Normal file
18
django/template/exceptions.pyi
Normal file
@@ -0,0 +1,18 @@
|
||||
from django.template.backends.base import BaseEngine
|
||||
from django.template.base import Origin
|
||||
from typing import (
|
||||
List,
|
||||
Optional,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class TemplateDoesNotExist:
|
||||
def __init__(
|
||||
self,
|
||||
msg: Union[str, Origin],
|
||||
tried: Optional[List[Tuple[Origin, str]]] = ...,
|
||||
backend: Optional[BaseEngine] = ...,
|
||||
chain: Optional[List[TemplateDoesNotExist]] = ...
|
||||
) -> None: ...
|
||||
98
django/template/library.pyi
Normal file
98
django/template/library.pyi
Normal file
@@ -0,0 +1,98 @@
|
||||
from django.template.base import (
|
||||
FilterExpression,
|
||||
Parser,
|
||||
Template,
|
||||
)
|
||||
from django.template.context import Context
|
||||
from django.utils.safestring import SafeText
|
||||
from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
Dict,
|
||||
List,
|
||||
Optional,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
def import_library(name: str) -> Library: ...
|
||||
|
||||
|
||||
def parse_bits(
|
||||
parser: Parser,
|
||||
bits: List[str],
|
||||
params: List[str],
|
||||
varargs: Optional[str],
|
||||
varkw: None,
|
||||
defaults: Optional[Union[Tuple[bool, None], Tuple[str]]],
|
||||
kwonly: List[str],
|
||||
kwonly_defaults: Optional[Dict[str, int]],
|
||||
takes_context: Optional[bool],
|
||||
name: str
|
||||
) -> Union[Tuple[List[Any], Dict[str, FilterExpression]], Tuple[List[FilterExpression], Dict[str, FilterExpression]], Tuple[List[FilterExpression], Dict[Any, Any]], Tuple[List[Any], Dict[Any, Any]]]: ...
|
||||
|
||||
|
||||
class InclusionNode:
|
||||
def __init__(
|
||||
self,
|
||||
func: Callable,
|
||||
takes_context: Optional[bool],
|
||||
args: List[FilterExpression],
|
||||
kwargs: Dict[Any, Any],
|
||||
filename: Optional[Union[str, Template]]
|
||||
) -> None: ...
|
||||
def render(self, context: Context) -> SafeText: ...
|
||||
|
||||
|
||||
class Library:
|
||||
def __init__(self) -> None: ...
|
||||
def filter(
|
||||
self,
|
||||
name: Optional[Union[str, Callable]] = ...,
|
||||
filter_func: Optional[Callable] = ...,
|
||||
**flags
|
||||
) -> Callable: ...
|
||||
def filter_function(self, func: Callable, **flags) -> Callable: ...
|
||||
def inclusion_tag(
|
||||
self,
|
||||
filename: Union[str, Template],
|
||||
func: None = ...,
|
||||
takes_context: Optional[bool] = ...,
|
||||
name: Optional[str] = ...
|
||||
) -> Callable: ...
|
||||
def simple_tag(
|
||||
self,
|
||||
func: Optional[Callable] = ...,
|
||||
takes_context: Optional[bool] = ...,
|
||||
name: Optional[str] = ...
|
||||
) -> Callable: ...
|
||||
def tag(
|
||||
self,
|
||||
name: Optional[Union[str, Callable]] = ...,
|
||||
compile_function: Optional[Union[str, Callable]] = ...
|
||||
) -> Callable: ...
|
||||
def tag_function(self, func: Callable) -> Callable: ...
|
||||
|
||||
|
||||
class SimpleNode:
|
||||
def __init__(
|
||||
self,
|
||||
func: Callable,
|
||||
takes_context: Optional[bool],
|
||||
args: List[FilterExpression],
|
||||
kwargs: Dict[str, FilterExpression],
|
||||
target_var: Optional[str]
|
||||
) -> None: ...
|
||||
def render(self, context: Context) -> str: ...
|
||||
|
||||
|
||||
class TagHelperNode:
|
||||
def __init__(
|
||||
self,
|
||||
func: Callable,
|
||||
takes_context: Optional[bool],
|
||||
args: List[FilterExpression],
|
||||
kwargs: Dict[Any, Any]
|
||||
) -> None: ...
|
||||
def get_resolved_arguments(self, context: Context) -> Any: ...
|
||||
31
django/template/loader.pyi
Normal file
31
django/template/loader.pyi
Normal file
@@ -0,0 +1,31 @@
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.template.backends.base import BaseEngine
|
||||
from django.template.backends.django import (
|
||||
DjangoTemplates,
|
||||
Template,
|
||||
)
|
||||
from typing import (
|
||||
Any,
|
||||
List,
|
||||
Optional,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
def _engine_list(
|
||||
using: Optional[str] = ...
|
||||
) -> Union[List[DjangoTemplates], List[BaseEngine]]: ...
|
||||
|
||||
|
||||
def get_template(template_name: str, using: None = ...) -> Template: ...
|
||||
|
||||
|
||||
def render_to_string(
|
||||
template_name: Union[str, List[str]],
|
||||
context: Any = ...,
|
||||
request: Optional[WSGIRequest] = ...,
|
||||
using: Optional[str] = ...
|
||||
) -> str: ...
|
||||
|
||||
|
||||
def select_template(template_name_list: List[str], using: None = ...) -> Template: ...
|
||||
78
django/template/loader_tags.pyi
Normal file
78
django/template/loader_tags.pyi
Normal file
@@ -0,0 +1,78 @@
|
||||
from django.template.base import (
|
||||
FilterExpression,
|
||||
NodeList,
|
||||
Parser,
|
||||
Template,
|
||||
Token,
|
||||
)
|
||||
from django.template.context import Context
|
||||
from django.utils.safestring import SafeText
|
||||
from typing import (
|
||||
Dict,
|
||||
Optional,
|
||||
)
|
||||
|
||||
|
||||
def construct_relative_path(current_template_name: Optional[str], relative_name: str) -> str: ...
|
||||
|
||||
|
||||
def do_block(
|
||||
parser: Parser,
|
||||
token: Token
|
||||
) -> BlockNode: ...
|
||||
|
||||
|
||||
def do_extends(
|
||||
parser: Parser,
|
||||
token: Token
|
||||
) -> ExtendsNode: ...
|
||||
|
||||
|
||||
def do_include(
|
||||
parser: Parser,
|
||||
token: Token
|
||||
) -> IncludeNode: ...
|
||||
|
||||
|
||||
class BlockContext:
|
||||
def __init__(self) -> None: ...
|
||||
def add_blocks(self, blocks: Dict[str, BlockNode]) -> None: ...
|
||||
def get_block(self, name: str) -> BlockNode: ...
|
||||
def pop(self, name: str) -> BlockNode: ...
|
||||
def push(self, name: str, block: BlockNode) -> None: ...
|
||||
|
||||
|
||||
class BlockNode:
|
||||
def __init__(self, name: str, nodelist: NodeList, parent: None = ...) -> None: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def render(self, context: Context) -> SafeText: ...
|
||||
def super(self) -> SafeText: ...
|
||||
|
||||
|
||||
class ExtendsNode:
|
||||
def __init__(
|
||||
self,
|
||||
nodelist: NodeList,
|
||||
parent_name: FilterExpression,
|
||||
template_dirs: None = ...
|
||||
) -> None: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def find_template(
|
||||
self,
|
||||
template_name: str,
|
||||
context: Context
|
||||
) -> Template: ...
|
||||
def get_parent(self, context: Context) -> Template: ...
|
||||
def render(self, context: Context): ...
|
||||
|
||||
|
||||
class IncludeNode:
|
||||
def __init__(
|
||||
self,
|
||||
template: FilterExpression,
|
||||
*args,
|
||||
extra_context = ...,
|
||||
isolated_context = ...,
|
||||
**kwargs
|
||||
) -> None: ...
|
||||
def render(self, context: Context) -> SafeText: ...
|
||||
8
django/template/loaders/app_directories.pyi
Normal file
8
django/template/loaders/app_directories.pyi
Normal file
@@ -0,0 +1,8 @@
|
||||
from typing import (
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class Loader:
|
||||
def get_dirs(self) -> Union[Tuple[str, str, str, str], Tuple[str, str, str], Tuple[str], Tuple[str, str]]: ...
|
||||
18
django/template/loaders/base.pyi
Normal file
18
django/template/loaders/base.pyi
Normal file
@@ -0,0 +1,18 @@
|
||||
from django.template.base import (
|
||||
Origin,
|
||||
Template,
|
||||
)
|
||||
from django.template.engine import Engine
|
||||
from typing import (
|
||||
List,
|
||||
Optional,
|
||||
)
|
||||
|
||||
|
||||
class Loader:
|
||||
def __init__(self, engine: Engine) -> None: ...
|
||||
def get_template(
|
||||
self,
|
||||
template_name: str,
|
||||
skip: Optional[List[Origin]] = ...
|
||||
) -> Template: ...
|
||||
29
django/template/loaders/cached.pyi
Normal file
29
django/template/loaders/cached.pyi
Normal file
@@ -0,0 +1,29 @@
|
||||
from django.template.base import (
|
||||
Origin,
|
||||
Template,
|
||||
)
|
||||
from django.template.engine import Engine
|
||||
from typing import (
|
||||
Dict,
|
||||
List,
|
||||
Optional,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class Loader:
|
||||
def __init__(
|
||||
self,
|
||||
engine: Engine,
|
||||
loaders: Union[List[Tuple[str, Dict[str, str]]], List[str]]
|
||||
) -> None: ...
|
||||
def cache_key(self, template_name: str, skip: Optional[List[Origin]] = ...) -> str: ...
|
||||
def generate_hash(self, values: List[str]) -> str: ...
|
||||
def get_contents(self, origin: Origin) -> str: ...
|
||||
def get_template(
|
||||
self,
|
||||
template_name: str,
|
||||
skip: Optional[List[Origin]] = ...
|
||||
) -> Template: ...
|
||||
def get_template_sources(self, template_name: str) -> None: ...
|
||||
14
django/template/loaders/filesystem.pyi
Normal file
14
django/template/loaders/filesystem.pyi
Normal file
@@ -0,0 +1,14 @@
|
||||
from django.template.base import Origin
|
||||
from django.template.engine import Engine
|
||||
from typing import (
|
||||
Iterator,
|
||||
List,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class Loader:
|
||||
def __init__(self, engine: Engine, dirs: None = ...) -> None: ...
|
||||
def get_contents(self, origin: Origin): ...
|
||||
def get_dirs(self) -> List[str]: ...
|
||||
def get_template_sources(self, template_name: Union[str, bytes]) -> Iterator[Origin]: ...
|
||||
12
django/template/loaders/locmem.pyi
Normal file
12
django/template/loaders/locmem.pyi
Normal file
@@ -0,0 +1,12 @@
|
||||
from django.template.base import Origin
|
||||
from django.template.engine import Engine
|
||||
from typing import (
|
||||
Dict,
|
||||
Iterator,
|
||||
)
|
||||
|
||||
|
||||
class Loader:
|
||||
def __init__(self, engine: Engine, templates_dict: Dict[str, str]) -> None: ...
|
||||
def get_contents(self, origin: Origin) -> str: ...
|
||||
def get_template_sources(self, template_name: str) -> Iterator[Origin]: ...
|
||||
48
django/template/response.pyi
Normal file
48
django/template/response.pyi
Normal file
@@ -0,0 +1,48 @@
|
||||
from django.http.request import HttpRequest
|
||||
from django.template.backends.django import Template
|
||||
from django.utils.safestring import SafeText
|
||||
from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
Dict,
|
||||
List,
|
||||
Optional,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class SimpleTemplateResponse:
|
||||
def __getstate__(self) -> Dict[str, Any]: ...
|
||||
def __init__(
|
||||
self,
|
||||
template: Union[str, Template, List[str]],
|
||||
context: Any = ...,
|
||||
content_type: Optional[str] = ...,
|
||||
status: Optional[int] = ...,
|
||||
charset: Optional[str] = ...,
|
||||
using: None = ...
|
||||
) -> None: ...
|
||||
def add_post_render_callback(self, callback: Callable) -> None: ...
|
||||
@property
|
||||
def is_rendered(self) -> bool: ...
|
||||
def render(self) -> SimpleTemplateResponse: ...
|
||||
@property
|
||||
def rendered_content(self) -> SafeText: ...
|
||||
def resolve_context(self, context: Any) -> Any: ...
|
||||
def resolve_template(
|
||||
self,
|
||||
template: Union[str, Template, List[str]]
|
||||
) -> Template: ...
|
||||
|
||||
|
||||
class TemplateResponse:
|
||||
def __init__(
|
||||
self,
|
||||
request: HttpRequest,
|
||||
template: Union[str, Template, List[str]],
|
||||
context: Any = ...,
|
||||
content_type: Optional[str] = ...,
|
||||
status: Optional[int] = ...,
|
||||
charset: None = ...,
|
||||
using: None = ...
|
||||
) -> None: ...
|
||||
24
django/template/smartif.pyi
Normal file
24
django/template/smartif.pyi
Normal file
@@ -0,0 +1,24 @@
|
||||
from django.template.defaulttags import TemplateLiteral
|
||||
from typing import (
|
||||
Any,
|
||||
Dict,
|
||||
List,
|
||||
Optional,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class IfParser:
|
||||
def __init__(self, tokens: Any) -> None: ...
|
||||
def create_var(self, value: Optional[Union[List[int], int]]) -> Literal: ...
|
||||
def expression(self, rbp: int = ...) -> Literal: ...
|
||||
def next_token(self) -> Literal: ...
|
||||
def parse(self) -> TemplateLiteral: ...
|
||||
def translate_token(self, token: Union[List[int], str, int]) -> Literal: ...
|
||||
|
||||
|
||||
class Literal:
|
||||
def __init__(self, value: Optional[int]) -> None: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def eval(self, context: Dict[Any, Any]) -> Optional[Union[int, List[int]]]: ...
|
||||
def nud(self, parser: IfParser) -> Literal: ...
|
||||
22
django/template/utils.pyi
Normal file
22
django/template/utils.pyi
Normal file
@@ -0,0 +1,22 @@
|
||||
from collections import OrderedDict
|
||||
from django.template.backends.base import BaseEngine
|
||||
from django.template.backends.django import DjangoTemplates
|
||||
from django.template.backends.dummy import TemplateStrings
|
||||
from typing import (
|
||||
List,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
def get_app_template_dirs(dirname: str) -> Tuple: ...
|
||||
|
||||
|
||||
class EngineHandler:
|
||||
def __getitem__(self, alias: str) -> BaseEngine: ...
|
||||
def __iter__(self): ...
|
||||
def all(
|
||||
self
|
||||
) -> Union[List[DjangoTemplates], List[TemplateStrings], List[BaseEngine]]: ...
|
||||
@cached_property
|
||||
def templates(self) -> OrderedDict: ...
|
||||
Reference in New Issue
Block a user