Big diff: use lower-case list and dict (#5888)

This commit is contained in:
Akuli
2021-08-08 19:26:35 +03:00
committed by GitHub
parent 11f54c3407
commit ce11072dbe
325 changed files with 2196 additions and 2334 deletions

View File

@@ -18,5 +18,5 @@ TRIM_BLOCKS: bool
LSTRIP_BLOCKS: bool
NEWLINE_SEQUENCE: str
KEEP_TRAILING_NEWLINE: bool
DEFAULT_NAMESPACE: Dict[str, Any]
DEFAULT_NAMESPACE: dict[str, Any]
DEFAULT_POLICIES = Dict[str, Any]

View File

@@ -1,5 +1,5 @@
import sys
from typing import Any, Callable, Dict, Iterator, List, Sequence, Text, Type
from typing import Any, Callable, Iterator, Sequence, Text, Type
from .bccache import BytecodeCache
from .loaders import BaseLoader
@@ -40,12 +40,12 @@ class Environment:
autoescape: Any
filters: Any
tests: Any
globals: Dict[str, Any]
globals: dict[str, Any]
loader: BaseLoader
cache: Any
bytecode_cache: BytecodeCache
auto_reload: bool
extensions: List[Any]
extensions: list[Any]
def __init__(
self,
block_start_string: Text = ...,
@@ -60,7 +60,7 @@ class Environment:
lstrip_blocks: bool = ...,
newline_sequence: Text = ...,
keep_trailing_newline: bool = ...,
extensions: List[Any] = ...,
extensions: list[Any] = ...,
optimized: bool = ...,
undefined: Type[Undefined] = ...,
finalize: Callable[..., Any] | None = ...,
@@ -85,7 +85,7 @@ class Environment:
line_comment_prefix: Text = ...,
trim_blocks: bool = ...,
lstrip_blocks: bool = ...,
extensions: List[Any] = ...,
extensions: list[Any] = ...,
optimized: bool = ...,
undefined: Type[Undefined] = ...,
finalize: Callable[..., Any] = ...,
@@ -123,18 +123,18 @@ class Environment:
def join_path(self, template: Template | Text, parent: Text) -> Text: ...
def get_template(self, name: Template | Text, parent: Text | None = ..., globals: Any | None = ...) -> Template: ...
def select_template(
self, names: Sequence[Template | Text], parent: Text | None = ..., globals: Dict[str, Any] | None = ...
self, names: Sequence[Template | Text], parent: Text | None = ..., globals: dict[str, Any] | None = ...
) -> Template: ...
def get_or_select_template(
self,
template_name_or_list: Template | Text | Sequence[Template | Text],
parent: Text | None = ...,
globals: Dict[str, Any] | None = ...,
globals: dict[str, Any] | None = ...,
) -> Template: ...
def from_string(
self, source: Text, globals: Dict[str, Any] | None = ..., template_class: Type[Template] | None = ...
self, source: Text, globals: dict[str, Any] | None = ..., template_class: Type[Template] | None = ...
) -> Template: ...
def make_globals(self, d: Dict[str, Any] | None) -> Dict[str, Any]: ...
def make_globals(self, d: dict[str, Any] | None) -> dict[str, Any]: ...
# Frequently added extensions are included here:
# from InternationalizationExtension:
def install_gettext_translations(self, translations: Any, newstyle: bool | None = ...): ...
@@ -179,10 +179,10 @@ class Template:
def stream(self, *args, **kwargs) -> TemplateStream: ...
def generate(self, *args, **kwargs) -> Iterator[Text]: ...
def new_context(
self, vars: Dict[str, Any] | None = ..., shared: bool = ..., locals: Dict[str, Any] | None = ...
self, vars: dict[str, Any] | None = ..., shared: bool = ..., locals: dict[str, Any] | None = ...
) -> Context: ...
def make_module(
self, vars: Dict[str, Any] | None = ..., shared: bool = ..., locals: Dict[str, Any] | None = ...
self, vars: dict[str, Any] | None = ..., shared: bool = ..., locals: dict[str, Any] | None = ...
) -> Context: ...
@property
def module(self) -> Any: ...

View File

@@ -1,6 +1,6 @@
import sys
from types import ModuleType
from typing import Any, Callable, Iterable, List, Text, Tuple, Union
from typing import Any, Callable, Iterable, Text, Tuple, Union
from .environment import Environment
@@ -11,7 +11,7 @@ if sys.version_info >= (3, 7):
else:
_SearchPath = Union[Text, Iterable[Text]]
def split_template_path(template: Text) -> List[Text]: ...
def split_template_path(template: Text) -> list[Text]: ...
class BaseLoader:
has_source_access: bool

View File

@@ -1,4 +1,4 @@
from typing import Any, Dict, Text
from typing import Any, Text
from jinja2.environment import Environment
from jinja2.exceptions import TemplateNotFound as TemplateNotFound, TemplateRuntimeError as TemplateRuntimeError
@@ -15,15 +15,15 @@ class TemplateReference:
def __getitem__(self, name): ...
class Context:
parent: Context | Dict[str, Any]
vars: Dict[str, Any]
parent: Context | dict[str, Any]
vars: dict[str, Any]
environment: Environment
eval_ctx: Any
exported_vars: Any
name: Text
blocks: Dict[str, Any]
blocks: dict[str, Any]
def __init__(
self, environment: Environment, parent: Context | Dict[str, Any], name: Text, blocks: Dict[str, Any]
self, environment: Environment, parent: Context | dict[str, Any], name: Text, blocks: dict[str, Any]
) -> None: ...
def super(self, name, current): ...
def get(self, key, default: Any | None = ...): ...