Beispiel #1
0
 def _getNodes(count):
     nodes = []
     while len(nodes) < count:
         excludes = list(nodes)
         node = _getNode(self.table, "Column", excludes=excludes)
         if not Table.isNameColumn(node):
             nodes.append(node)
     return nodes
  def _findColumnWithType(self, table, val):
    # Inputs: table - table being analyzed
    #         val - value whose type is to be matched
    # Returns the index of the column with the specified type or None
    # Assumes that the columns are either str or a number
    def notIsStrs(vals):
      return not cell_types.isStrs(vals)

    if cell_types.isStr(val):
      func = cell_types.isStrs
    else:
      func = notIsStrs
    for column in table.getColumns():
      if Table.isNameColumn(column):
        continue
      if func(column.getCells()):
        return table.indexFromColumn(column)
    def _findColumnWithType(self, table, val):
        """
    :param Table table:
    :param object val:
    :return Column:
    Assumes that the columns are either str or a number
    """
        def notIsStrs(vals):
            return not cell_types.isStrs(vals)

        if cell_types.isStr(val):
            func = cell_types.isStrs
        else:
            func = notIsStrs
        for column in table.getColumns():
            if Table.isNameColumn(column):
                continue
            if func(column.getCells()):
                return column