class_docstr: Base class for general-purpose Python-to-string code transformation.
  
  Similar to Base, but outputs arbitrary strings instead of a Python AST.
  
  This uses the same visitor mechanism that the standard NodeVisitor uses,
  meaning that subclasses write handlers for the different kinds of nodes.
  New code is generated using the emit method, which appends to a code buffer
  that can be afterwards obtained from code_buffer.
  
  Example:
  
    class SimpleCodeGen(CodeGenerator):
  
      def visitIf(self, node):
        self.emit('if ')
        self.visit(node.test)
        self.emit(' { ')
        self.visit(node.body)
        self.emit(' } else { ')
        self.visit(node.orelse)
        self.emit(' } ')
  
    node = ast.parse(...)
    gen = SimpleCodeGen()
    gen.visit(node)
    # gen.code_buffer contains the resulting code
class_docstr_tok: ["Base","class","for","general-purpose","Python-to-string","code","transformation",".","Similar","to","Base",",","but","outputs","arbitrary","strings","instead","of","a","Python","AST",".","This","uses","the","same","visitor","mechanism","that","the","standard","NodeVisitor","uses",",","meaning","that","subclasses","write","handlers","for","the","different","kinds","of","nodes",".","New","code","is","generated","using","the","emit","method",",","which","appends","to","a","code","buffer","that","can","be","afterwards","obtained","from","code_buffer",".","Example",":","class","SimpleCodeGen","(","CodeGenerator",")",":","def","visitIf","(","self",",","node",")",":","self.emit","(","'if","'",")","self.visit","(","node.test",")","self.emit","(","'","{","'",")","self.visit","(","node.body",")","self.emit","(","'","}","else","{","'",")","self.visit","(","node.orelse",")","self.emit","(","'","}","'",")","node","=","ast.parse","(","...",")","gen","=","SimpleCodeGen","(",")","gen.visit","(","node",")","#","gen.code_buffer","contains","the","resulting","code"]
code: def __init__(self, ctx):
      super(CodeGenerator, self).__init__(ctx)
  
      self._output_code = ""
      self.source_map = {}
  
imports: import collections
  import enum
  import gast
  from nvidia.dali._autograph.pyct import anno
  from nvidia.dali._autograph.pyct import parser
  from nvidia.dali._autograph.pyct import pretty_printer
  from nvidia.dali._autograph.pyct import templates
label_desc: Use image node_id 1 to create a new CodeGenerator object from inherited base classes: NodeStateTracker, gast with example: obj = CodeGenerator(ctx)