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

Class ExpressionNode

web/template.py:581–599  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

579
580
581class ExpressionNode:
582 def __init__(self, value, escape=True):
583 self.value = value.strip()
584
585 # convert ${...} to $(...)
586 if value.startswith("{") and value.endswith("}"):
587 self.value = "(" + self.value[1:-1] + ")"
588
589 self.escape = escape
590
591 def emit(self, indent, begin_indent=""):
592 return f"escape_({self.value}, {bool(self.escape)})"
593
594 def __repr__(self):
595 if self.escape:
596 escape = ""
597 else:
598 escape = ":"
599 return f"${escape}{self.value}"
600
601
602class AssignmentNode:

Callers 1

read_exprMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected