MCPcopy
hub / github.com/pallets/jinja / preprocess

Method preprocess

src/jinja2/environment.py:645–659  ·  view source on GitHub ↗

Preprocesses the source with all extensions. This is automatically called for all parsing and compiling methods but *not* for :meth:`lex` because there you usually only want the actual source tokenized.

(
        self,
        source: str,
        name: t.Optional[str] = None,
        filename: t.Optional[str] = None,
    )

Source from the content-addressed store, hash-verified

643 self.handle_exception(source=source)
644
645 def preprocess(
646 self,
647 source: str,
648 name: t.Optional[str] = None,
649 filename: t.Optional[str] = None,
650 ) -> str:
651 """Preprocesses the source with all extensions. This is automatically
652 called for all parsing and compiling methods but *not* for :meth:`lex`
653 because there you usually only want the actual source tokenized.
654 """
655 return reduce(
656 lambda s, e: e.preprocess(s, name, filename),
657 self.iter_extensions(),
658 str(source),
659 )
660
661 def _tokenize(
662 self,

Callers 2

babel_extractFunction · 0.95
_tokenizeMethod · 0.95

Calls 1

iter_extensionsMethod · 0.95

Tested by

no test coverage detected