1import typing as t
2
3from .filters import FILTERS as DEFAULT_FILTERS  # noqa: F401
4from .tests import TESTS as DEFAULT_TESTS  # noqa: F401
5from .utils import Cycler
6from .utils import generate_lorem_ipsum
7from .utils import Joiner
8from .utils import Namespace
9
10if t.TYPE_CHECKING:
11    import typing_extensions as te
12
13# defaults for the parser / lexer
14BLOCK_START_STRING = "{%"
15BLOCK_END_STRING = "%}"
16VARIABLE_START_STRING = "{{"
17VARIABLE_END_STRING = "}}"
18COMMENT_START_STRING = "{#"
19COMMENT_END_STRING = "#}"
20LINE_STATEMENT_PREFIX: t.Optional[str] = None
21LINE_COMMENT_PREFIX: t.Optional[str] = None
22TRIM_BLOCKS = False
23LSTRIP_BLOCKS = False
24NEWLINE_SEQUENCE: "te.Literal['\\n', '\\r\\n', '\\r']" = "\n"
25KEEP_TRAILING_NEWLINE = False
26
27# default filters, tests and namespace
28
29DEFAULT_NAMESPACE = {
30    "range": range,
31    "dict": dict,
32    "lipsum": generate_lorem_ipsum,
33    "cycler": Cycler,
34    "joiner": Joiner,
35    "namespace": Namespace,
36}
37
38# default policies
39DEFAULT_POLICIES: t.Dict[str, t.Any] = {
40    "compiler.ascii_str": True,
41    "urlize.rel": "noopener",
42    "urlize.target": None,
43    "urlize.extra_schemes": None,
44    "truncate.leeway": 5,
45    "json.dumps_function": None,
46    "json.dumps_kwargs": {"sort_keys": True},
47    "ext.i18n.trimmed": False,
48}
49