OmniSciDB  a987f07e93
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
generate_TableFunctionsFactory_init.AstPrinter Class Reference
+ Inheritance diagram for generate_TableFunctionsFactory_init.AstPrinter:
+ Collaboration diagram for generate_TableFunctionsFactory_init.AstPrinter:

Public Member Functions

def visit_udtf_node
 
def visit_template_node
 
def visit_annotation_node
 
def visit_arg_node
 
def visit_composed_node
 
def visit_primitive_node
 
- Public Member Functions inherited from generate_TableFunctionsFactory_init.AstVisitor
def visit_udtf_node
 
def visit_composed_node
 
def visit_arg_node
 
def visit_primitive_node
 
def visit_annotation_node
 
def visit_template_node
 

Detailed Description

Returns a line formatted. Useful for testing

Definition at line 683 of file generate_TableFunctionsFactory_init.py.

Member Function Documentation

def generate_TableFunctionsFactory_init.AstPrinter.visit_annotation_node (   self,
  annotation_node 
)

Definition at line 706 of file generate_TableFunctionsFactory_init.py.

References join().

707  def visit_annotation_node(self, annotation_node):
708  # key=value
709  key = annotation_node.key
710  value = annotation_node.value
711  if isinstance(value, list):
712  return "%s=[%s]" % (key, ','.join([v.accept(self) for v in value]))
713  return "%s=%s" % (key, value)
std::string join(T const &container, std::string const &delim)

+ Here is the call graph for this function:

def generate_TableFunctionsFactory_init.AstPrinter.visit_arg_node (   self,
  arg_node 
)

Definition at line 714 of file generate_TableFunctionsFactory_init.py.

References join().

715  def visit_arg_node(self, arg_node):
716  # type | annotation
717  typ = arg_node.type.accept(self)
718  if arg_node.annotations:
719  ann = " | ".join([a.accept(self) for a in arg_node.annotations])
720  s = "%s | %s" % (typ, ann)
721  else:
722  s = "%s" % (typ,)
723  # insert input_id=args<0> if input_id is not specified
724  if s == "ColumnTextEncodingDict" and arg_node.kind == "output":
725  return s + " | input_id=args<0>"
726  return s
std::string join(T const &container, std::string const &delim)

+ Here is the call graph for this function:

def generate_TableFunctionsFactory_init.AstPrinter.visit_composed_node (   self,
  composed_node 
)

Definition at line 727 of file generate_TableFunctionsFactory_init.py.

References join().

728  def visit_composed_node(self, composed_node):
729  T = composed_node.inner[0].accept(self)
730  if composed_node.is_array():
731  # Array<T>
732  assert len(composed_node.inner) == 1
733  return "Array" + T
734  if composed_node.is_column():
735  # Column<T>
736  assert len(composed_node.inner) == 1
737  return "Column" + T
738  if composed_node.is_column_list():
739  # ColumnList<T>
740  assert len(composed_node.inner) == 1
741  return "ColumnList" + T
742  if composed_node.is_output_buffer_sizer():
743  # kConstant<N>
744  N = T
745  assert len(composed_node.inner) == 1
746  return translate_map.get(composed_node.type) + "<%s>" % (N,)
747  if composed_node.is_cursor():
748  # Cursor<T1, T2, ..., TN>
749  Ts = ", ".join([i.accept(self) for i in composed_node.inner])
750  return "Cursor<%s>" % (Ts)
751  raise ValueError(composed_node)
std::string join(T const &container, std::string const &delim)

+ Here is the call graph for this function:

def generate_TableFunctionsFactory_init.AstPrinter.visit_primitive_node (   self,
  primitive_node 
)

Definition at line 752 of file generate_TableFunctionsFactory_init.py.

753  def visit_primitive_node(self, primitive_node):
754  t = primitive_node.type
755  if primitive_node.is_output_buffer_sizer():
756  # arg_pos is zero-based
757  return translate_map.get(t, t) + "<%d>" % (
758  primitive_node.get_parent(ArgNode).arg_pos + 1,
759  )
760  return translate_map.get(t, t)
761 
def generate_TableFunctionsFactory_init.AstPrinter.visit_template_node (   self,
  template_node 
)

Definition at line 700 of file generate_TableFunctionsFactory_init.py.

References join().

701  def visit_template_node(self, template_node):
702  # T=[T1, T2, ..., TN]
703  key = template_node.key
704  types = ['"%s"' % typ for typ in template_node.types]
705  return "%s=[%s]" % (key, ", ".join(types))
std::string join(T const &container, std::string const &delim)

+ Here is the call graph for this function:

def generate_TableFunctionsFactory_init.AstPrinter.visit_udtf_node (   self,
  udtf_node 
)

Definition at line 686 of file generate_TableFunctionsFactory_init.py.

References join().

687  def visit_udtf_node(self, udtf_node):
688  name = udtf_node.name
689  inputs = ", ".join([arg.accept(self) for arg in udtf_node.inputs])
690  outputs = ", ".join([arg.accept(self) for arg in udtf_node.outputs])
691  annotations = "| ".join([annot.accept(self) for annot in udtf_node.annotations])
692  sizer = " | " + udtf_node.sizer.accept(self) if udtf_node.sizer else ""
693  if annotations:
694  annotations = ' | ' + annotations
695  if udtf_node.templates:
696  templates = ", ".join([t.accept(self) for t in udtf_node.templates])
697  return "%s(%s)%s -> %s, %s%s" % (name, inputs, annotations, outputs, templates, sizer)
698  else:
699  return "%s(%s)%s -> %s%s" % (name, inputs, annotations, outputs, sizer)
std::string join(T const &container, std::string const &delim)

+ Here is the call graph for this function:


The documentation for this class was generated from the following file: