Exemplo n.º 1
0
 def createNestedTable(self):
     """
 Table
   A
   B
   Subtable
     C
     D
 :return dict: name, object pairs
 """
     if IGNORE_TEST:
         return
     table = UITable("Table")
     result = {"Table": table}
     result["A"] = Column("A")
     table.addColumn(result["A"])
     result["B"] = Column("B")
     table.addColumn(result["B"])
     subtable = UITable("Subtable")
     result["Subtable"] = subtable
     table.addChild(subtable)
     result["C"] = Column("C")
     subtable.addColumn(result["C"])
     result["D"] = Column("D")
     subtable.addColumn(result["D"])
     return result
Exemplo n.º 2
0
 def setUp(self):
   self.table = ht.createTable("TEST",
       column_name=[ht.COLUMN1, ht.COLUMN2])
   new_column = Column(FORMULA_COLUMN_NAME)
   new_column.setFormula("np.sin(%s)" % ht.COLUMN1)
   self.table.addColumn(new_column)
   self.table.evaluate()
   columns = self.table.getColumns()
   self.column_variables =  \
       [ColumnVariable(c) for c in columns] 
Exemplo n.º 3
0
 def _commandAppendAndInsert(self, node, target, command, name):
     """
 Processes Append and Insert commands for targets of Column and Table.
 :param NamedTree node:
 :param str target:
 :param str command:
 :param str name: name for new Column
 :return str error:
 """
     versioned = self.getVersionedFile()
     UITable._versionCheckpoint(versioned, target, command)
     error = Column.isPermittedName(name)
     if self._isDuplicateInGlobalScope(name):
         error = "%s conflics with existing names" % proposed_name
     if error is None:
         new_column = Column(name)
         increment = 0
         if command == "Append":
             increment = 1
         parent = node.getParent()
         column_index = node.getPosition()
         new_column_index = column_index + increment
         parent.addChild(new_column, new_column_index)
     return error