mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-23 20:31:32 +08:00
fixes for ci imports failures
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
from typing import Any, Dict, Iterator, Optional
|
||||
from typing import Any, Dict, Iterator, Optional, List
|
||||
|
||||
from django.http.request import HttpRequest
|
||||
from django.template.base import Origin, Template
|
||||
from django.template.base import Template
|
||||
from django.template.exceptions import TemplateDoesNotExist
|
||||
from django.utils.safestring import SafeText
|
||||
|
||||
from django.template.engine import Engine
|
||||
from .base import BaseEngine
|
||||
|
||||
class DjangoTemplates(BaseEngine):
|
||||
@@ -12,20 +11,12 @@ class DjangoTemplates(BaseEngine):
|
||||
dirs: List[str]
|
||||
name: str
|
||||
app_dirname: str = ...
|
||||
engine: django.template.engine.Engine = ...
|
||||
engine: Engine = ...
|
||||
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:
|
||||
template: Template = ...
|
||||
backend: django.template.backends.django.DjangoTemplates = ...
|
||||
def __init__(self, template: Template, backend: DjangoTemplates) -> None: ...
|
||||
@property
|
||||
def origin(self) -> Origin: ...
|
||||
def render(self, context: Any = ..., request: Optional[HttpRequest] = ...) -> SafeText: ...
|
||||
|
||||
def copy_exception(exc: TemplateDoesNotExist, backend: Optional[DjangoTemplates] = ...) -> TemplateDoesNotExist: ...
|
||||
def reraise(exc: TemplateDoesNotExist, backend: DjangoTemplates) -> Any: ...
|
||||
def get_installed_libraries() -> Dict[str, str]: ...
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import string
|
||||
from typing import Any, Dict, List, Optional, Union
|
||||
from typing import Any, Dict, List, Optional, Union, Tuple
|
||||
|
||||
from django.http.request import HttpRequest
|
||||
|
||||
from .base import BaseEngine
|
||||
from .utils import csrf_input_lazy, csrf_token_lazy
|
||||
|
||||
class TemplateStrings(BaseEngine):
|
||||
app_dirs: bool
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
from datetime import time
|
||||
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
|
||||
from typing import Callable, Dict, List, Optional, Tuple, Any
|
||||
|
||||
from jinja2.environment import Template
|
||||
from jinja2.exceptions import TemplateSyntaxError
|
||||
|
||||
from django.http.request import HttpRequest
|
||||
from django.views.generic.base import TemplateView
|
||||
from django.template.base import Template
|
||||
from django.template.exceptions import TemplateSyntaxError
|
||||
|
||||
from .base import BaseEngine
|
||||
|
||||
@@ -17,99 +13,13 @@ class Jinja2(BaseEngine):
|
||||
template_dirs: Tuple[str]
|
||||
app_dirname: str = ...
|
||||
context_processors: List[str] = ...
|
||||
env: jinja2.environment.Environment = ...
|
||||
def __init__(self, params: Dict[str, Union[Dict[str, Union[List[str], bool]], List[str], bool, str]]) -> None: ...
|
||||
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 template_context_processors(self) -> List[Callable]: ...
|
||||
|
||||
class Template:
|
||||
template: jinja2.environment.Template = ...
|
||||
backend: django.template.backends.jinja2.Jinja2 = ...
|
||||
origin: django.template.backends.jinja2.Origin = ...
|
||||
def __init__(self, template: Template, backend: Jinja2) -> None: ...
|
||||
def render(
|
||||
self,
|
||||
context: Optional[
|
||||
Union[
|
||||
Dict[str, Dict[str, Optional[Union[Dict[str, bool], bool, str]]]],
|
||||
Dict[
|
||||
str,
|
||||
Dict[
|
||||
str,
|
||||
Optional[
|
||||
Union[
|
||||
Dict[str, str], List[Dict[str, Optional[Union[Dict[str, str], bool, str]]]], bool, str
|
||||
]
|
||||
],
|
||||
],
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, int],
|
||||
List[Tuple[Optional[str], List[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],
|
||||
List[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[str, str],
|
||||
List[
|
||||
Tuple[
|
||||
Optional[str],
|
||||
List[Dict[str, Union[Dict[str, Union[bool, str]], time, int, str]]],
|
||||
int,
|
||||
]
|
||||
],
|
||||
List[str],
|
||||
bool,
|
||||
str,
|
||||
],
|
||||
],
|
||||
],
|
||||
Dict[str, TemplateView],
|
||||
Dict[str, str],
|
||||
]
|
||||
] = ...,
|
||||
request: Optional[HttpRequest] = ...,
|
||||
) -> str: ...
|
||||
|
||||
class Origin:
|
||||
name: str = ...
|
||||
template_name: Optional[str] = ...
|
||||
def __init__(self, name: str, template_name: Optional[str]) -> None: ...
|
||||
|
||||
def get_exception_info(exception: TemplateSyntaxError) -> Dict[str, Union[List[Tuple[int, str]], int, str]]: ...
|
||||
def get_exception_info(exception: TemplateSyntaxError) -> Dict[str, Any]: ...
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
from enum import Enum
|
||||
from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Type, Union
|
||||
|
||||
from django.template.backends.dummy import TemplateStrings
|
||||
from django.template.context import Context
|
||||
from django.template.engine import Engine
|
||||
from django.template.library import Library
|
||||
@@ -38,23 +37,19 @@ class VariableDoesNotExist(Exception):
|
||||
class Origin:
|
||||
name: str = ...
|
||||
template_name: Optional[Union[bytes, str]] = ...
|
||||
loader: Optional[Union[django.template.backends.dummy.TemplateStrings, django.template.loaders.base.Loader]] = ...
|
||||
loader: Optional[Loader] = ...
|
||||
def __init__(
|
||||
self,
|
||||
name: str,
|
||||
template_name: Optional[Union[bytes, str]] = ...,
|
||||
loader: Optional[Union[TemplateStrings, Loader]] = ...,
|
||||
self, name: str, template_name: Optional[Union[bytes, str]] = ..., loader: Optional[Loader] = ...
|
||||
) -> None: ...
|
||||
def __eq__(self, other: Origin) -> bool: ...
|
||||
@property
|
||||
def loader_name(self) -> Optional[str]: ...
|
||||
|
||||
class Template:
|
||||
name: Optional[str] = ...
|
||||
origin: Origin = ...
|
||||
engine: django.template.engine.Engine = ...
|
||||
engine: Engine = ...
|
||||
source: str = ...
|
||||
nodelist: django.template.base.NodeList = ...
|
||||
nodelist: NodeList = ...
|
||||
def __init__(
|
||||
self,
|
||||
template_string: str,
|
||||
@@ -136,8 +131,8 @@ class FilterExpression:
|
||||
var: Union[Variable, SafeText] = ...
|
||||
def __init__(self, token: str, parser: Parser) -> None: ...
|
||||
def resolve(self, context: Union[Dict[str, Dict[str, str]], Context], ignore_failures: bool = ...) -> Any: ...
|
||||
@staticmethod
|
||||
def args_check(name: str, func: Callable, provided: List[Tuple[bool, Union[Variable, SafeText]]]) -> bool: ...
|
||||
args_check: Any = ...
|
||||
|
||||
class Variable:
|
||||
var: Union[Dict[Any, Any], str] = ...
|
||||
@@ -151,8 +146,9 @@ class Variable:
|
||||
class Node:
|
||||
must_be_first: bool = ...
|
||||
child_nodelists: Any = ...
|
||||
token: Any = ...
|
||||
def render(self, context: Any) -> None: ...
|
||||
origin: Origin
|
||||
token: Token = ...
|
||||
def render(self, context: Context) -> str: ...
|
||||
def render_annotated(self, context: Context) -> Union[int, str]: ...
|
||||
def __iter__(self) -> None: ...
|
||||
def get_nodes_by_type(self, nodetype: Type[Node]) -> List[Node]: ...
|
||||
@@ -174,7 +170,7 @@ def render_value_in_context(value: Any, context: Context) -> str: ...
|
||||
class VariableNode(Node):
|
||||
origin: Origin
|
||||
token: Token
|
||||
filter_expression: django.template.base.FilterExpression = ...
|
||||
filter_expression: FilterExpression = ...
|
||||
def __init__(self, filter_expression: FilterExpression) -> None: ...
|
||||
def render(self, context: Context) -> str: ...
|
||||
|
||||
|
||||
@@ -1,21 +1,16 @@
|
||||
from itertools import cycle
|
||||
from typing import Any, Callable, Dict, Iterator, List, Optional, Type, Union
|
||||
|
||||
from django.contrib.admin.templatetags.admin_list import ResultList
|
||||
from django.contrib.admin.views.main import ChangeList
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.options import Options
|
||||
from django.forms.boundfield import BoundField
|
||||
from django.http.request import HttpRequest
|
||||
from django.template.base import Node, Origin, Template
|
||||
from django.template.defaulttags import CycleNode, IfChangedNode
|
||||
from django.template.library import InclusionNode
|
||||
from django.template.loader_tags import BlockContext
|
||||
from django.template.defaulttags import IfChangedNode
|
||||
from django.template.loader_tags import IncludeNode
|
||||
|
||||
_ContextValues = Union[Dict[str, Any], "Context"]
|
||||
|
||||
class ContextPopException(Exception): ...
|
||||
|
||||
class ContextDict(dict):
|
||||
context: django.template.context.BaseContext = ...
|
||||
context: BaseContext = ...
|
||||
def __init__(self, context: BaseContext, *args: Any, **kwargs: Any) -> None: ...
|
||||
def __enter__(self) -> ContextDict: ...
|
||||
def __exit__(self, *args: Any, **kwargs: Any) -> None: ...
|
||||
@@ -31,23 +26,12 @@ class BaseContext:
|
||||
def __getitem__(self, key: Union[int, str]) -> Any: ...
|
||||
def __delitem__(self, key: Any) -> None: ...
|
||||
def __contains__(self, key: str) -> bool: ...
|
||||
def get(self, key: str, otherwise: Optional[int] = ...) -> Optional[Union[Options, int, str]]: ...
|
||||
def get(self, key: str, otherwise: Optional[Any] = ...) -> Optional[Any]: ...
|
||||
def setdefault(
|
||||
self, key: Union[IfChangedNode, str], default: Optional[Union[List[Origin], int]] = ...
|
||||
) -> Optional[Union[List[Origin], int]]: ...
|
||||
def new(
|
||||
self,
|
||||
values: Optional[
|
||||
Union[
|
||||
Dict[str, Union[List[Dict[str, Union[int, str]]], List[ResultList], List[BoundField], ChangeList, int]],
|
||||
Dict[str, Union[List[Dict[str, str]], ChangeList, int, str]],
|
||||
Dict[str, Union[ChangeList, int, range, str]],
|
||||
Context,
|
||||
]
|
||||
] = ...,
|
||||
) -> Context: ...
|
||||
def new(self, values: Optional[_ContextValues] = ...) -> Context: ...
|
||||
def flatten(self) -> Dict[str, Optional[Union[Dict[str, Union[Type[Any], str]], int, str]]]: ...
|
||||
def __eq__(self, other: Context) -> bool: ...
|
||||
|
||||
class Context(BaseContext):
|
||||
dicts: Any
|
||||
@@ -55,36 +39,32 @@ class Context(BaseContext):
|
||||
use_l10n: Optional[bool] = ...
|
||||
use_tz: Optional[bool] = ...
|
||||
template_name: Optional[str] = ...
|
||||
render_context: django.template.context.RenderContext = ...
|
||||
render_context: RenderContext = ...
|
||||
template: Optional[Template] = ...
|
||||
def __init__(
|
||||
self, dict_: Any = ..., autoescape: bool = ..., use_l10n: Optional[bool] = ..., use_tz: None = ...
|
||||
) -> None: ...
|
||||
def bind_template(self, template: Template) -> Iterator[None]: ...
|
||||
def __copy__(self) -> Context: ...
|
||||
def update(self, other_dict: Union[Dict[str, Model], Dict[str, int], Dict[str, str], Context]) -> ContextDict: ...
|
||||
def update(self, other_dict: Union[Dict[str, Any], Context]) -> ContextDict: ...
|
||||
|
||||
class RenderContext(BaseContext):
|
||||
dicts: List[Dict[Union[django.template.loader_tags.IncludeNode, str], str]]
|
||||
dicts: List[Dict[Union[IncludeNode, str], str]]
|
||||
template: Optional[Template] = ...
|
||||
def __iter__(self) -> None: ...
|
||||
def __contains__(self, key: Union[CycleNode, str]) -> bool: ...
|
||||
def get(self, key: Union[InclusionNode, str], otherwise: None = ...) -> Optional[Union[Template, BlockContext]]: ...
|
||||
def __getitem__(self, key: Union[Node, str]) -> Optional[Union[List[Origin], BlockContext, cycle]]: ...
|
||||
def push_state(self, template: Template, isolated_context: bool = ...) -> Iterator[None]: ...
|
||||
|
||||
class RequestContext(Context):
|
||||
autoescape: bool
|
||||
dicts: List[Dict[str, str]]
|
||||
render_context: django.template.context.RenderContext
|
||||
render_context: RenderContext
|
||||
template_name: Optional[str]
|
||||
use_l10n: None
|
||||
use_tz: None
|
||||
request: django.http.request.HttpRequest = ...
|
||||
request: HttpRequest = ...
|
||||
def __init__(
|
||||
self,
|
||||
request: HttpRequest,
|
||||
dict_: Optional[Dict[str, Union[Dict[str, Union[Type[Any], str]], str]]] = ...,
|
||||
dict_: Optional[Dict[str, Any]] = ...,
|
||||
processors: Optional[List[Callable]] = ...,
|
||||
use_l10n: None = ...,
|
||||
use_tz: None = ...,
|
||||
@@ -92,22 +72,6 @@ class RequestContext(Context):
|
||||
) -> None: ...
|
||||
template: Optional[Template] = ...
|
||||
def bind_template(self, template: Template) -> Iterator[None]: ...
|
||||
def new(
|
||||
self,
|
||||
values: Optional[
|
||||
Union[
|
||||
Dict[str, Union[Dict[str, str], List[Dict[str, str]], bool]],
|
||||
Dict[str, Union[List[Any], ChangeList, int, str]],
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
List[Dict[str, Optional[Union[int, str]]]], List[ResultList], List[BoundField], ChangeList, int
|
||||
],
|
||||
],
|
||||
Dict[str, Union[ChangeList, int, range, str]],
|
||||
Context,
|
||||
]
|
||||
] = ...,
|
||||
) -> RequestContext: ...
|
||||
def new(self, values: Optional[_ContextValues] = ...) -> RequestContext: ...
|
||||
|
||||
def make_context(context: Any, request: Optional[HttpRequest] = ..., **kwargs: Any) -> Context: ...
|
||||
|
||||
@@ -2,97 +2,52 @@ from collections import namedtuple
|
||||
from datetime import date
|
||||
from typing import Any, Dict, List, Optional, Tuple, Union
|
||||
|
||||
from django.template.base import FilterExpression, NodeList, Parser, Token
|
||||
from django.template.context import Context, RequestContext
|
||||
from django.template.library import Library
|
||||
from django.template.base import FilterExpression, Parser, Token
|
||||
from django.template.context import RequestContext, Context
|
||||
from django.utils.safestring import SafeText
|
||||
|
||||
from .base import (
|
||||
BLOCK_TAG_END,
|
||||
BLOCK_TAG_START,
|
||||
COMMENT_TAG_END,
|
||||
COMMENT_TAG_START,
|
||||
FILTER_SEPARATOR,
|
||||
SINGLE_BRACE_END,
|
||||
SINGLE_BRACE_START,
|
||||
VARIABLE_ATTRIBUTE_SEPARATOR,
|
||||
VARIABLE_TAG_END,
|
||||
VARIABLE_TAG_START,
|
||||
Context,
|
||||
Node,
|
||||
NodeList,
|
||||
TemplateSyntaxError,
|
||||
VariableDoesNotExist,
|
||||
kwarg_re,
|
||||
render_value_in_context,
|
||||
token_kwargs,
|
||||
)
|
||||
from .defaultfilters import date
|
||||
from .base import Node, NodeList
|
||||
from .library import Library
|
||||
from .smartif import IfParser, Literal
|
||||
|
||||
register: Any
|
||||
|
||||
class AutoEscapeControlNode(Node):
|
||||
nodelist: django.template.base.NodeList
|
||||
origin: django.template.base.Origin
|
||||
nodelist: NodeList
|
||||
setting: bool
|
||||
token: django.template.base.Token
|
||||
def __init__(self, setting: bool, nodelist: NodeList) -> None: ...
|
||||
def render(self, context: Context) -> SafeText: ...
|
||||
|
||||
class CommentNode(Node):
|
||||
origin: django.template.base.Origin
|
||||
token: django.template.base.Token
|
||||
def render(self, context: Context) -> str: ...
|
||||
|
||||
class CsrfTokenNode(Node):
|
||||
origin: django.template.base.Origin
|
||||
token: django.template.base.Token
|
||||
def render(self, context: RequestContext) -> SafeText: ...
|
||||
class CommentNode(Node): ...
|
||||
class CsrfTokenNode(Node): ...
|
||||
|
||||
class CycleNode(Node):
|
||||
origin: django.template.base.Origin
|
||||
token: django.template.base.Token
|
||||
cyclevars: List[django.template.base.FilterExpression] = ...
|
||||
cyclevars: List[FilterExpression] = ...
|
||||
variable_name: Optional[str] = ...
|
||||
silent: bool = ...
|
||||
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 DebugNode(Node):
|
||||
origin: django.template.base.Origin
|
||||
token: django.template.base.Token
|
||||
def render(self, context: Context) -> str: ...
|
||||
class DebugNode(Node): ...
|
||||
|
||||
class FilterNode(Node):
|
||||
filter_expr: django.template.base.FilterExpression
|
||||
nodelist: django.template.base.NodeList
|
||||
origin: django.template.base.Origin
|
||||
token: django.template.base.Token
|
||||
filter_expr: FilterExpression
|
||||
nodelist: NodeList
|
||||
def __init__(self, filter_expr: FilterExpression, nodelist: NodeList) -> None: ...
|
||||
def render(self, context: Context) -> Any: ...
|
||||
|
||||
class FirstOfNode(Node):
|
||||
origin: django.template.base.Origin
|
||||
token: django.template.base.Token
|
||||
vars: List[django.template.base.FilterExpression] = ...
|
||||
vars: List[FilterExpression] = ...
|
||||
asvar: Optional[str] = ...
|
||||
def __init__(self, variables: List[FilterExpression], asvar: Optional[str] = ...) -> None: ...
|
||||
def render(self, context: Context) -> str: ...
|
||||
|
||||
class ForNode(Node):
|
||||
loopvars: Union[List[str], str]
|
||||
origin: django.template.base.Origin
|
||||
sequence: Union[django.template.base.FilterExpression, str]
|
||||
token: django.template.base.Token
|
||||
sequence: Union[FilterExpression, str]
|
||||
child_nodelists: Any = ...
|
||||
is_reversed: bool = ...
|
||||
nodelist_loop: Union[List[str], django.template.base.NodeList] = ...
|
||||
nodelist_empty: Union[List[str], django.template.base.NodeList] = ...
|
||||
nodelist_loop: Union[List[str], NodeList] = ...
|
||||
nodelist_empty: Union[List[str], NodeList] = ...
|
||||
def __init__(
|
||||
self,
|
||||
loopvars: Union[List[str], str],
|
||||
@@ -101,24 +56,18 @@ class ForNode(Node):
|
||||
nodelist_loop: Union[List[str], NodeList],
|
||||
nodelist_empty: Optional[Union[List[str], NodeList]] = ...,
|
||||
) -> None: ...
|
||||
def render(self, context: Context) -> SafeText: ...
|
||||
|
||||
class IfChangedNode(Node):
|
||||
nodelist_false: django.template.base.NodeList
|
||||
nodelist_true: django.template.base.NodeList
|
||||
origin: django.template.base.Origin
|
||||
token: django.template.base.Token
|
||||
nodelist_false: NodeList
|
||||
nodelist_true: NodeList
|
||||
child_nodelists: Any = ...
|
||||
def __init__(self, nodelist_true: NodeList, nodelist_false: NodeList, *varlist: Any) -> None: ...
|
||||
def render(self, context: Context) -> str: ...
|
||||
|
||||
class IfEqualNode(Node):
|
||||
nodelist_false: Union[List[Any], django.template.base.NodeList]
|
||||
nodelist_true: Union[List[Any], django.template.base.NodeList]
|
||||
origin: django.template.base.Origin
|
||||
token: django.template.base.Token
|
||||
var1: Union[django.template.base.FilterExpression, str]
|
||||
var2: Union[django.template.base.FilterExpression, str]
|
||||
nodelist_false: Union[List[Any], NodeList]
|
||||
nodelist_true: Union[List[Any], NodeList]
|
||||
var1: Union[FilterExpression, str]
|
||||
var2: Union[FilterExpression, str]
|
||||
child_nodelists: Any = ...
|
||||
negate: bool = ...
|
||||
def __init__(
|
||||
@@ -129,82 +78,53 @@ class IfEqualNode(Node):
|
||||
nodelist_false: Union[List[Any], NodeList],
|
||||
negate: bool,
|
||||
) -> None: ...
|
||||
def render(self, context: Context) -> SafeText: ...
|
||||
|
||||
class IfNode(Node):
|
||||
origin: django.template.base.Origin
|
||||
token: django.template.base.Token
|
||||
conditions_nodelists: List[
|
||||
Tuple[Optional[django.template.defaulttags.TemplateLiteral], django.template.base.NodeList]
|
||||
] = ...
|
||||
conditions_nodelists: List[Tuple[Optional[TemplateLiteral], NodeList]] = ...
|
||||
def __init__(self, conditions_nodelists: List[Tuple[Optional[TemplateLiteral], NodeList]]) -> None: ...
|
||||
def __iter__(self) -> None: ...
|
||||
@property
|
||||
def nodelist(self) -> NodeList: ...
|
||||
def render(self, context: Context) -> str: ...
|
||||
|
||||
class LoremNode(Node):
|
||||
common: bool
|
||||
count: django.template.base.FilterExpression
|
||||
count: FilterExpression
|
||||
method: str
|
||||
origin: django.template.base.Origin
|
||||
token: django.template.base.Token
|
||||
def __init__(self, count: FilterExpression, method: str, common: bool) -> None: ...
|
||||
def render(self, context: Context) -> str: ...
|
||||
|
||||
GroupedResult = namedtuple("GroupedResult", ["grouper", "list"])
|
||||
|
||||
class RegroupNode(Node):
|
||||
expression: django.template.base.FilterExpression
|
||||
origin: django.template.base.Origin
|
||||
target: django.template.base.FilterExpression
|
||||
token: django.template.base.Token
|
||||
expression: FilterExpression
|
||||
target: FilterExpression
|
||||
var_name: str = ...
|
||||
def __init__(self, target: FilterExpression, expression: FilterExpression, var_name: str) -> None: ...
|
||||
def resolve_expression(self, obj: Dict[str, date], context: Context) -> Union[int, str]: ...
|
||||
def render(self, context: Context) -> str: ...
|
||||
|
||||
class LoadNode(Node):
|
||||
origin: django.template.base.Origin
|
||||
token: django.template.base.Token
|
||||
def render(self, context: Context) -> str: ...
|
||||
class LoadNode(Node): ...
|
||||
|
||||
class NowNode(Node):
|
||||
origin: django.template.base.Origin
|
||||
token: django.template.base.Token
|
||||
format_string: str = ...
|
||||
asvar: Optional[str] = ...
|
||||
def __init__(self, format_string: str, asvar: Optional[str] = ...) -> None: ...
|
||||
def render(self, context: Context) -> str: ...
|
||||
|
||||
class ResetCycleNode(Node):
|
||||
origin: django.template.base.Origin
|
||||
token: django.template.base.Token
|
||||
node: django.template.defaulttags.CycleNode = ...
|
||||
node: CycleNode = ...
|
||||
def __init__(self, node: CycleNode) -> None: ...
|
||||
def render(self, context: Context) -> str: ...
|
||||
|
||||
class SpacelessNode(Node):
|
||||
origin: django.template.base.Origin
|
||||
token: django.template.base.Token
|
||||
nodelist: django.template.base.NodeList = ...
|
||||
nodelist: NodeList = ...
|
||||
def __init__(self, nodelist: NodeList) -> None: ...
|
||||
def render(self, context: Context) -> str: ...
|
||||
|
||||
class TemplateTagNode(Node):
|
||||
origin: django.template.base.Origin
|
||||
token: django.template.base.Token
|
||||
mapping: Any = ...
|
||||
tagtype: str = ...
|
||||
def __init__(self, tagtype: str) -> None: ...
|
||||
def render(self, context: Context) -> str: ...
|
||||
|
||||
class URLNode(Node):
|
||||
origin: django.template.base.Origin
|
||||
token: django.template.base.Token
|
||||
view_name: django.template.base.FilterExpression = ...
|
||||
args: List[django.template.base.FilterExpression] = ...
|
||||
kwargs: Dict[str, django.template.base.FilterExpression] = ...
|
||||
view_name: FilterExpression = ...
|
||||
args: List[FilterExpression] = ...
|
||||
kwargs: Dict[str, FilterExpression] = ...
|
||||
asvar: Optional[str] = ...
|
||||
def __init__(
|
||||
self,
|
||||
@@ -213,21 +133,15 @@ class URLNode(Node):
|
||||
kwargs: Dict[str, FilterExpression],
|
||||
asvar: Optional[str],
|
||||
) -> None: ...
|
||||
def render(self, context: Context) -> str: ...
|
||||
|
||||
class VerbatimNode(Node):
|
||||
origin: django.template.base.Origin
|
||||
token: django.template.base.Token
|
||||
content: django.utils.safestring.SafeText = ...
|
||||
content: SafeText = ...
|
||||
def __init__(self, content: SafeText) -> None: ...
|
||||
def render(self, context: Context) -> SafeText: ...
|
||||
|
||||
class WidthRatioNode(Node):
|
||||
origin: django.template.base.Origin
|
||||
token: django.template.base.Token
|
||||
val_expr: django.template.base.FilterExpression = ...
|
||||
max_expr: django.template.base.FilterExpression = ...
|
||||
max_width: django.template.base.FilterExpression = ...
|
||||
val_expr: FilterExpression = ...
|
||||
max_expr: FilterExpression = ...
|
||||
max_width: FilterExpression = ...
|
||||
asvar: Optional[str] = ...
|
||||
def __init__(
|
||||
self,
|
||||
@@ -236,21 +150,13 @@ class WidthRatioNode(Node):
|
||||
max_width: FilterExpression,
|
||||
asvar: Optional[str] = ...,
|
||||
) -> None: ...
|
||||
def render(self, context: Context) -> str: ...
|
||||
|
||||
class WithNode(Node):
|
||||
origin: django.template.base.Origin
|
||||
token: django.template.base.Token
|
||||
nodelist: Union[List[Any], django.template.base.NodeList] = ...
|
||||
extra_context: Dict[str, Union[django.template.base.FilterExpression, str]] = ...
|
||||
nodelist: NodeList = ...
|
||||
extra_context: Dict[str, Union[FilterExpression, str]] = ...
|
||||
def __init__(
|
||||
self,
|
||||
var: Optional[str],
|
||||
name: Optional[str],
|
||||
nodelist: Union[List[Any], NodeList],
|
||||
extra_context: Optional[Dict[str, FilterExpression]] = ...,
|
||||
self, var: Optional[str], name: Optional[str], nodelist: NodeList, extra_context: Optional[Dict[str, Any]] = ...
|
||||
) -> None: ...
|
||||
def render(self, context: Context) -> Any: ...
|
||||
|
||||
def autoescape(parser: Parser, token: Token) -> AutoEscapeControlNode: ...
|
||||
def comment(parser: Parser, token: Token) -> CommentNode: ...
|
||||
@@ -265,20 +171,17 @@ def ifequal(parser: Parser, token: Token) -> IfEqualNode: ...
|
||||
def ifnotequal(parser: Parser, token: Token) -> IfEqualNode: ...
|
||||
|
||||
class TemplateLiteral(Literal):
|
||||
value: django.template.base.FilterExpression = ...
|
||||
text: str = ...
|
||||
def __init__(self, value: FilterExpression, text: str) -> None: ...
|
||||
def display(self) -> str: ...
|
||||
def eval(self, context: Context) -> Any: ...
|
||||
|
||||
class TemplateIfParser(IfParser):
|
||||
current_token: django.template.defaulttags.TemplateLiteral
|
||||
current_token: TemplateLiteral
|
||||
pos: int
|
||||
tokens: List[django.template.defaulttags.TemplateLiteral]
|
||||
tokens: List[TemplateLiteral]
|
||||
error_class: Any = ...
|
||||
template_parser: django.template.base.Parser = ...
|
||||
template_parser: Parser = ...
|
||||
def __init__(self, parser: Parser, *args: Any, **kwargs: Any) -> None: ...
|
||||
def create_var(self, value: str) -> TemplateLiteral: ...
|
||||
|
||||
def do_if(parser: Parser, token: Token) -> IfNode: ...
|
||||
def ifchanged(parser: Parser, token: Token) -> IfChangedNode: ...
|
||||
|
||||
@@ -1,18 +1,15 @@
|
||||
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
|
||||
|
||||
from django.template.base import Origin, Template
|
||||
from django.template.base import Origin
|
||||
from django.template.library import Library
|
||||
from django.template.loaders.base import Loader
|
||||
from django.utils.safestring import SafeText
|
||||
|
||||
from .base import Context, Template
|
||||
from .context import _builtin_context_processors
|
||||
from .exceptions import TemplateDoesNotExist
|
||||
from .library import import_library
|
||||
from .base import Template
|
||||
|
||||
class Engine:
|
||||
template_context_processors: Tuple[Callable]
|
||||
template_loaders: List[django.template.loaders.base.Loader]
|
||||
template_loaders: List[Loader]
|
||||
default_builtins: Any = ...
|
||||
dirs: List[str] = ...
|
||||
app_dirs: bool = ...
|
||||
@@ -23,9 +20,9 @@ class Engine:
|
||||
string_if_invalid: str = ...
|
||||
file_charset: str = ...
|
||||
libraries: Dict[str, str] = ...
|
||||
template_libraries: Dict[str, django.template.library.Library] = ...
|
||||
template_libraries: Dict[str, Library] = ...
|
||||
builtins: List[str] = ...
|
||||
template_builtins: List[django.template.library.Library] = ...
|
||||
template_builtins: List[Library] = ...
|
||||
def __init__(
|
||||
self,
|
||||
dirs: Optional[List[str]] = ...,
|
||||
@@ -41,10 +38,8 @@ class Engine:
|
||||
) -> None: ...
|
||||
@staticmethod
|
||||
def get_default() -> Engine: ...
|
||||
def template_context_processors(self) -> Tuple[Callable]: ...
|
||||
def get_template_builtins(self, builtins: List[str]) -> List[Library]: ...
|
||||
def get_template_libraries(self, libraries: Dict[str, str]) -> Dict[str, Library]: ...
|
||||
def template_loaders(self) -> List[Loader]: ...
|
||||
def get_template_loaders(
|
||||
self, template_loaders: Union[List[List[Union[Dict[str, str], str]]], List[Tuple[str, List[str]]], List[str]]
|
||||
) -> List[Loader]: ...
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
from typing import Any, List, Optional, Tuple, Union
|
||||
from typing import List, Optional, Tuple, Union
|
||||
|
||||
from django.template.backends.base import BaseEngine
|
||||
from django.template.base import Origin
|
||||
|
||||
class TemplateDoesNotExist(Exception):
|
||||
backend: Optional[django.template.backends.base.BaseEngine] = ...
|
||||
tried: List[Tuple[django.template.base.Origin, str]] = ...
|
||||
chain: List[django.template.exceptions.TemplateDoesNotExist] = ...
|
||||
backend: Optional[BaseEngine] = ...
|
||||
tried: List[Tuple[Origin, str]] = ...
|
||||
chain: List[TemplateDoesNotExist] = ...
|
||||
def __init__(
|
||||
self,
|
||||
msg: Union[Origin, str],
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
|
||||
|
||||
from django.template.base import FilterExpression, Parser, Template
|
||||
from django.template.base import FilterExpression, Parser, Origin, Token
|
||||
from django.template.context import Context
|
||||
from django.utils.safestring import SafeText
|
||||
|
||||
from .base import Node, Template
|
||||
from .exceptions import TemplateSyntaxError as TemplateSyntaxError
|
||||
|
||||
class InvalidTemplateLibrary(Exception): ...
|
||||
|
||||
@@ -53,9 +52,9 @@ class SimpleNode(TagHelperNode):
|
||||
args: List[FilterExpression]
|
||||
func: Callable
|
||||
kwargs: Dict[str, FilterExpression]
|
||||
origin: django.template.base.Origin
|
||||
origin: Origin
|
||||
takes_context: Optional[bool]
|
||||
token: django.template.base.Token
|
||||
token: Token
|
||||
target_var: Optional[str] = ...
|
||||
def __init__(
|
||||
self,
|
||||
@@ -65,15 +64,14 @@ class SimpleNode(TagHelperNode):
|
||||
kwargs: Dict[str, FilterExpression],
|
||||
target_var: Optional[str],
|
||||
) -> None: ...
|
||||
def render(self, context: Context) -> str: ...
|
||||
|
||||
class InclusionNode(TagHelperNode):
|
||||
args: List[FilterExpression]
|
||||
func: Callable
|
||||
kwargs: Dict[str, FilterExpression]
|
||||
origin: django.template.base.Origin
|
||||
origin: Origin
|
||||
takes_context: Optional[bool]
|
||||
token: django.template.base.Token
|
||||
token: Token
|
||||
filename: Union[Template, str] = ...
|
||||
def __init__(
|
||||
self,
|
||||
@@ -83,7 +81,6 @@ class InclusionNode(TagHelperNode):
|
||||
kwargs: Dict[str, FilterExpression],
|
||||
filename: Optional[Union[Template, str]],
|
||||
) -> None: ...
|
||||
def render(self, context: Context) -> SafeText: ...
|
||||
|
||||
def parse_bits(
|
||||
parser: Parser,
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import collections
|
||||
from typing import Any, Dict, List, Optional, Union
|
||||
|
||||
from django.template.base import FilterExpression, Node, NodeList, Parser, Template, Token
|
||||
from django.template.base import FilterExpression, NodeList, Parser, Token, Origin
|
||||
from django.template.context import Context
|
||||
from django.utils.safestring import SafeText
|
||||
|
||||
from .base import Node, Template, TemplateSyntaxError, TextNode, Variable, token_kwargs
|
||||
from .library import Library
|
||||
from .base import Node, Template
|
||||
|
||||
register: Any
|
||||
BLOCK_CONTEXT_KEY: str
|
||||
@@ -19,25 +19,25 @@ class BlockContext:
|
||||
def get_block(self, name: str) -> BlockNode: ...
|
||||
|
||||
class BlockNode(Node):
|
||||
context: django.template.context.Context
|
||||
context: Context
|
||||
name: str
|
||||
nodelist: django.template.base.NodeList
|
||||
origin: django.template.base.Origin
|
||||
nodelist: NodeList
|
||||
origin: Origin
|
||||
parent: None
|
||||
token: django.template.base.Token
|
||||
token: Token
|
||||
def __init__(self, name: str, nodelist: NodeList, parent: None = ...) -> None: ...
|
||||
def render(self, context: Context) -> SafeText: ...
|
||||
def super(self) -> SafeText: ...
|
||||
|
||||
class ExtendsNode(Node):
|
||||
origin: django.template.base.Origin
|
||||
token: django.template.base.Token
|
||||
origin: Origin
|
||||
token: Token
|
||||
must_be_first: bool = ...
|
||||
context_key: str = ...
|
||||
nodelist: django.template.base.NodeList = ...
|
||||
parent_name: Union[django.template.base.FilterExpression, django.template.base.Node] = ...
|
||||
nodelist: NodeList = ...
|
||||
parent_name: Union[FilterExpression, Node] = ...
|
||||
template_dirs: Optional[List[Any]] = ...
|
||||
blocks: Dict[str, django.template.loader_tags.BlockNode] = ...
|
||||
blocks: Dict[str, BlockNode] = ...
|
||||
def __init__(
|
||||
self, nodelist: NodeList, parent_name: Union[FilterExpression, Node], template_dirs: Optional[List[Any]] = ...
|
||||
) -> None: ...
|
||||
@@ -46,11 +46,11 @@ class ExtendsNode(Node):
|
||||
def render(self, context: Context) -> Any: ...
|
||||
|
||||
class IncludeNode(Node):
|
||||
origin: django.template.base.Origin
|
||||
token: django.template.base.Token
|
||||
origin: Origin
|
||||
token: Token
|
||||
context_key: str = ...
|
||||
template: django.template.base.FilterExpression = ...
|
||||
extra_context: Dict[str, django.template.base.FilterExpression] = ...
|
||||
template: FilterExpression = ...
|
||||
extra_context: Dict[str, FilterExpression] = ...
|
||||
isolated_context: bool = ...
|
||||
def __init__(
|
||||
self,
|
||||
|
||||
@@ -6,7 +6,7 @@ from django.template.engine import Engine
|
||||
from .base import Loader as BaseLoader
|
||||
|
||||
class Loader(BaseLoader):
|
||||
engine: django.template.engine.Engine
|
||||
engine: Engine
|
||||
template_cache: Dict[Any, Any] = ...
|
||||
get_template_cache: Dict[str, django.template.exceptions.TemplateDoesNotExist] = ...
|
||||
loaders: List[django.template.loaders.base.Loader] = ...
|
||||
|
||||
@@ -6,7 +6,7 @@ from django.template.engine import Engine
|
||||
from .base import Loader as BaseLoader
|
||||
|
||||
class Loader(BaseLoader):
|
||||
engine: django.template.engine.Engine
|
||||
engine: Engine
|
||||
dirs: Optional[List[str]] = ...
|
||||
def __init__(self, engine: Engine, dirs: Optional[List[str]] = ...) -> None: ...
|
||||
def get_dirs(self) -> Union[List[bytes], List[str]]: ...
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
from datetime import datetime
|
||||
import functools
|
||||
from http.cookies import SimpleCookie
|
||||
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
from django.db.models.base import Model
|
||||
from django.http import HttpResponse
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.http.request import HttpRequest
|
||||
from django.template.backends.django import Template
|
||||
from django.template.backends.jinja2 import Template
|
||||
from django.views.generic.base import TemplateResponseMixin
|
||||
from django.template.base import Template
|
||||
from django.template.context import RequestContext
|
||||
from django.test.client import Client
|
||||
from django.utils.functional import SimpleLazyObject
|
||||
|
||||
from .loader import get_template as get_template, select_template as select_template
|
||||
from django.http import HttpResponse
|
||||
|
||||
class ContentNotRenderedError(Exception): ...
|
||||
|
||||
@@ -47,36 +46,26 @@ class SimpleTemplateResponse(HttpResponse):
|
||||
def content(self, value: Any) -> None: ...
|
||||
|
||||
class TemplateResponse(SimpleTemplateResponse):
|
||||
client: django.test.client.Client
|
||||
client: Client
|
||||
closed: bool
|
||||
context: django.template.context.RequestContext
|
||||
context: RequestContext
|
||||
context_data: Optional[Dict[str, Any]]
|
||||
cookies: SimpleCookie
|
||||
csrf_cookie_set: bool
|
||||
json: functools.partial
|
||||
redirect_chain: List[Tuple[str, int]]
|
||||
request: Dict[str, Union[django.test.client.FakePayload, int, str]]
|
||||
resolver_match: django.utils.functional.SimpleLazyObject
|
||||
request: Dict[str, Union[int, str]]
|
||||
status_code: int
|
||||
template_name: Union[List[str], django.template.backends.django.Template, str]
|
||||
template_name: Union[List[str], Template, str]
|
||||
templates: List[Template]
|
||||
using: Optional[str]
|
||||
wsgi_request: django.core.handlers.wsgi.WSGIRequest
|
||||
wsgi_request: WSGIRequest
|
||||
rendering_attrs: Any = ...
|
||||
def __init__(
|
||||
self,
|
||||
request: HttpRequest,
|
||||
template: Union[List[str], Template, str],
|
||||
context: Optional[
|
||||
Union[
|
||||
Dict[str, List[Dict[str, Optional[Union[datetime, Model, str]]]]],
|
||||
Dict[str, List[str]],
|
||||
Dict[str, Model],
|
||||
Dict[str, TemplateResponseMixin],
|
||||
Dict[str, str],
|
||||
MagicMock,
|
||||
]
|
||||
] = ...,
|
||||
context: Optional[Dict[str, Any]] = ...,
|
||||
content_type: Optional[str] = ...,
|
||||
status: Optional[int] = ...,
|
||||
charset: None = ...,
|
||||
|
||||
@@ -2,6 +2,8 @@ from typing import Any, Dict, List, Optional, Union
|
||||
|
||||
from django.template.defaulttags import TemplateLiteral
|
||||
|
||||
_Token = Union[List[int], int, str]
|
||||
|
||||
class TokenBase:
|
||||
id: Any = ...
|
||||
value: Any = ...
|
||||
@@ -19,11 +21,10 @@ OPERATORS: Any
|
||||
class Literal(TokenBase):
|
||||
id: str = ...
|
||||
lbp: int = ...
|
||||
value: Optional[Union[List[int], int]] = ...
|
||||
def __init__(self, value: Optional[Union[List[int], int]]) -> None: ...
|
||||
value: Optional[_Token] = ...
|
||||
def __init__(self, value: Optional[_Token]) -> None: ...
|
||||
def display(self): ...
|
||||
def nud(self, parser: IfParser) -> Literal: ...
|
||||
def eval(self, context: Dict[Any, Any]) -> Optional[Union[List[int], int]]: ...
|
||||
def eval(self, context: Dict[Any, Any]) -> Optional[_Token]: ...
|
||||
|
||||
class EndToken(TokenBase):
|
||||
lbp: int = ...
|
||||
@@ -34,14 +35,9 @@ class IfParser:
|
||||
tokens: Any = ...
|
||||
pos: int = ...
|
||||
current_token: Any = ...
|
||||
def __init__(
|
||||
self,
|
||||
tokens: Union[
|
||||
List[Optional[Union[List[int], str]]], List[Optional[Union[int, str]]], List[Union[List[int], int, str]]
|
||||
],
|
||||
) -> None: ...
|
||||
def translate_token(self, token: Optional[Union[List[int], int, str]]) -> Literal: ...
|
||||
def __init__(self, tokens: List[Optional[_Token]]) -> None: ...
|
||||
def translate_token(self, token: Optional[_Token]) -> Literal: ...
|
||||
def next_token(self) -> Literal: ...
|
||||
def parse(self) -> TemplateLiteral: ...
|
||||
def expression(self, rbp: int = ...) -> Literal: ...
|
||||
def create_var(self, value: Optional[Union[List[int], int]]) -> Literal: ...
|
||||
def create_var(self, value: Optional[_Token]) -> Literal: ...
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import collections
|
||||
from collections import OrderedDict
|
||||
from typing import Any, Dict, List, Tuple, Union
|
||||
from typing import Any, Dict, List, Tuple
|
||||
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
from django.template.backends.base import BaseEngine
|
||||
@@ -9,8 +8,7 @@ class InvalidTemplateEngineError(ImproperlyConfigured): ...
|
||||
|
||||
class EngineHandler:
|
||||
templates: collections.OrderedDict
|
||||
def __init__(self, templates: List[Dict[str, Union[Dict[str, bool], str]]] = ...) -> None: ...
|
||||
def templates(self) -> OrderedDict: ...
|
||||
def __init__(self, templates: List[Dict[str, Any]] = ...) -> None: ...
|
||||
def __getitem__(self, alias: str) -> BaseEngine: ...
|
||||
def __iter__(self) -> Any: ...
|
||||
def all(self) -> List[BaseEngine]: ...
|
||||
|
||||
Reference in New Issue
Block a user