You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.2KB

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