MCPcopy Create free account
hub / github.com/EasyIME/PIME / _ApplyBlock

Class _ApplyBlock

python/python3/tornado/template.py:594–614  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

592
593
594class _ApplyBlock(_Node):
595 def __init__(self, method: str, line: int, body: _Node) -> None:
596 self.method = method
597 self.line = line
598 self.body = body
599
600 def each_child(self) -> Iterable["_Node"]:
601 return (self.body,)
602
603 def generate(self, writer: "_CodeWriter") -> None:
604 method_name = "_tt_apply%d" % writer.apply_counter
605 writer.apply_counter += 1
606 writer.write_line("def %s():" % method_name, self.line)
607 with writer.indent():
608 writer.write_line("_tt_buffer = []", self.line)
609 writer.write_line("_tt_append = _tt_buffer.append", self.line)
610 self.body.generate(writer)
611 writer.write_line("return _tt_utf8('').join(_tt_buffer)", self.line)
612 writer.write_line(
613 "_tt_append(_tt_utf8(%s(%s())))" % (self.method, method_name), self.line
614 )
615
616
617class _ControlBlock(_Node):

Callers 1

_parseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected