OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TableFunctionsFactory_transformers.AstPrinter Class Reference
+ Inheritance diagram for TableFunctionsFactory_transformers.AstPrinter:
+ Collaboration diagram for TableFunctionsFactory_transformers.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 TableFunctionsFactory_transformers.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 98 of file TableFunctionsFactory_transformers.py.

Member Function Documentation

def TableFunctionsFactory_transformers.AstPrinter.visit_annotation_node (   self,
  annotation_node 
)

Definition at line 121 of file TableFunctionsFactory_transformers.py.

References join().

122  def visit_annotation_node(self, annotation_node):
123  # key=value
124  key = annotation_node.key
125  value = annotation_node.value
126  if isinstance(value, list):
127  return "%s=[%s]" % (key, ','.join([v.accept(self) for v in value]))
128  return "%s=%s" % (key, value)
std::string join(T const &container, std::string const &delim)

+ Here is the call graph for this function:

def TableFunctionsFactory_transformers.AstPrinter.visit_arg_node (   self,
  arg_node 
)

Definition at line 129 of file TableFunctionsFactory_transformers.py.

References join().

130  def visit_arg_node(self, arg_node):
131  # type | annotation
132  typ = arg_node.type.accept(self)
133  if arg_node.annotations:
134  ann = " | ".join([a.accept(self) for a in arg_node.annotations])
135  s = "%s | %s" % (typ, ann)
136  else:
137  s = "%s" % (typ,)
138  return s
std::string join(T const &container, std::string const &delim)

+ Here is the call graph for this function:

def TableFunctionsFactory_transformers.AstPrinter.visit_composed_node (   self,
  composed_node 
)

Definition at line 139 of file TableFunctionsFactory_transformers.py.

References join().

140  def visit_composed_node(self, composed_node):
141  T = composed_node.inner[0].accept(self)
142  if composed_node.is_array():
143  # Array<T>
144  assert len(composed_node.inner) == 1
145  return "Array" + T
146  if composed_node.is_column():
147  # Column<T>
148  assert len(composed_node.inner) == 1
149  return "Column" + T
150  if composed_node.is_column_list():
151  # ColumnList<T>
152  assert len(composed_node.inner) == 1
153  return "ColumnList" + T
154  if composed_node.is_output_buffer_sizer():
155  # kConstant<N>
156  N = T
157  assert len(composed_node.inner) == 1
158  return util.translate_map.get(composed_node.type) + "<%s>" % (N,)
159  if composed_node.is_cursor():
160  # Cursor<T1, T2, ..., TN>
161  Ts = ", ".join([i.accept(self) for i in composed_node.inner])
162  return "Cursor<%s>" % (Ts)
163  raise ValueError(composed_node)
std::string join(T const &container, std::string const &delim)

+ Here is the call graph for this function:

def TableFunctionsFactory_transformers.AstPrinter.visit_primitive_node (   self,
  primitive_node 
)

Definition at line 164 of file TableFunctionsFactory_transformers.py.

165  def visit_primitive_node(self, primitive_node):
166  t = primitive_node.type
167  if primitive_node.is_output_buffer_sizer():
168  # arg_pos is zero-based
169  return util.translate_map.get(t, t) + "<%d>" % (
170  primitive_node.get_parent(tf_node.ArgNode).arg_pos + 1,
171  )
172  return util.translate_map.get(t, t)
173 
def TableFunctionsFactory_transformers.AstPrinter.visit_template_node (   self,
  template_node 
)

Definition at line 115 of file TableFunctionsFactory_transformers.py.

References join().

116  def visit_template_node(self, template_node):
117  # T=[T1, T2, ..., TN]
118  key = template_node.key
119  types = ['"%s"' % typ for typ in template_node.types]
120  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 TableFunctionsFactory_transformers.AstPrinter.visit_udtf_node (   self,
  udtf_node 
)

Definition at line 101 of file TableFunctionsFactory_transformers.py.

References join().

102  def visit_udtf_node(self, udtf_node):
103  name = udtf_node.name
104  inputs = ", ".join([arg.accept(self) for arg in udtf_node.inputs])
105  outputs = ", ".join([arg.accept(self) for arg in udtf_node.outputs])
106  annotations = "| ".join([annot.accept(self) for annot in udtf_node.annotations])
107  sizer = " | " + udtf_node.sizer.accept(self) if udtf_node.sizer else ""
108  if annotations:
109  annotations = ' | ' + annotations
110  if udtf_node.templates:
111  templates = ", ".join([t.accept(self) for t in udtf_node.templates])
112  return "%s(%s)%s -> %s, %s%s" % (name, inputs, annotations, outputs, templates, sizer)
113  else:
114  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: