OmniSciDB  085a039ca4
 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 671 of file generate_TableFunctionsFactory_init.py.

Member Function Documentation

def generate_TableFunctionsFactory_init.AstPrinter.visit_annotation_node (   self,
  annotation_node 
)

Definition at line 694 of file generate_TableFunctionsFactory_init.py.

References join().

695  def visit_annotation_node(self, annotation_node):
696  # key=value
697  key = annotation_node.key
698  value = annotation_node.value
699  if isinstance(value, list):
700  return "%s=[%s]" % (key, ','.join([v.accept(self) for v in value]))
701  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 702 of file generate_TableFunctionsFactory_init.py.

References join().

703  def visit_arg_node(self, arg_node):
704  # type | annotation
705  typ = arg_node.type.accept(self)
706  if arg_node.annotations:
707  ann = " | ".join([a.accept(self) for a in arg_node.annotations])
708  s = "%s | %s" % (typ, ann)
709  else:
710  s = "%s" % (typ,)
711  # insert input_id=args<0> if input_id is not specified
712  if s == "ColumnTextEncodingDict" and arg_node.kind == "output":
713  return s + " | input_id=args<0>"
714  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 715 of file generate_TableFunctionsFactory_init.py.

References join().

716  def visit_composed_node(self, composed_node):
717  T = composed_node.inner[0].accept(self)
718  if composed_node.is_column():
719  # Column<T>
720  assert len(composed_node.inner) == 1
721  return "Column" + T
722  if composed_node.is_column_list():
723  # ColumnList<T>
724  assert len(composed_node.inner) == 1
725  return "ColumnList" + T
726  if composed_node.is_output_buffer_sizer():
727  # kConstant<N>
728  N = T
729  assert len(composed_node.inner) == 1
730  return translate_map.get(composed_node.type) + "<%s>" % (N,)
731  if composed_node.is_cursor():
732  # Cursor<T1, T2, ..., TN>
733  Ts = ", ".join([i.accept(self) for i in composed_node.inner])
734  return "Cursor<%s>" % (Ts)
735  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 736 of file generate_TableFunctionsFactory_init.py.

737  def visit_primitive_node(self, primitive_node):
738  t = primitive_node.type
739  if primitive_node.is_output_buffer_sizer():
740  # arg_pos is zero-based
741  return translate_map.get(t, t) + "<%d>" % (
742  primitive_node.get_parent(ArgNode).arg_pos + 1,
743  )
744  return translate_map.get(t, t)
745 
def generate_TableFunctionsFactory_init.AstPrinter.visit_template_node (   self,
  template_node 
)

Definition at line 688 of file generate_TableFunctionsFactory_init.py.

References join().

689  def visit_template_node(self, template_node):
690  # T=[T1, T2, ..., TN]
691  key = template_node.key
692  types = ['"%s"' % typ for typ in template_node.types]
693  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 674 of file generate_TableFunctionsFactory_init.py.

References join().

675  def visit_udtf_node(self, udtf_node):
676  name = udtf_node.name
677  inputs = ", ".join([arg.accept(self) for arg in udtf_node.inputs])
678  outputs = ", ".join([arg.accept(self) for arg in udtf_node.outputs])
679  annotations = "| ".join([annot.accept(self) for annot in udtf_node.annotations])
680  sizer = " | " + udtf_node.sizer.accept(self) if udtf_node.sizer else ""
681  if annotations:
682  annotations = ' | ' + annotations
683  if udtf_node.templates:
684  templates = ", ".join([t.accept(self) for t in udtf_node.templates])
685  return "%s(%s)%s -> %s, %s%s" % (name, inputs, annotations, outputs, templates, sizer)
686  else:
687  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: