graphdot.codegen.template module

class graphdot.codegen.template.Template(template, escape=True)[source]

Bases: object

A template string with placeholders in the format of ${…} or ?{…}, which can be rendered on-demand. Helpful for code generation.

Parameters:
  • template (str) – A template string containing placeholders in the format of ${…}.
  • escape (bool) – Whether or not backslash () should be escaped in the fill-in contents to the placeholders.
context(**kwargs)[source]
render(**substitutions)[source]

Substitute placeholders using the syntax symbol=replacement. Partial renderings are allowed. If replacement is list-like, use the trailing sequence of symbol match in placeholders to join members; otherwise do plain substitution.