from _typeshed import Incomplete
from collections.abc import Generator
from docassemble.base.mako import compat as compat, exceptions as exceptions, util as util

class Context:
    _buffer_stack: Incomplete
    _data: Incomplete
    _kwargs: Incomplete
    _with_template: Incomplete
    _outputting_as_unicode: Incomplete
    namespaces: Incomplete
    caller_stack: Incomplete
    def __init__(self, buffer, **data) -> None: ...
    def _set_with_template(self, t) -> None: ...
    @property
    def lookup(self): ...
    @property
    def kwargs(self): ...
    def push_caller(self, caller) -> None: ...
    def pop_caller(self) -> None: ...
    def keys(self): ...
    def __getitem__(self, key): ...
    def _push_writer(self): ...
    def _pop_buffer_and_writer(self): ...
    def _push_buffer(self) -> None: ...
    def _pop_buffer(self): ...
    def get(self, key, default: Incomplete | None = ...): ...
    def write(self, string) -> None: ...
    def writer(self): ...
    def _copy(self): ...
    def _locals(self, d): ...
    def _clean_inheritance_tokens(self): ...

class CallerStack(list):
    nextcaller: Incomplete
    def __init__(self) -> None: ...
    def __nonzero__(self): ...
    def __bool__(self) -> bool: ...
    def _get_caller(self): ...
    def __getattr__(self, key): ...
    def _push_frame(self): ...
    def _pop_frame(self) -> None: ...

class Undefined:
    def __str__(self): ... # type: ignore
    def __nonzero__(self): ...
    def __bool__(self) -> bool: ...

UNDEFINED: Incomplete
STOP_RENDERING: str

class LoopStack:
    stack: Incomplete
    def __init__(self) -> None: ...
    def _enter(self, iterable): ...
    def _exit(self): ...
    @property
    def _top(self): ...
    def _pop(self): ...
    def _push(self, iterable): ...
    def __getattr__(self, key) -> None: ...
    def __iter__(self): ...

class LoopContext:
    _iterable: Incomplete
    index: int
    parent: Incomplete
    def __init__(self, iterable) -> None: ...
    def __iter__(self): ...
    @util.memoized_property
    def __len__(self) -> int: ...
    @property
    def reverse_index(self): ...
    @property
    def first(self): ...
    @property
    def last(self): ...
    @property
    def even(self): ...
    @property
    def odd(self): ...
    def cycle(self, *values): ...

class _NSAttr:
    __parent: Incomplete
    def __init__(self, parent) -> None: ...
    def __getattr__(self, key): ...

class Namespace:
    name: Incomplete
    context: Incomplete
    inherits: Incomplete
    callables: Incomplete
    def __init__(self, name, context, callables: Incomplete | None = ..., inherits: Incomplete | None = ..., populate_self: bool = ..., calling_uri: Incomplete | None = ...) -> None: ...
    module: Incomplete
    template: Incomplete
    filename: Incomplete
    uri: Incomplete
    _templateuri: Incomplete
    @util.memoized_property
    def attr(self): ...
    def get_namespace(self, uri): ...
    def get_template(self, uri): ...
    def get_cached(self, key, **kwargs): ...
    @property
    def cache(self): ...
    def include_file(self, uri, **kwargs) -> None: ...
    def _populate(self, d, l) -> None: ...
    def _get_star(self) -> Generator[Incomplete, None, None]: ...
    def __getattr__(self, key): ...

class TemplateNamespace(Namespace):
    name: Incomplete
    context: Incomplete
    inherits: Incomplete
    callables: Incomplete
    template: Incomplete
    _templateuri: Incomplete
    def __init__(self, name, context, template: Incomplete | None = ..., templateuri: Incomplete | None = ..., callables: Incomplete | None = ..., inherits: Incomplete | None = ..., populate_self: bool = ..., calling_uri: Incomplete | None = ...) -> None: ...
    @property
    def module(self): ...
    @property
    def filename(self): ...
    @property
    def uri(self): ...
    def _get_star(self) -> Generator[Incomplete, None, Incomplete]: ...
    def __getattr__(self, key): ...

class ModuleNamespace(Namespace):
    name: Incomplete
    context: Incomplete
    inherits: Incomplete
    callables: Incomplete
    module: Incomplete
    def __init__(self, name, context, module, callables: Incomplete | None = ..., inherits: Incomplete | None = ..., populate_self: bool = ..., calling_uri: Incomplete | None = ...) -> None: ...
    @property
    def filename(self): ...
    def _get_star(self) -> Generator[Incomplete, None, None]: ...
    def __getattr__(self, key): ...

def supports_caller(func): ...
def capture(context, callable_, *args, **kwargs): ...
def _decorate_toplevel(fn): ...
def _decorate_inline(context, fn): ...
def _include_file(context, uri, calling_uri, **kwargs) -> None: ...
def _inherit_from(context, uri, calling_uri): ...
def _lookup_template(context, uri, relativeto): ...
def _populate_self_namespace(context, template, self_ns: Incomplete | None = ...): ...
def _render(template, callable_, args, data, as_unicode: bool = ...): ...
def _kwargs_for_callable(callable_, data): ...
def _kwargs_for_include(callable_, data, **kwargs): ...
def _render_context(tmpl, callable_, context, *args, **kwargs) -> None: ...
def _exec_template(callable_, context, args: Incomplete | None = ..., kwargs: Incomplete | None = ...) -> None: ...
def _render_error(template, context, error) -> None: ...
