MCPcopy Create free account
hub / github.com/webpy/webpy / generate_code

Method generate_code

web/template.py:993–1000  ·  view source on GitHub ↗
(text, filename, parser=None)

Source from the content-addressed store, hash-verified

991 return BaseTemplate.__call__(self, *a, **kw)
992
993 def generate_code(text, filename, parser=None):
994 # parse the text
995 parser = parser or Parser()
996 rootnode = parser.parse(text, filename)
997
998 # generate python code from the parse tree
999 code = rootnode.emit(indent="").strip()
1000 return safestr(code)
1001
1002 generate_code = staticmethod(generate_code)
1003

Callers 2

compile_templateMethod · 0.80
compile_templatesFunction · 0.80

Calls 4

safestrFunction · 0.85
ParserClass · 0.70
parseMethod · 0.45
emitMethod · 0.45

Tested by

no test coverage detected