mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-02-22 01:28:29 +08:00
Re-organize directory structure (#4971)
See discussion in #2491 Co-authored-by: Ivan Levkivskyi <ilevkivskyi@dropbox.com>
This commit is contained in:
3
stubs/Jinja2/METADATA.toml
Normal file
3
stubs/Jinja2/METADATA.toml
Normal file
@@ -0,0 +1,3 @@
|
||||
version = "0.1"
|
||||
python2 = true
|
||||
requires = ["types-MarkupSafe", "types-typing-extensions"]
|
||||
45
stubs/Jinja2/jinja2/__init__.pyi
Normal file
45
stubs/Jinja2/jinja2/__init__.pyi
Normal file
@@ -0,0 +1,45 @@
|
||||
from jinja2.bccache import (
|
||||
BytecodeCache as BytecodeCache,
|
||||
FileSystemBytecodeCache as FileSystemBytecodeCache,
|
||||
MemcachedBytecodeCache as MemcachedBytecodeCache,
|
||||
)
|
||||
from jinja2.environment import Environment as Environment, Template as Template
|
||||
from jinja2.exceptions import (
|
||||
TemplateAssertionError as TemplateAssertionError,
|
||||
TemplateError as TemplateError,
|
||||
TemplateNotFound as TemplateNotFound,
|
||||
TemplatesNotFound as TemplatesNotFound,
|
||||
TemplateSyntaxError as TemplateSyntaxError,
|
||||
UndefinedError as UndefinedError,
|
||||
)
|
||||
from jinja2.filters import (
|
||||
contextfilter as contextfilter,
|
||||
environmentfilter as environmentfilter,
|
||||
evalcontextfilter as evalcontextfilter,
|
||||
)
|
||||
from jinja2.loaders import (
|
||||
BaseLoader as BaseLoader,
|
||||
ChoiceLoader as ChoiceLoader,
|
||||
DictLoader as DictLoader,
|
||||
FileSystemLoader as FileSystemLoader,
|
||||
FunctionLoader as FunctionLoader,
|
||||
ModuleLoader as ModuleLoader,
|
||||
PackageLoader as PackageLoader,
|
||||
PrefixLoader as PrefixLoader,
|
||||
)
|
||||
from jinja2.runtime import (
|
||||
DebugUndefined as DebugUndefined,
|
||||
StrictUndefined as StrictUndefined,
|
||||
Undefined as Undefined,
|
||||
make_logging_undefined as make_logging_undefined,
|
||||
)
|
||||
from jinja2.utils import (
|
||||
Markup as Markup,
|
||||
clear_caches as clear_caches,
|
||||
contextfunction as contextfunction,
|
||||
environmentfunction as environmentfunction,
|
||||
escape as escape,
|
||||
evalcontextfunction as evalcontextfunction,
|
||||
is_undefined as is_undefined,
|
||||
select_autoescape as select_autoescape,
|
||||
)
|
||||
36
stubs/Jinja2/jinja2/_compat.pyi
Normal file
36
stubs/Jinja2/jinja2/_compat.pyi
Normal file
@@ -0,0 +1,36 @@
|
||||
import sys
|
||||
from typing import Any, Optional
|
||||
|
||||
if sys.version_info >= (3,):
|
||||
from urllib.parse import quote_from_bytes
|
||||
|
||||
url_quote = quote_from_bytes
|
||||
else:
|
||||
import urllib
|
||||
|
||||
url_quote = urllib.quote
|
||||
|
||||
PY2: Any
|
||||
PYPY: Any
|
||||
unichr: Any
|
||||
range_type: Any
|
||||
text_type: Any
|
||||
string_types: Any
|
||||
integer_types: Any
|
||||
iterkeys: Any
|
||||
itervalues: Any
|
||||
iteritems: Any
|
||||
NativeStringIO: Any
|
||||
|
||||
def reraise(tp, value, tb: Optional[Any] = ...): ...
|
||||
|
||||
ifilter: Any
|
||||
imap: Any
|
||||
izip: Any
|
||||
intern: Any
|
||||
implements_iterator: Any
|
||||
implements_to_string: Any
|
||||
encode_filename: Any
|
||||
get_next: Any
|
||||
|
||||
def with_metaclass(meta, *bases): ...
|
||||
40
stubs/Jinja2/jinja2/_stringdefs.pyi
Normal file
40
stubs/Jinja2/jinja2/_stringdefs.pyi
Normal file
@@ -0,0 +1,40 @@
|
||||
from typing import Any
|
||||
|
||||
Cc: str
|
||||
Cf: str
|
||||
Cn: str
|
||||
Co: str
|
||||
Cs: Any
|
||||
Ll: str
|
||||
Lm: str
|
||||
Lo: str
|
||||
Lt: str
|
||||
Lu: str
|
||||
Mc: str
|
||||
Me: str
|
||||
Mn: str
|
||||
Nd: str
|
||||
Nl: str
|
||||
No: str
|
||||
Pc: str
|
||||
Pd: str
|
||||
Pe: str
|
||||
Pf: str
|
||||
Pi: str
|
||||
Po: str
|
||||
Ps: str
|
||||
Sc: str
|
||||
Sk: str
|
||||
Sm: str
|
||||
So: str
|
||||
Zl: str
|
||||
Zp: str
|
||||
Zs: str
|
||||
cats: Any
|
||||
|
||||
def combine(*args): ...
|
||||
|
||||
xid_start: str
|
||||
xid_continue: str
|
||||
|
||||
def allexcept(*args): ...
|
||||
44
stubs/Jinja2/jinja2/bccache.pyi
Normal file
44
stubs/Jinja2/jinja2/bccache.pyi
Normal file
@@ -0,0 +1,44 @@
|
||||
from typing import Any, Optional
|
||||
|
||||
marshal_dump: Any
|
||||
marshal_load: Any
|
||||
bc_version: int
|
||||
bc_magic: Any
|
||||
|
||||
class Bucket:
|
||||
environment: Any
|
||||
key: Any
|
||||
checksum: Any
|
||||
def __init__(self, environment, key, checksum) -> None: ...
|
||||
code: Any
|
||||
def reset(self): ...
|
||||
def load_bytecode(self, f): ...
|
||||
def write_bytecode(self, f): ...
|
||||
def bytecode_from_string(self, string): ...
|
||||
def bytecode_to_string(self): ...
|
||||
|
||||
class BytecodeCache:
|
||||
def load_bytecode(self, bucket): ...
|
||||
def dump_bytecode(self, bucket): ...
|
||||
def clear(self): ...
|
||||
def get_cache_key(self, name, filename: Optional[Any] = ...): ...
|
||||
def get_source_checksum(self, source): ...
|
||||
def get_bucket(self, environment, name, filename, source): ...
|
||||
def set_bucket(self, bucket): ...
|
||||
|
||||
class FileSystemBytecodeCache(BytecodeCache):
|
||||
directory: Any
|
||||
pattern: Any
|
||||
def __init__(self, directory: Optional[Any] = ..., pattern: str = ...) -> None: ...
|
||||
def load_bytecode(self, bucket): ...
|
||||
def dump_bytecode(self, bucket): ...
|
||||
def clear(self): ...
|
||||
|
||||
class MemcachedBytecodeCache(BytecodeCache):
|
||||
client: Any
|
||||
prefix: Any
|
||||
timeout: Any
|
||||
ignore_memcache_errors: Any
|
||||
def __init__(self, client, prefix: str = ..., timeout: Optional[Any] = ..., ignore_memcache_errors: bool = ...) -> None: ...
|
||||
def load_bytecode(self, bucket): ...
|
||||
def dump_bytecode(self, bucket): ...
|
||||
177
stubs/Jinja2/jinja2/compiler.pyi
Normal file
177
stubs/Jinja2/jinja2/compiler.pyi
Normal file
@@ -0,0 +1,177 @@
|
||||
from keyword import iskeyword as is_python_keyword
|
||||
from typing import Any, Optional
|
||||
|
||||
from jinja2.visitor import NodeVisitor
|
||||
|
||||
operators: Any
|
||||
dict_item_iter: str
|
||||
|
||||
unoptimize_before_dead_code: bool
|
||||
|
||||
def generate(node, environment, name, filename, stream: Optional[Any] = ..., defer_init: bool = ...): ...
|
||||
def has_safe_repr(value): ...
|
||||
def find_undeclared(nodes, names): ...
|
||||
|
||||
class Identifiers:
|
||||
declared: Any
|
||||
outer_undeclared: Any
|
||||
undeclared: Any
|
||||
declared_locally: Any
|
||||
declared_parameter: Any
|
||||
def __init__(self) -> None: ...
|
||||
def add_special(self, name): ...
|
||||
def is_declared(self, name): ...
|
||||
def copy(self): ...
|
||||
|
||||
class Frame:
|
||||
eval_ctx: Any
|
||||
identifiers: Any
|
||||
toplevel: bool
|
||||
rootlevel: bool
|
||||
require_output_check: Any
|
||||
buffer: Any
|
||||
block: Any
|
||||
assigned_names: Any
|
||||
parent: Any
|
||||
def __init__(self, eval_ctx, parent: Optional[Any] = ...) -> None: ...
|
||||
def copy(self): ...
|
||||
def inspect(self, nodes): ...
|
||||
def find_shadowed(self, extra: Any = ...): ...
|
||||
def inner(self): ...
|
||||
def soft(self): ...
|
||||
__copy__: Any
|
||||
|
||||
class VisitorExit(RuntimeError): ...
|
||||
|
||||
class DependencyFinderVisitor(NodeVisitor):
|
||||
filters: Any
|
||||
tests: Any
|
||||
def __init__(self) -> None: ...
|
||||
def visit_Filter(self, node): ...
|
||||
def visit_Test(self, node): ...
|
||||
def visit_Block(self, node): ...
|
||||
|
||||
class UndeclaredNameVisitor(NodeVisitor):
|
||||
names: Any
|
||||
undeclared: Any
|
||||
def __init__(self, names) -> None: ...
|
||||
def visit_Name(self, node): ...
|
||||
def visit_Block(self, node): ...
|
||||
|
||||
class FrameIdentifierVisitor(NodeVisitor):
|
||||
identifiers: Any
|
||||
def __init__(self, identifiers) -> None: ...
|
||||
def visit_Name(self, node): ...
|
||||
def visit_If(self, node): ...
|
||||
def visit_Macro(self, node): ...
|
||||
def visit_Import(self, node): ...
|
||||
def visit_FromImport(self, node): ...
|
||||
def visit_Assign(self, node): ...
|
||||
def visit_For(self, node): ...
|
||||
def visit_CallBlock(self, node): ...
|
||||
def visit_FilterBlock(self, node): ...
|
||||
def visit_AssignBlock(self, node): ...
|
||||
def visit_Scope(self, node): ...
|
||||
def visit_Block(self, node): ...
|
||||
|
||||
class CompilerExit(Exception): ...
|
||||
|
||||
class CodeGenerator(NodeVisitor):
|
||||
environment: Any
|
||||
name: Any
|
||||
filename: Any
|
||||
stream: Any
|
||||
created_block_context: bool
|
||||
defer_init: Any
|
||||
import_aliases: Any
|
||||
blocks: Any
|
||||
extends_so_far: int
|
||||
has_known_extends: bool
|
||||
code_lineno: int
|
||||
tests: Any
|
||||
filters: Any
|
||||
debug_info: Any
|
||||
def __init__(self, environment, name, filename, stream: Optional[Any] = ..., defer_init: bool = ...) -> None: ...
|
||||
def fail(self, msg, lineno): ...
|
||||
def temporary_identifier(self): ...
|
||||
def buffer(self, frame): ...
|
||||
def return_buffer_contents(self, frame): ...
|
||||
def indent(self): ...
|
||||
def outdent(self, step: int = ...): ...
|
||||
def start_write(self, frame, node: Optional[Any] = ...): ...
|
||||
def end_write(self, frame): ...
|
||||
def simple_write(self, s, frame, node: Optional[Any] = ...): ...
|
||||
def blockvisit(self, nodes, frame): ...
|
||||
def write(self, x): ...
|
||||
def writeline(self, x, node: Optional[Any] = ..., extra: int = ...): ...
|
||||
def newline(self, node: Optional[Any] = ..., extra: int = ...): ...
|
||||
def signature(self, node, frame, extra_kwargs: Optional[Any] = ...): ...
|
||||
def pull_locals(self, frame): ...
|
||||
def pull_dependencies(self, nodes): ...
|
||||
def unoptimize_scope(self, frame): ...
|
||||
def push_scope(self, frame, extra_vars: Any = ...): ...
|
||||
def pop_scope(self, aliases, frame): ...
|
||||
def function_scoping(self, node, frame, children: Optional[Any] = ..., find_special: bool = ...): ...
|
||||
def macro_body(self, node, frame, children: Optional[Any] = ...): ...
|
||||
def macro_def(self, node, frame): ...
|
||||
def position(self, node): ...
|
||||
def visit_Template(self, node, frame: Optional[Any] = ...): ...
|
||||
def visit_Block(self, node, frame): ...
|
||||
def visit_Extends(self, node, frame): ...
|
||||
def visit_Include(self, node, frame): ...
|
||||
def visit_Import(self, node, frame): ...
|
||||
def visit_FromImport(self, node, frame): ...
|
||||
def visit_For(self, node, frame): ...
|
||||
def visit_If(self, node, frame): ...
|
||||
def visit_Macro(self, node, frame): ...
|
||||
def visit_CallBlock(self, node, frame): ...
|
||||
def visit_FilterBlock(self, node, frame): ...
|
||||
def visit_ExprStmt(self, node, frame): ...
|
||||
def visit_Output(self, node, frame): ...
|
||||
def make_assignment_frame(self, frame): ...
|
||||
def export_assigned_vars(self, frame, assignment_frame): ...
|
||||
def visit_Assign(self, node, frame): ...
|
||||
def visit_AssignBlock(self, node, frame): ...
|
||||
def visit_Name(self, node, frame): ...
|
||||
def visit_Const(self, node, frame): ...
|
||||
def visit_TemplateData(self, node, frame): ...
|
||||
def visit_Tuple(self, node, frame): ...
|
||||
def visit_List(self, node, frame): ...
|
||||
def visit_Dict(self, node, frame): ...
|
||||
def binop(self, interceptable: bool = ...): ...
|
||||
def uaop(self, interceptable: bool = ...): ...
|
||||
visit_Add: Any
|
||||
visit_Sub: Any
|
||||
visit_Mul: Any
|
||||
visit_Div: Any
|
||||
visit_FloorDiv: Any
|
||||
visit_Pow: Any
|
||||
visit_Mod: Any
|
||||
visit_And: Any
|
||||
visit_Or: Any
|
||||
visit_Pos: Any
|
||||
visit_Neg: Any
|
||||
visit_Not: Any
|
||||
def visit_Concat(self, node, frame): ...
|
||||
def visit_Compare(self, node, frame): ...
|
||||
def visit_Operand(self, node, frame): ...
|
||||
def visit_Getattr(self, node, frame): ...
|
||||
def visit_Getitem(self, node, frame): ...
|
||||
def visit_Slice(self, node, frame): ...
|
||||
def visit_Filter(self, node, frame): ...
|
||||
def visit_Test(self, node, frame): ...
|
||||
def visit_CondExpr(self, node, frame): ...
|
||||
def visit_Call(self, node, frame, forward_caller: bool = ...): ...
|
||||
def visit_Keyword(self, node, frame): ...
|
||||
def visit_MarkSafe(self, node, frame): ...
|
||||
def visit_MarkSafeIfAutoescape(self, node, frame): ...
|
||||
def visit_EnvironmentAttribute(self, node, frame): ...
|
||||
def visit_ExtensionAttribute(self, node, frame): ...
|
||||
def visit_ImportedName(self, node, frame): ...
|
||||
def visit_InternalName(self, node, frame): ...
|
||||
def visit_ContextReference(self, node, frame): ...
|
||||
def visit_Continue(self, node, frame): ...
|
||||
def visit_Break(self, node, frame): ...
|
||||
def visit_Scope(self, node, frame): ...
|
||||
def visit_EvalContextModifier(self, node, frame): ...
|
||||
def visit_ScopedEvalContextModifier(self, node, frame): ...
|
||||
1
stubs/Jinja2/jinja2/constants.pyi
Normal file
1
stubs/Jinja2/jinja2/constants.pyi
Normal file
@@ -0,0 +1 @@
|
||||
LOREM_IPSUM_WORDS: str
|
||||
37
stubs/Jinja2/jinja2/debug.pyi
Normal file
37
stubs/Jinja2/jinja2/debug.pyi
Normal file
@@ -0,0 +1,37 @@
|
||||
from typing import Any, Optional
|
||||
|
||||
tproxy: Any
|
||||
raise_helper: str
|
||||
|
||||
class TracebackFrameProxy:
|
||||
tb: Any
|
||||
def __init__(self, tb) -> None: ...
|
||||
@property
|
||||
def tb_next(self): ...
|
||||
def set_next(self, next): ...
|
||||
@property
|
||||
def is_jinja_frame(self): ...
|
||||
def __getattr__(self, name): ...
|
||||
|
||||
def make_frame_proxy(frame): ...
|
||||
|
||||
class ProcessedTraceback:
|
||||
exc_type: Any
|
||||
exc_value: Any
|
||||
frames: Any
|
||||
def __init__(self, exc_type, exc_value, frames) -> None: ...
|
||||
def render_as_text(self, limit: Optional[Any] = ...): ...
|
||||
def render_as_html(self, full: bool = ...): ...
|
||||
@property
|
||||
def is_template_syntax_error(self): ...
|
||||
@property
|
||||
def exc_info(self): ...
|
||||
@property
|
||||
def standard_exc_info(self): ...
|
||||
|
||||
def make_traceback(exc_info, source_hint: Optional[Any] = ...): ...
|
||||
def translate_syntax_error(error, source: Optional[Any] = ...): ...
|
||||
def translate_exception(exc_info, initial_skip: int = ...): ...
|
||||
def fake_exc_info(exc_info, filename, lineno): ...
|
||||
|
||||
tb_set_next: Any
|
||||
22
stubs/Jinja2/jinja2/defaults.pyi
Normal file
22
stubs/Jinja2/jinja2/defaults.pyi
Normal file
@@ -0,0 +1,22 @@
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
from jinja2.filters import FILTERS
|
||||
from jinja2.tests import TESTS
|
||||
|
||||
DEFAULT_FILTERS = FILTERS
|
||||
DEFAULT_TESTS = TESTS
|
||||
|
||||
BLOCK_START_STRING: str
|
||||
BLOCK_END_STRING: str
|
||||
VARIABLE_START_STRING: str
|
||||
VARIABLE_END_STRING: str
|
||||
COMMENT_START_STRING: str
|
||||
COMMENT_END_STRING: str
|
||||
LINE_STATEMENT_PREFIX: Optional[str]
|
||||
LINE_COMMENT_PREFIX: Optional[str]
|
||||
TRIM_BLOCKS: bool
|
||||
LSTRIP_BLOCKS: bool
|
||||
NEWLINE_SEQUENCE: str
|
||||
KEEP_TRAILING_NEWLINE: bool
|
||||
DEFAULT_NAMESPACE: Dict[str, Any]
|
||||
DEFAULT_POLICIES = Dict[str, Any]
|
||||
224
stubs/Jinja2/jinja2/environment.pyi
Normal file
224
stubs/Jinja2/jinja2/environment.pyi
Normal file
@@ -0,0 +1,224 @@
|
||||
import sys
|
||||
from typing import Any, Callable, Dict, Iterator, List, Optional, Sequence, Text, Type, Union
|
||||
|
||||
from .bccache import BytecodeCache
|
||||
from .loaders import BaseLoader
|
||||
from .runtime import Context, Undefined
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
from typing import AsyncIterator, Awaitable
|
||||
|
||||
def get_spontaneous_environment(*args): ...
|
||||
def create_cache(size): ...
|
||||
def copy_cache(cache): ...
|
||||
def load_extensions(environment, extensions): ...
|
||||
|
||||
class Environment:
|
||||
sandboxed: bool
|
||||
overlayed: bool
|
||||
linked_to: Any
|
||||
shared: bool
|
||||
exception_handler: Any
|
||||
exception_formatter: Any
|
||||
code_generator_class: Any
|
||||
context_class: Any
|
||||
block_start_string: Text
|
||||
block_end_string: Text
|
||||
variable_start_string: Text
|
||||
variable_end_string: Text
|
||||
comment_start_string: Text
|
||||
comment_end_string: Text
|
||||
line_statement_prefix: Text
|
||||
line_comment_prefix: Text
|
||||
trim_blocks: bool
|
||||
lstrip_blocks: Any
|
||||
newline_sequence: Text
|
||||
keep_trailing_newline: bool
|
||||
undefined: Type[Undefined]
|
||||
optimized: bool
|
||||
finalize: Callable[..., Any]
|
||||
autoescape: Any
|
||||
filters: Any
|
||||
tests: Any
|
||||
globals: Dict[str, Any]
|
||||
loader: BaseLoader
|
||||
cache: Any
|
||||
bytecode_cache: BytecodeCache
|
||||
auto_reload: bool
|
||||
extensions: List[Any]
|
||||
def __init__(
|
||||
self,
|
||||
block_start_string: Text = ...,
|
||||
block_end_string: Text = ...,
|
||||
variable_start_string: Text = ...,
|
||||
variable_end_string: Text = ...,
|
||||
comment_start_string: Any = ...,
|
||||
comment_end_string: Text = ...,
|
||||
line_statement_prefix: Text = ...,
|
||||
line_comment_prefix: Text = ...,
|
||||
trim_blocks: bool = ...,
|
||||
lstrip_blocks: bool = ...,
|
||||
newline_sequence: Text = ...,
|
||||
keep_trailing_newline: bool = ...,
|
||||
extensions: List[Any] = ...,
|
||||
optimized: bool = ...,
|
||||
undefined: Type[Undefined] = ...,
|
||||
finalize: Optional[Callable[..., Any]] = ...,
|
||||
autoescape: Union[bool, Callable[[str], bool]] = ...,
|
||||
loader: Optional[BaseLoader] = ...,
|
||||
cache_size: int = ...,
|
||||
auto_reload: bool = ...,
|
||||
bytecode_cache: Optional[BytecodeCache] = ...,
|
||||
enable_async: bool = ...,
|
||||
) -> None: ...
|
||||
def add_extension(self, extension): ...
|
||||
def extend(self, **attributes): ...
|
||||
def overlay(
|
||||
self,
|
||||
block_start_string: Text = ...,
|
||||
block_end_string: Text = ...,
|
||||
variable_start_string: Text = ...,
|
||||
variable_end_string: Text = ...,
|
||||
comment_start_string: Any = ...,
|
||||
comment_end_string: Text = ...,
|
||||
line_statement_prefix: Text = ...,
|
||||
line_comment_prefix: Text = ...,
|
||||
trim_blocks: bool = ...,
|
||||
lstrip_blocks: bool = ...,
|
||||
extensions: List[Any] = ...,
|
||||
optimized: bool = ...,
|
||||
undefined: Type[Undefined] = ...,
|
||||
finalize: Callable[..., Any] = ...,
|
||||
autoescape: bool = ...,
|
||||
loader: Optional[BaseLoader] = ...,
|
||||
cache_size: int = ...,
|
||||
auto_reload: bool = ...,
|
||||
bytecode_cache: Optional[BytecodeCache] = ...,
|
||||
): ...
|
||||
lexer: Any
|
||||
def iter_extensions(self): ...
|
||||
def getitem(self, obj, argument): ...
|
||||
def getattr(self, obj, attribute): ...
|
||||
def call_filter(
|
||||
self,
|
||||
name,
|
||||
value,
|
||||
args: Optional[Any] = ...,
|
||||
kwargs: Optional[Any] = ...,
|
||||
context: Optional[Any] = ...,
|
||||
eval_ctx: Optional[Any] = ...,
|
||||
): ...
|
||||
def call_test(self, name, value, args: Optional[Any] = ..., kwargs: Optional[Any] = ...): ...
|
||||
def parse(self, source, name: Optional[Any] = ..., filename: Optional[Any] = ...): ...
|
||||
def lex(self, source, name: Optional[Any] = ..., filename: Optional[Any] = ...): ...
|
||||
def preprocess(self, source: Text, name: Optional[Any] = ..., filename: Optional[Any] = ...): ...
|
||||
def compile(
|
||||
self, source, name: Optional[Any] = ..., filename: Optional[Any] = ..., raw: bool = ..., defer_init: bool = ...
|
||||
): ...
|
||||
def compile_expression(self, source: Text, undefined_to_none: bool = ...): ...
|
||||
def compile_templates(
|
||||
self,
|
||||
target,
|
||||
extensions: Optional[Any] = ...,
|
||||
filter_func: Optional[Any] = ...,
|
||||
zip: str = ...,
|
||||
log_function: Optional[Any] = ...,
|
||||
ignore_errors: bool = ...,
|
||||
py_compile: bool = ...,
|
||||
): ...
|
||||
def list_templates(self, extensions: Optional[Any] = ..., filter_func: Optional[Any] = ...): ...
|
||||
def handle_exception(self, exc_info: Optional[Any] = ..., rendered: bool = ..., source_hint: Optional[Any] = ...): ...
|
||||
def join_path(self, template: Union[Template, Text], parent: Text) -> Text: ...
|
||||
def get_template(
|
||||
self, name: Union[Template, Text], parent: Optional[Text] = ..., globals: Optional[Any] = ...
|
||||
) -> Template: ...
|
||||
def select_template(
|
||||
self, names: Sequence[Union[Template, Text]], parent: Optional[Text] = ..., globals: Optional[Dict[str, Any]] = ...
|
||||
) -> Template: ...
|
||||
def get_or_select_template(
|
||||
self,
|
||||
template_name_or_list: Union[Union[Template, Text], Sequence[Union[Template, Text]]],
|
||||
parent: Optional[Text] = ...,
|
||||
globals: Optional[Dict[str, Any]] = ...,
|
||||
) -> Template: ...
|
||||
def from_string(
|
||||
self, source: Text, globals: Optional[Dict[str, Any]] = ..., template_class: Optional[Type[Template]] = ...
|
||||
) -> Template: ...
|
||||
def make_globals(self, d: Optional[Dict[str, Any]]) -> Dict[str, Any]: ...
|
||||
# Frequently added extensions are included here:
|
||||
# from InternationalizationExtension:
|
||||
def install_gettext_translations(self, translations: Any, newstyle: Optional[bool] = ...): ...
|
||||
def install_null_translations(self, newstyle: Optional[bool] = ...): ...
|
||||
def install_gettext_callables(
|
||||
self, gettext: Callable[..., Any], ngettext: Callable[..., Any], newstyle: Optional[bool] = ...
|
||||
): ...
|
||||
def uninstall_gettext_translations(self, translations: Any): ...
|
||||
def extract_translations(self, source: Any, gettext_functions: Any): ...
|
||||
newstyle_gettext: bool
|
||||
|
||||
class Template:
|
||||
name: Optional[str]
|
||||
filename: Optional[str]
|
||||
def __new__(
|
||||
cls,
|
||||
source,
|
||||
block_start_string: Any = ...,
|
||||
block_end_string: Any = ...,
|
||||
variable_start_string: Any = ...,
|
||||
variable_end_string: Any = ...,
|
||||
comment_start_string: Any = ...,
|
||||
comment_end_string: Any = ...,
|
||||
line_statement_prefix: Any = ...,
|
||||
line_comment_prefix: Any = ...,
|
||||
trim_blocks: Any = ...,
|
||||
lstrip_blocks: Any = ...,
|
||||
newline_sequence: Any = ...,
|
||||
keep_trailing_newline: Any = ...,
|
||||
extensions: Any = ...,
|
||||
optimized: bool = ...,
|
||||
undefined: Any = ...,
|
||||
finalize: Optional[Any] = ...,
|
||||
autoescape: bool = ...,
|
||||
): ...
|
||||
environment: Environment = ...
|
||||
@classmethod
|
||||
def from_code(cls, environment, code, globals, uptodate: Optional[Any] = ...): ...
|
||||
@classmethod
|
||||
def from_module_dict(cls, environment, module_dict, globals): ...
|
||||
def render(self, *args, **kwargs) -> Text: ...
|
||||
def stream(self, *args, **kwargs) -> TemplateStream: ...
|
||||
def generate(self, *args, **kwargs) -> Iterator[Text]: ...
|
||||
def new_context(
|
||||
self, vars: Optional[Dict[str, Any]] = ..., shared: bool = ..., locals: Optional[Dict[str, Any]] = ...
|
||||
) -> Context: ...
|
||||
def make_module(
|
||||
self, vars: Optional[Dict[str, Any]] = ..., shared: bool = ..., locals: Optional[Dict[str, Any]] = ...
|
||||
) -> Context: ...
|
||||
@property
|
||||
def module(self) -> Any: ...
|
||||
def get_corresponding_lineno(self, lineno): ...
|
||||
@property
|
||||
def is_up_to_date(self) -> bool: ...
|
||||
@property
|
||||
def debug_info(self): ...
|
||||
if sys.version_info >= (3, 6):
|
||||
def render_async(self, *args, **kwargs) -> Awaitable[Text]: ...
|
||||
def generate_async(self, *args, **kwargs) -> AsyncIterator[Text]: ...
|
||||
|
||||
class TemplateModule:
|
||||
__name__: Any
|
||||
def __init__(self, template, context) -> None: ...
|
||||
def __html__(self): ...
|
||||
|
||||
class TemplateExpression:
|
||||
def __init__(self, template, undefined_to_none) -> None: ...
|
||||
def __call__(self, *args, **kwargs): ...
|
||||
|
||||
class TemplateStream:
|
||||
def __init__(self, gen) -> None: ...
|
||||
def dump(self, fp, encoding: Optional[Text] = ..., errors: Text = ...): ...
|
||||
buffered: bool
|
||||
def disable_buffering(self) -> None: ...
|
||||
def enable_buffering(self, size: int = ...) -> None: ...
|
||||
def __iter__(self): ...
|
||||
def __next__(self): ...
|
||||
31
stubs/Jinja2/jinja2/exceptions.pyi
Normal file
31
stubs/Jinja2/jinja2/exceptions.pyi
Normal file
@@ -0,0 +1,31 @@
|
||||
from typing import Any, Optional, Text
|
||||
|
||||
class TemplateError(Exception):
|
||||
def __init__(self, message: Optional[Text] = ...) -> None: ...
|
||||
@property
|
||||
def message(self): ...
|
||||
def __unicode__(self): ...
|
||||
|
||||
class TemplateNotFound(IOError, LookupError, TemplateError):
|
||||
message: Any
|
||||
name: Any
|
||||
templates: Any
|
||||
def __init__(self, name, message: Optional[Text] = ...) -> None: ...
|
||||
|
||||
class TemplatesNotFound(TemplateNotFound):
|
||||
templates: Any
|
||||
def __init__(self, names: Any = ..., message: Optional[Text] = ...) -> None: ...
|
||||
|
||||
class TemplateSyntaxError(TemplateError):
|
||||
lineno: int
|
||||
name: Text
|
||||
filename: Text
|
||||
source: Text
|
||||
translated: bool
|
||||
def __init__(self, message: Text, lineno: int, name: Optional[Text] = ..., filename: Optional[Text] = ...) -> None: ...
|
||||
|
||||
class TemplateAssertionError(TemplateSyntaxError): ...
|
||||
class TemplateRuntimeError(TemplateError): ...
|
||||
class UndefinedError(TemplateRuntimeError): ...
|
||||
class SecurityError(TemplateRuntimeError): ...
|
||||
class FilterArgumentError(TemplateRuntimeError): ...
|
||||
66
stubs/Jinja2/jinja2/ext.pyi
Normal file
66
stubs/Jinja2/jinja2/ext.pyi
Normal file
@@ -0,0 +1,66 @@
|
||||
from typing import Any, Optional
|
||||
|
||||
GETTEXT_FUNCTIONS: Any
|
||||
|
||||
class ExtensionRegistry(type):
|
||||
def __new__(cls, name, bases, d): ...
|
||||
|
||||
class Extension:
|
||||
tags: Any
|
||||
priority: int
|
||||
environment: Any
|
||||
def __init__(self, environment) -> None: ...
|
||||
def bind(self, environment): ...
|
||||
def preprocess(self, source, name, filename: Optional[Any] = ...): ...
|
||||
def filter_stream(self, stream): ...
|
||||
def parse(self, parser): ...
|
||||
def attr(self, name, lineno: Optional[Any] = ...): ...
|
||||
def call_method(
|
||||
self,
|
||||
name,
|
||||
args: Optional[Any] = ...,
|
||||
kwargs: Optional[Any] = ...,
|
||||
dyn_args: Optional[Any] = ...,
|
||||
dyn_kwargs: Optional[Any] = ...,
|
||||
lineno: Optional[Any] = ...,
|
||||
): ...
|
||||
|
||||
class InternationalizationExtension(Extension):
|
||||
tags: Any
|
||||
def __init__(self, environment) -> None: ...
|
||||
def parse(self, parser): ...
|
||||
|
||||
class ExprStmtExtension(Extension):
|
||||
tags: Any
|
||||
def parse(self, parser): ...
|
||||
|
||||
class LoopControlExtension(Extension):
|
||||
tags: Any
|
||||
def parse(self, parser): ...
|
||||
|
||||
class WithExtension(Extension):
|
||||
tags: Any
|
||||
def parse(self, parser): ...
|
||||
|
||||
class AutoEscapeExtension(Extension):
|
||||
tags: Any
|
||||
def parse(self, parser): ...
|
||||
|
||||
def extract_from_ast(node, gettext_functions: Any = ..., babel_style: bool = ...): ...
|
||||
|
||||
class _CommentFinder:
|
||||
tokens: Any
|
||||
comment_tags: Any
|
||||
offset: int
|
||||
last_lineno: int
|
||||
def __init__(self, tokens, comment_tags) -> None: ...
|
||||
def find_backwards(self, offset): ...
|
||||
def find_comments(self, lineno): ...
|
||||
|
||||
def babel_extract(fileobj, keywords, comment_tags, options): ...
|
||||
|
||||
i18n: Any
|
||||
do: Any
|
||||
loopcontrols: Any
|
||||
with_: Any
|
||||
autoescape: Any
|
||||
56
stubs/Jinja2/jinja2/filters.pyi
Normal file
56
stubs/Jinja2/jinja2/filters.pyi
Normal file
@@ -0,0 +1,56 @@
|
||||
from typing import Any, NamedTuple, Optional
|
||||
|
||||
def contextfilter(f): ...
|
||||
def evalcontextfilter(f): ...
|
||||
def environmentfilter(f): ...
|
||||
def make_attrgetter(environment, attribute): ...
|
||||
def do_forceescape(value): ...
|
||||
def do_urlencode(value): ...
|
||||
def do_replace(eval_ctx, s, old, new, count: Optional[Any] = ...): ...
|
||||
def do_upper(s): ...
|
||||
def do_lower(s): ...
|
||||
def do_xmlattr(_eval_ctx, d, autospace: bool = ...): ...
|
||||
def do_capitalize(s): ...
|
||||
def do_title(s): ...
|
||||
def do_dictsort(value, case_sensitive: bool = ..., by: str = ...): ...
|
||||
def do_sort(environment, value, reverse: bool = ..., case_sensitive: bool = ..., attribute: Optional[Any] = ...): ...
|
||||
def do_default(value, default_value: str = ..., boolean: bool = ...): ...
|
||||
def do_join(eval_ctx, value, d: str = ..., attribute: Optional[Any] = ...): ...
|
||||
def do_center(value, width: int = ...): ...
|
||||
def do_first(environment, seq): ...
|
||||
def do_last(environment, seq): ...
|
||||
def do_random(environment, seq): ...
|
||||
def do_filesizeformat(value, binary: bool = ...): ...
|
||||
def do_pprint(value, verbose: bool = ...): ...
|
||||
def do_urlize(eval_ctx, value, trim_url_limit: Optional[Any] = ..., nofollow: bool = ..., target: Optional[Any] = ...): ...
|
||||
def do_indent(s, width: int = ..., indentfirst: bool = ...): ...
|
||||
def do_truncate(s, length: int = ..., killwords: bool = ..., end: str = ...): ...
|
||||
def do_wordwrap(environment, s, width: int = ..., break_long_words: bool = ..., wrapstring: Optional[Any] = ...): ...
|
||||
def do_wordcount(s): ...
|
||||
def do_int(value, default: int = ..., base: int = ...): ...
|
||||
def do_float(value, default: float = ...): ...
|
||||
def do_format(value, *args, **kwargs): ...
|
||||
def do_trim(value): ...
|
||||
def do_striptags(value): ...
|
||||
def do_slice(value, slices, fill_with: Optional[Any] = ...): ...
|
||||
def do_batch(value, linecount, fill_with: Optional[Any] = ...): ...
|
||||
def do_round(value, precision: int = ..., method: str = ...): ...
|
||||
def do_groupby(environment, value, attribute): ...
|
||||
|
||||
class _GroupTuple(NamedTuple):
|
||||
grouper: Any
|
||||
list: Any
|
||||
|
||||
def do_sum(environment, iterable, attribute: Optional[Any] = ..., start: int = ...): ...
|
||||
def do_list(value): ...
|
||||
def do_mark_safe(value): ...
|
||||
def do_mark_unsafe(value): ...
|
||||
def do_reverse(value): ...
|
||||
def do_attr(environment, obj, name): ...
|
||||
def do_map(*args, **kwargs): ...
|
||||
def do_select(*args, **kwargs): ...
|
||||
def do_reject(*args, **kwargs): ...
|
||||
def do_selectattr(*args, **kwargs): ...
|
||||
def do_rejectattr(*args, **kwargs): ...
|
||||
|
||||
FILTERS: Any
|
||||
117
stubs/Jinja2/jinja2/lexer.pyi
Normal file
117
stubs/Jinja2/jinja2/lexer.pyi
Normal file
@@ -0,0 +1,117 @@
|
||||
from typing import Any, Optional, Tuple
|
||||
|
||||
whitespace_re: Any
|
||||
string_re: Any
|
||||
integer_re: Any
|
||||
name_re: Any
|
||||
float_re: Any
|
||||
newline_re: Any
|
||||
TOKEN_ADD: Any
|
||||
TOKEN_ASSIGN: Any
|
||||
TOKEN_COLON: Any
|
||||
TOKEN_COMMA: Any
|
||||
TOKEN_DIV: Any
|
||||
TOKEN_DOT: Any
|
||||
TOKEN_EQ: Any
|
||||
TOKEN_FLOORDIV: Any
|
||||
TOKEN_GT: Any
|
||||
TOKEN_GTEQ: Any
|
||||
TOKEN_LBRACE: Any
|
||||
TOKEN_LBRACKET: Any
|
||||
TOKEN_LPAREN: Any
|
||||
TOKEN_LT: Any
|
||||
TOKEN_LTEQ: Any
|
||||
TOKEN_MOD: Any
|
||||
TOKEN_MUL: Any
|
||||
TOKEN_NE: Any
|
||||
TOKEN_PIPE: Any
|
||||
TOKEN_POW: Any
|
||||
TOKEN_RBRACE: Any
|
||||
TOKEN_RBRACKET: Any
|
||||
TOKEN_RPAREN: Any
|
||||
TOKEN_SEMICOLON: Any
|
||||
TOKEN_SUB: Any
|
||||
TOKEN_TILDE: Any
|
||||
TOKEN_WHITESPACE: Any
|
||||
TOKEN_FLOAT: Any
|
||||
TOKEN_INTEGER: Any
|
||||
TOKEN_NAME: Any
|
||||
TOKEN_STRING: Any
|
||||
TOKEN_OPERATOR: Any
|
||||
TOKEN_BLOCK_BEGIN: Any
|
||||
TOKEN_BLOCK_END: Any
|
||||
TOKEN_VARIABLE_BEGIN: Any
|
||||
TOKEN_VARIABLE_END: Any
|
||||
TOKEN_RAW_BEGIN: Any
|
||||
TOKEN_RAW_END: Any
|
||||
TOKEN_COMMENT_BEGIN: Any
|
||||
TOKEN_COMMENT_END: Any
|
||||
TOKEN_COMMENT: Any
|
||||
TOKEN_LINESTATEMENT_BEGIN: Any
|
||||
TOKEN_LINESTATEMENT_END: Any
|
||||
TOKEN_LINECOMMENT_BEGIN: Any
|
||||
TOKEN_LINECOMMENT_END: Any
|
||||
TOKEN_LINECOMMENT: Any
|
||||
TOKEN_DATA: Any
|
||||
TOKEN_INITIAL: Any
|
||||
TOKEN_EOF: Any
|
||||
operators: Any
|
||||
reverse_operators: Any
|
||||
operator_re: Any
|
||||
ignored_tokens: Any
|
||||
ignore_if_empty: Any
|
||||
|
||||
def describe_token(token): ...
|
||||
def describe_token_expr(expr): ...
|
||||
def count_newlines(value): ...
|
||||
def compile_rules(environment): ...
|
||||
|
||||
class Failure:
|
||||
message: Any
|
||||
error_class: Any
|
||||
def __init__(self, message, cls: Any = ...) -> None: ...
|
||||
def __call__(self, lineno, filename): ...
|
||||
|
||||
class Token(Tuple[int, Any, Any]):
|
||||
lineno: Any
|
||||
type: Any
|
||||
value: Any
|
||||
def __new__(cls, lineno, type, value): ...
|
||||
def test(self, expr): ...
|
||||
def test_any(self, *iterable): ...
|
||||
|
||||
class TokenStreamIterator:
|
||||
stream: Any
|
||||
def __init__(self, stream) -> None: ...
|
||||
def __iter__(self): ...
|
||||
def __next__(self): ...
|
||||
|
||||
class TokenStream:
|
||||
name: Any
|
||||
filename: Any
|
||||
closed: bool
|
||||
current: Any
|
||||
def __init__(self, generator, name, filename) -> None: ...
|
||||
def __iter__(self): ...
|
||||
def __bool__(self): ...
|
||||
__nonzero__: Any
|
||||
eos: Any
|
||||
def push(self, token): ...
|
||||
def look(self): ...
|
||||
def skip(self, n: int = ...): ...
|
||||
def next_if(self, expr): ...
|
||||
def skip_if(self, expr): ...
|
||||
def __next__(self): ...
|
||||
def close(self): ...
|
||||
def expect(self, expr): ...
|
||||
|
||||
def get_lexer(environment): ...
|
||||
|
||||
class Lexer:
|
||||
newline_sequence: Any
|
||||
keep_trailing_newline: Any
|
||||
rules: Any
|
||||
def __init__(self, environment) -> None: ...
|
||||
def tokenize(self, source, name: Optional[Any] = ..., filename: Optional[Any] = ..., state: Optional[Any] = ...): ...
|
||||
def wrap(self, stream, name: Optional[Any] = ..., filename: Optional[Any] = ...): ...
|
||||
def tokeniter(self, source, name, filename: Optional[Any] = ..., state: Optional[Any] = ...): ...
|
||||
80
stubs/Jinja2/jinja2/loaders.pyi
Normal file
80
stubs/Jinja2/jinja2/loaders.pyi
Normal file
@@ -0,0 +1,80 @@
|
||||
import sys
|
||||
from types import ModuleType
|
||||
from typing import Any, Callable, Iterable, List, Optional, Text, Tuple, Union
|
||||
|
||||
from .environment import Environment
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
from os import PathLike
|
||||
|
||||
_SearchPath = Union[Text, PathLike[str], Iterable[Union[Text, PathLike[str]]]]
|
||||
else:
|
||||
_SearchPath = Union[Text, Iterable[Text]]
|
||||
|
||||
def split_template_path(template: Text) -> List[Text]: ...
|
||||
|
||||
class BaseLoader:
|
||||
has_source_access: bool
|
||||
def get_source(self, environment, template): ...
|
||||
def list_templates(self): ...
|
||||
def load(self, environment, name, globals: Optional[Any] = ...): ...
|
||||
|
||||
class FileSystemLoader(BaseLoader):
|
||||
searchpath: Text
|
||||
encoding: Any
|
||||
followlinks: Any
|
||||
def __init__(self, searchpath: _SearchPath, encoding: Text = ..., followlinks: bool = ...) -> None: ...
|
||||
def get_source(self, environment: Environment, template: Text) -> Tuple[Text, Text, Callable[..., Any]]: ...
|
||||
def list_templates(self): ...
|
||||
|
||||
class PackageLoader(BaseLoader):
|
||||
encoding: Text
|
||||
manager: Any
|
||||
filesystem_bound: Any
|
||||
provider: Any
|
||||
package_path: Any
|
||||
def __init__(self, package_name: Text, package_path: Text = ..., encoding: Text = ...) -> None: ...
|
||||
def get_source(self, environment: Environment, template: Text) -> Tuple[Text, Text, Callable[..., Any]]: ...
|
||||
def list_templates(self): ...
|
||||
|
||||
class DictLoader(BaseLoader):
|
||||
mapping: Any
|
||||
def __init__(self, mapping) -> None: ...
|
||||
def get_source(self, environment: Environment, template: Text) -> Tuple[Text, Text, Callable[..., Any]]: ...
|
||||
def list_templates(self): ...
|
||||
|
||||
class FunctionLoader(BaseLoader):
|
||||
load_func: Any
|
||||
def __init__(self, load_func) -> None: ...
|
||||
def get_source(
|
||||
self, environment: Environment, template: Text
|
||||
) -> Tuple[Text, Optional[Text], Optional[Callable[..., Any]]]: ...
|
||||
|
||||
class PrefixLoader(BaseLoader):
|
||||
mapping: Any
|
||||
delimiter: Any
|
||||
def __init__(self, mapping, delimiter: str = ...) -> None: ...
|
||||
def get_loader(self, template): ...
|
||||
def get_source(self, environment: Environment, template: Text) -> Tuple[Text, Text, Callable[..., Any]]: ...
|
||||
def load(self, environment, name, globals: Optional[Any] = ...): ...
|
||||
def list_templates(self): ...
|
||||
|
||||
class ChoiceLoader(BaseLoader):
|
||||
loaders: Any
|
||||
def __init__(self, loaders) -> None: ...
|
||||
def get_source(self, environment: Environment, template: Text) -> Tuple[Text, Text, Callable[..., Any]]: ...
|
||||
def load(self, environment, name, globals: Optional[Any] = ...): ...
|
||||
def list_templates(self): ...
|
||||
|
||||
class _TemplateModule(ModuleType): ...
|
||||
|
||||
class ModuleLoader(BaseLoader):
|
||||
has_source_access: bool
|
||||
module: Any
|
||||
package_name: Any
|
||||
def __init__(self, path) -> None: ...
|
||||
@staticmethod
|
||||
def get_template_key(name): ...
|
||||
@staticmethod
|
||||
def get_module_filename(name): ...
|
||||
def load(self, environment, name, globals: Optional[Any] = ...): ...
|
||||
12
stubs/Jinja2/jinja2/meta.pyi
Normal file
12
stubs/Jinja2/jinja2/meta.pyi
Normal file
@@ -0,0 +1,12 @@
|
||||
from typing import Any
|
||||
|
||||
from jinja2.compiler import CodeGenerator
|
||||
|
||||
class TrackingCodeGenerator(CodeGenerator):
|
||||
undeclared_identifiers: Any
|
||||
def __init__(self, environment) -> None: ...
|
||||
def write(self, x): ...
|
||||
def pull_locals(self, frame): ...
|
||||
|
||||
def find_undeclared_variables(ast): ...
|
||||
def find_referenced_templates(ast): ...
|
||||
255
stubs/Jinja2/jinja2/nodes.pyi
Normal file
255
stubs/Jinja2/jinja2/nodes.pyi
Normal file
@@ -0,0 +1,255 @@
|
||||
import typing
|
||||
from typing import Any, Optional
|
||||
|
||||
class Impossible(Exception): ...
|
||||
|
||||
class NodeType(type):
|
||||
def __new__(cls, name, bases, d): ...
|
||||
|
||||
class EvalContext:
|
||||
environment: Any
|
||||
autoescape: Any
|
||||
volatile: bool
|
||||
def __init__(self, environment, template_name: Optional[Any] = ...) -> None: ...
|
||||
def save(self): ...
|
||||
def revert(self, old): ...
|
||||
|
||||
def get_eval_context(node, ctx): ...
|
||||
|
||||
class Node:
|
||||
fields: Any
|
||||
attributes: Any
|
||||
abstract: bool
|
||||
def __init__(self, *fields, **attributes) -> None: ...
|
||||
def iter_fields(self, exclude: Optional[Any] = ..., only: Optional[Any] = ...): ...
|
||||
def iter_child_nodes(self, exclude: Optional[Any] = ..., only: Optional[Any] = ...): ...
|
||||
def find(self, node_type): ...
|
||||
def find_all(self, node_type): ...
|
||||
def set_ctx(self, ctx): ...
|
||||
def set_lineno(self, lineno, override: bool = ...): ...
|
||||
def set_environment(self, environment): ...
|
||||
def __eq__(self, other): ...
|
||||
def __ne__(self, other): ...
|
||||
__hash__: Any
|
||||
|
||||
class Stmt(Node):
|
||||
abstract: bool
|
||||
|
||||
class Helper(Node):
|
||||
abstract: bool
|
||||
|
||||
class Template(Node):
|
||||
fields: Any
|
||||
|
||||
class Output(Stmt):
|
||||
fields: Any
|
||||
|
||||
class Extends(Stmt):
|
||||
fields: Any
|
||||
|
||||
class For(Stmt):
|
||||
fields: Any
|
||||
|
||||
class If(Stmt):
|
||||
fields: Any
|
||||
|
||||
class Macro(Stmt):
|
||||
fields: Any
|
||||
name: str
|
||||
args: typing.List[Any]
|
||||
defaults: typing.List[Any]
|
||||
body: typing.List[Any]
|
||||
|
||||
class CallBlock(Stmt):
|
||||
fields: Any
|
||||
|
||||
class FilterBlock(Stmt):
|
||||
fields: Any
|
||||
|
||||
class Block(Stmt):
|
||||
fields: Any
|
||||
|
||||
class Include(Stmt):
|
||||
fields: Any
|
||||
|
||||
class Import(Stmt):
|
||||
fields: Any
|
||||
|
||||
class FromImport(Stmt):
|
||||
fields: Any
|
||||
|
||||
class ExprStmt(Stmt):
|
||||
fields: Any
|
||||
|
||||
class Assign(Stmt):
|
||||
fields: Any
|
||||
|
||||
class AssignBlock(Stmt):
|
||||
fields: Any
|
||||
|
||||
class Expr(Node):
|
||||
abstract: bool
|
||||
def as_const(self, eval_ctx: Optional[Any] = ...): ...
|
||||
def can_assign(self): ...
|
||||
|
||||
class BinExpr(Expr):
|
||||
fields: Any
|
||||
operator: Any
|
||||
abstract: bool
|
||||
def as_const(self, eval_ctx: Optional[Any] = ...): ...
|
||||
|
||||
class UnaryExpr(Expr):
|
||||
fields: Any
|
||||
operator: Any
|
||||
abstract: bool
|
||||
def as_const(self, eval_ctx: Optional[Any] = ...): ...
|
||||
|
||||
class Name(Expr):
|
||||
fields: Any
|
||||
def can_assign(self): ...
|
||||
|
||||
class Literal(Expr):
|
||||
abstract: bool
|
||||
|
||||
class Const(Literal):
|
||||
fields: Any
|
||||
def as_const(self, eval_ctx: Optional[Any] = ...): ...
|
||||
@classmethod
|
||||
def from_untrusted(cls, value, lineno: Optional[Any] = ..., environment: Optional[Any] = ...): ...
|
||||
|
||||
class TemplateData(Literal):
|
||||
fields: Any
|
||||
def as_const(self, eval_ctx: Optional[Any] = ...): ...
|
||||
|
||||
class Tuple(Literal):
|
||||
fields: Any
|
||||
def as_const(self, eval_ctx: Optional[Any] = ...): ...
|
||||
def can_assign(self): ...
|
||||
|
||||
class List(Literal):
|
||||
fields: Any
|
||||
def as_const(self, eval_ctx: Optional[Any] = ...): ...
|
||||
|
||||
class Dict(Literal):
|
||||
fields: Any
|
||||
def as_const(self, eval_ctx: Optional[Any] = ...): ...
|
||||
|
||||
class Pair(Helper):
|
||||
fields: Any
|
||||
def as_const(self, eval_ctx: Optional[Any] = ...): ...
|
||||
|
||||
class Keyword(Helper):
|
||||
fields: Any
|
||||
def as_const(self, eval_ctx: Optional[Any] = ...): ...
|
||||
|
||||
class CondExpr(Expr):
|
||||
fields: Any
|
||||
def as_const(self, eval_ctx: Optional[Any] = ...): ...
|
||||
|
||||
class Filter(Expr):
|
||||
fields: Any
|
||||
def as_const(self, eval_ctx: Optional[Any] = ...): ...
|
||||
|
||||
class Test(Expr):
|
||||
fields: Any
|
||||
|
||||
class Call(Expr):
|
||||
fields: Any
|
||||
def as_const(self, eval_ctx: Optional[Any] = ...): ...
|
||||
|
||||
class Getitem(Expr):
|
||||
fields: Any
|
||||
def as_const(self, eval_ctx: Optional[Any] = ...): ...
|
||||
def can_assign(self): ...
|
||||
|
||||
class Getattr(Expr):
|
||||
fields: Any
|
||||
def as_const(self, eval_ctx: Optional[Any] = ...): ...
|
||||
def can_assign(self): ...
|
||||
|
||||
class Slice(Expr):
|
||||
fields: Any
|
||||
def as_const(self, eval_ctx: Optional[Any] = ...): ...
|
||||
|
||||
class Concat(Expr):
|
||||
fields: Any
|
||||
def as_const(self, eval_ctx: Optional[Any] = ...): ...
|
||||
|
||||
class Compare(Expr):
|
||||
fields: Any
|
||||
def as_const(self, eval_ctx: Optional[Any] = ...): ...
|
||||
|
||||
class Operand(Helper):
|
||||
fields: Any
|
||||
|
||||
class Mul(BinExpr):
|
||||
operator: str
|
||||
|
||||
class Div(BinExpr):
|
||||
operator: str
|
||||
|
||||
class FloorDiv(BinExpr):
|
||||
operator: str
|
||||
|
||||
class Add(BinExpr):
|
||||
operator: str
|
||||
|
||||
class Sub(BinExpr):
|
||||
operator: str
|
||||
|
||||
class Mod(BinExpr):
|
||||
operator: str
|
||||
|
||||
class Pow(BinExpr):
|
||||
operator: str
|
||||
|
||||
class And(BinExpr):
|
||||
operator: str
|
||||
def as_const(self, eval_ctx: Optional[Any] = ...): ...
|
||||
|
||||
class Or(BinExpr):
|
||||
operator: str
|
||||
def as_const(self, eval_ctx: Optional[Any] = ...): ...
|
||||
|
||||
class Not(UnaryExpr):
|
||||
operator: str
|
||||
|
||||
class Neg(UnaryExpr):
|
||||
operator: str
|
||||
|
||||
class Pos(UnaryExpr):
|
||||
operator: str
|
||||
|
||||
class EnvironmentAttribute(Expr):
|
||||
fields: Any
|
||||
|
||||
class ExtensionAttribute(Expr):
|
||||
fields: Any
|
||||
|
||||
class ImportedName(Expr):
|
||||
fields: Any
|
||||
|
||||
class InternalName(Expr):
|
||||
fields: Any
|
||||
def __init__(self) -> None: ...
|
||||
|
||||
class MarkSafe(Expr):
|
||||
fields: Any
|
||||
def as_const(self, eval_ctx: Optional[Any] = ...): ...
|
||||
|
||||
class MarkSafeIfAutoescape(Expr):
|
||||
fields: Any
|
||||
def as_const(self, eval_ctx: Optional[Any] = ...): ...
|
||||
|
||||
class ContextReference(Expr): ...
|
||||
class Continue(Stmt): ...
|
||||
class Break(Stmt): ...
|
||||
|
||||
class Scope(Stmt):
|
||||
fields: Any
|
||||
|
||||
class EvalContextModifier(Stmt):
|
||||
fields: Any
|
||||
|
||||
class ScopedEvalContextModifier(EvalContextModifier):
|
||||
fields: Any
|
||||
30
stubs/Jinja2/jinja2/optimizer.pyi
Normal file
30
stubs/Jinja2/jinja2/optimizer.pyi
Normal file
@@ -0,0 +1,30 @@
|
||||
from typing import Any
|
||||
|
||||
from jinja2.visitor import NodeTransformer
|
||||
|
||||
def optimize(node, environment): ...
|
||||
|
||||
class Optimizer(NodeTransformer):
|
||||
environment: Any
|
||||
def __init__(self, environment) -> None: ...
|
||||
def visit_If(self, node): ...
|
||||
def fold(self, node): ...
|
||||
visit_Add: Any
|
||||
visit_Sub: Any
|
||||
visit_Mul: Any
|
||||
visit_Div: Any
|
||||
visit_FloorDiv: Any
|
||||
visit_Pow: Any
|
||||
visit_Mod: Any
|
||||
visit_And: Any
|
||||
visit_Or: Any
|
||||
visit_Pos: Any
|
||||
visit_Neg: Any
|
||||
visit_Not: Any
|
||||
visit_Compare: Any
|
||||
visit_Getitem: Any
|
||||
visit_Getattr: Any
|
||||
visit_Call: Any
|
||||
visit_Filter: Any
|
||||
visit_Test: Any
|
||||
visit_CondExpr: Any
|
||||
68
stubs/Jinja2/jinja2/parser.pyi
Normal file
68
stubs/Jinja2/jinja2/parser.pyi
Normal file
@@ -0,0 +1,68 @@
|
||||
from typing import Any, Optional
|
||||
|
||||
class Parser:
|
||||
environment: Any
|
||||
stream: Any
|
||||
name: Any
|
||||
filename: Any
|
||||
closed: bool
|
||||
extensions: Any
|
||||
def __init__(
|
||||
self, environment, source, name: Optional[Any] = ..., filename: Optional[Any] = ..., state: Optional[Any] = ...
|
||||
) -> None: ...
|
||||
def fail(self, msg, lineno: Optional[Any] = ..., exc: Any = ...): ...
|
||||
def fail_unknown_tag(self, name, lineno: Optional[Any] = ...): ...
|
||||
def fail_eof(self, end_tokens: Optional[Any] = ..., lineno: Optional[Any] = ...): ...
|
||||
def is_tuple_end(self, extra_end_rules: Optional[Any] = ...): ...
|
||||
def free_identifier(self, lineno: Optional[Any] = ...): ...
|
||||
def parse_statement(self): ...
|
||||
def parse_statements(self, end_tokens, drop_needle: bool = ...): ...
|
||||
def parse_set(self): ...
|
||||
def parse_for(self): ...
|
||||
def parse_if(self): ...
|
||||
def parse_block(self): ...
|
||||
def parse_extends(self): ...
|
||||
def parse_import_context(self, node, default): ...
|
||||
def parse_include(self): ...
|
||||
def parse_import(self): ...
|
||||
def parse_from(self): ...
|
||||
def parse_signature(self, node): ...
|
||||
def parse_call_block(self): ...
|
||||
def parse_filter_block(self): ...
|
||||
def parse_macro(self): ...
|
||||
def parse_print(self): ...
|
||||
def parse_assign_target(self, with_tuple: bool = ..., name_only: bool = ..., extra_end_rules: Optional[Any] = ...): ...
|
||||
def parse_expression(self, with_condexpr: bool = ...): ...
|
||||
def parse_condexpr(self): ...
|
||||
def parse_or(self): ...
|
||||
def parse_and(self): ...
|
||||
def parse_not(self): ...
|
||||
def parse_compare(self): ...
|
||||
def parse_add(self): ...
|
||||
def parse_sub(self): ...
|
||||
def parse_concat(self): ...
|
||||
def parse_mul(self): ...
|
||||
def parse_div(self): ...
|
||||
def parse_floordiv(self): ...
|
||||
def parse_mod(self): ...
|
||||
def parse_pow(self): ...
|
||||
def parse_unary(self, with_filter: bool = ...): ...
|
||||
def parse_primary(self): ...
|
||||
def parse_tuple(
|
||||
self,
|
||||
simplified: bool = ...,
|
||||
with_condexpr: bool = ...,
|
||||
extra_end_rules: Optional[Any] = ...,
|
||||
explicit_parentheses: bool = ...,
|
||||
): ...
|
||||
def parse_list(self): ...
|
||||
def parse_dict(self): ...
|
||||
def parse_postfix(self, node): ...
|
||||
def parse_filter_expr(self, node): ...
|
||||
def parse_subscript(self, node): ...
|
||||
def parse_subscribed(self): ...
|
||||
def parse_call(self, node): ...
|
||||
def parse_filter(self, node, start_inline: bool = ...): ...
|
||||
def parse_test(self, node): ...
|
||||
def subparse(self, end_tokens: Optional[Any] = ...): ...
|
||||
def parse(self): ...
|
||||
132
stubs/Jinja2/jinja2/runtime.pyi
Normal file
132
stubs/Jinja2/jinja2/runtime.pyi
Normal file
@@ -0,0 +1,132 @@
|
||||
from typing import Any, Dict, Optional, Text, Union
|
||||
|
||||
from jinja2.environment import Environment
|
||||
from jinja2.exceptions import TemplateNotFound as TemplateNotFound, TemplateRuntimeError as TemplateRuntimeError
|
||||
from jinja2.utils import Markup as Markup, concat as concat, escape as escape, missing as missing
|
||||
|
||||
to_string: Any
|
||||
identity: Any
|
||||
|
||||
def markup_join(seq): ...
|
||||
def unicode_join(seq): ...
|
||||
|
||||
class TemplateReference:
|
||||
def __init__(self, context) -> None: ...
|
||||
def __getitem__(self, name): ...
|
||||
|
||||
class Context:
|
||||
parent: Union[Context, Dict[str, Any]]
|
||||
vars: Dict[str, Any]
|
||||
environment: Environment
|
||||
eval_ctx: Any
|
||||
exported_vars: Any
|
||||
name: Text
|
||||
blocks: Dict[str, Any]
|
||||
def __init__(
|
||||
self, environment: Environment, parent: Union[Context, Dict[str, Any]], name: Text, blocks: Dict[str, Any]
|
||||
) -> None: ...
|
||||
def super(self, name, current): ...
|
||||
def get(self, key, default: Optional[Any] = ...): ...
|
||||
def resolve(self, key): ...
|
||||
def get_exported(self): ...
|
||||
def get_all(self): ...
|
||||
def call(__self, __obj, *args, **kwargs): ...
|
||||
def derived(self, locals: Optional[Any] = ...): ...
|
||||
keys: Any
|
||||
values: Any
|
||||
items: Any
|
||||
iterkeys: Any
|
||||
itervalues: Any
|
||||
iteritems: Any
|
||||
def __contains__(self, name): ...
|
||||
def __getitem__(self, key): ...
|
||||
|
||||
class BlockReference:
|
||||
name: Any
|
||||
def __init__(self, name, context, stack, depth) -> None: ...
|
||||
@property
|
||||
def super(self): ...
|
||||
def __call__(self): ...
|
||||
|
||||
class LoopContext:
|
||||
index0: int
|
||||
depth0: Any
|
||||
def __init__(self, iterable, recurse: Optional[Any] = ..., depth0: int = ...) -> None: ...
|
||||
def cycle(self, *args): ...
|
||||
first: Any
|
||||
last: Any
|
||||
index: Any
|
||||
revindex: Any
|
||||
revindex0: Any
|
||||
depth: Any
|
||||
def __len__(self): ...
|
||||
def __iter__(self): ...
|
||||
def loop(self, iterable): ...
|
||||
__call__: Any
|
||||
@property
|
||||
def length(self): ...
|
||||
|
||||
class LoopContextIterator:
|
||||
context: Any
|
||||
def __init__(self, context) -> None: ...
|
||||
def __iter__(self): ...
|
||||
def __next__(self): ...
|
||||
|
||||
class Macro:
|
||||
name: Any
|
||||
arguments: Any
|
||||
defaults: Any
|
||||
catch_kwargs: Any
|
||||
catch_varargs: Any
|
||||
caller: Any
|
||||
def __init__(self, environment, func, name, arguments, defaults, catch_kwargs, catch_varargs, caller) -> None: ...
|
||||
def __call__(self, *args, **kwargs): ...
|
||||
|
||||
class Undefined:
|
||||
def __init__(self, hint: Optional[Any] = ..., obj: Any = ..., name: Optional[Any] = ..., exc: Any = ...) -> None: ...
|
||||
def __getattr__(self, name): ...
|
||||
__add__: Any
|
||||
__radd__: Any
|
||||
__mul__: Any
|
||||
__rmul__: Any
|
||||
__div__: Any
|
||||
__rdiv__: Any
|
||||
__truediv__: Any
|
||||
__rtruediv__: Any
|
||||
__floordiv__: Any
|
||||
__rfloordiv__: Any
|
||||
__mod__: Any
|
||||
__rmod__: Any
|
||||
__pos__: Any
|
||||
__neg__: Any
|
||||
__call__: Any
|
||||
__getitem__: Any
|
||||
__lt__: Any
|
||||
__le__: Any
|
||||
__gt__: Any
|
||||
__ge__: Any
|
||||
__int__: Any
|
||||
__float__: Any
|
||||
__complex__: Any
|
||||
__pow__: Any
|
||||
__rpow__: Any
|
||||
def __eq__(self, other): ...
|
||||
def __ne__(self, other): ...
|
||||
def __hash__(self): ...
|
||||
def __len__(self): ...
|
||||
def __iter__(self): ...
|
||||
def __nonzero__(self): ...
|
||||
__bool__: Any
|
||||
|
||||
def make_logging_undefined(logger: Optional[Any] = ..., base: Optional[Any] = ...): ...
|
||||
|
||||
class DebugUndefined(Undefined): ...
|
||||
|
||||
class StrictUndefined(Undefined):
|
||||
__iter__: Any
|
||||
__len__: Any
|
||||
__nonzero__: Any
|
||||
__eq__: Any
|
||||
__ne__: Any
|
||||
__bool__: Any
|
||||
__hash__: Any
|
||||
35
stubs/Jinja2/jinja2/sandbox.pyi
Normal file
35
stubs/Jinja2/jinja2/sandbox.pyi
Normal file
@@ -0,0 +1,35 @@
|
||||
from typing import Any
|
||||
|
||||
from jinja2.environment import Environment
|
||||
|
||||
MAX_RANGE: int
|
||||
UNSAFE_FUNCTION_ATTRIBUTES: Any
|
||||
UNSAFE_METHOD_ATTRIBUTES: Any
|
||||
UNSAFE_GENERATOR_ATTRIBUTES: Any
|
||||
|
||||
def safe_range(*args): ...
|
||||
def unsafe(f): ...
|
||||
def is_internal_attribute(obj, attr): ...
|
||||
def modifies_known_mutable(obj, attr): ...
|
||||
|
||||
class SandboxedEnvironment(Environment):
|
||||
sandboxed: bool
|
||||
default_binop_table: Any
|
||||
default_unop_table: Any
|
||||
intercepted_binops: Any
|
||||
intercepted_unops: Any
|
||||
def intercept_unop(self, operator): ...
|
||||
binop_table: Any
|
||||
unop_table: Any
|
||||
def __init__(self, *args, **kwargs) -> None: ...
|
||||
def is_safe_attribute(self, obj, attr, value): ...
|
||||
def is_safe_callable(self, obj): ...
|
||||
def call_binop(self, context, operator, left, right): ...
|
||||
def call_unop(self, context, operator, arg): ...
|
||||
def getitem(self, obj, argument): ...
|
||||
def getattr(self, obj, attribute): ...
|
||||
def unsafe_undefined(self, obj, attribute): ...
|
||||
def call(__self, __context, __obj, *args, **kwargs): ...
|
||||
|
||||
class ImmutableSandboxedEnvironment(SandboxedEnvironment):
|
||||
def is_safe_attribute(self, obj, attr, value): ...
|
||||
24
stubs/Jinja2/jinja2/tests.pyi
Normal file
24
stubs/Jinja2/jinja2/tests.pyi
Normal file
@@ -0,0 +1,24 @@
|
||||
from typing import Any
|
||||
|
||||
number_re: Any
|
||||
regex_type: Any
|
||||
test_callable: Any
|
||||
|
||||
def test_odd(value): ...
|
||||
def test_even(value): ...
|
||||
def test_divisibleby(value, num): ...
|
||||
def test_defined(value): ...
|
||||
def test_undefined(value): ...
|
||||
def test_none(value): ...
|
||||
def test_lower(value): ...
|
||||
def test_upper(value): ...
|
||||
def test_string(value): ...
|
||||
def test_mapping(value): ...
|
||||
def test_number(value): ...
|
||||
def test_sequence(value): ...
|
||||
def test_equalto(value, other): ...
|
||||
def test_sameas(value, other): ...
|
||||
def test_iterable(value): ...
|
||||
def test_escaped(value): ...
|
||||
|
||||
TESTS: Any
|
||||
87
stubs/Jinja2/jinja2/utils.pyi
Normal file
87
stubs/Jinja2/jinja2/utils.pyi
Normal file
@@ -0,0 +1,87 @@
|
||||
from _typeshed import AnyPath
|
||||
from typing import IO, Any, Callable, Iterable, Optional, Protocol, Text, TypeVar, Union
|
||||
from typing_extensions import Literal
|
||||
|
||||
from markupsafe import Markup as Markup, escape as escape, soft_unicode as soft_unicode
|
||||
|
||||
missing: Any
|
||||
internal_code: Any
|
||||
concat: Any
|
||||
|
||||
_CallableT = TypeVar("_CallableT", bound=Callable[..., Any])
|
||||
|
||||
class _ContextFunction(Protocol[_CallableT]):
|
||||
contextfunction: Literal[True]
|
||||
__call__: _CallableT
|
||||
|
||||
class _EvalContextFunction(Protocol[_CallableT]):
|
||||
evalcontextfunction: Literal[True]
|
||||
__call__: _CallableT
|
||||
|
||||
class _EnvironmentFunction(Protocol[_CallableT]):
|
||||
environmentfunction: Literal[True]
|
||||
__call__: _CallableT
|
||||
|
||||
def contextfunction(f: _CallableT) -> _ContextFunction[_CallableT]: ...
|
||||
def evalcontextfunction(f: _CallableT) -> _EvalContextFunction[_CallableT]: ...
|
||||
def environmentfunction(f: _CallableT) -> _EnvironmentFunction[_CallableT]: ...
|
||||
def internalcode(f: _CallableT) -> _CallableT: ...
|
||||
def is_undefined(obj: object) -> bool: ...
|
||||
def select_autoescape(
|
||||
enabled_extensions: Iterable[str] = ...,
|
||||
disabled_extensions: Iterable[str] = ...,
|
||||
default_for_string: bool = ...,
|
||||
default: bool = ...,
|
||||
) -> Callable[[str], bool]: ...
|
||||
def consume(iterable: Iterable[object]) -> None: ...
|
||||
def clear_caches() -> None: ...
|
||||
def import_string(import_name: str, silent: bool = ...) -> Any: ...
|
||||
def open_if_exists(filename: AnyPath, mode: str = ...) -> Optional[IO[Any]]: ...
|
||||
def object_type_repr(obj: object) -> str: ...
|
||||
def pformat(obj: object, verbose: bool = ...) -> str: ...
|
||||
def urlize(
|
||||
text: Union[Markup, Text],
|
||||
trim_url_limit: Optional[int] = ...,
|
||||
rel: Optional[Union[Markup, Text]] = ...,
|
||||
target: Optional[Union[Markup, Text]] = ...,
|
||||
) -> str: ...
|
||||
def generate_lorem_ipsum(n: int = ..., html: bool = ..., min: int = ..., max: int = ...) -> Union[Markup, str]: ...
|
||||
def unicode_urlencode(obj: object, charset: str = ..., for_qs: bool = ...) -> str: ...
|
||||
|
||||
class LRUCache:
|
||||
capacity: Any
|
||||
def __init__(self, capacity) -> None: ...
|
||||
def __getnewargs__(self): ...
|
||||
def copy(self): ...
|
||||
def get(self, key, default: Optional[Any] = ...): ...
|
||||
def setdefault(self, key, default: Optional[Any] = ...): ...
|
||||
def clear(self): ...
|
||||
def __contains__(self, key): ...
|
||||
def __len__(self): ...
|
||||
def __getitem__(self, key): ...
|
||||
def __setitem__(self, key, value): ...
|
||||
def __delitem__(self, key): ...
|
||||
def items(self): ...
|
||||
def iteritems(self): ...
|
||||
def values(self): ...
|
||||
def itervalue(self): ...
|
||||
def keys(self): ...
|
||||
def iterkeys(self): ...
|
||||
__iter__: Any
|
||||
def __reversed__(self): ...
|
||||
__copy__: Any
|
||||
|
||||
class Cycler:
|
||||
items: Any
|
||||
def __init__(self, *items) -> None: ...
|
||||
pos: int
|
||||
def reset(self): ...
|
||||
@property
|
||||
def current(self): ...
|
||||
def __next__(self): ...
|
||||
|
||||
class Joiner:
|
||||
sep: Any
|
||||
used: bool
|
||||
def __init__(self, sep: str = ...) -> None: ...
|
||||
def __call__(self): ...
|
||||
8
stubs/Jinja2/jinja2/visitor.pyi
Normal file
8
stubs/Jinja2/jinja2/visitor.pyi
Normal file
@@ -0,0 +1,8 @@
|
||||
class NodeVisitor:
|
||||
def get_visitor(self, node): ...
|
||||
def visit(self, node, *args, **kwargs): ...
|
||||
def generic_visit(self, node, *args, **kwargs): ...
|
||||
|
||||
class NodeTransformer(NodeVisitor):
|
||||
def generic_visit(self, node, *args, **kwargs): ...
|
||||
def visit_list(self, node, *args, **kwargs): ...
|
||||
Reference in New Issue
Block a user