Returns list of table nodes from ods object
357446
def _get_tables(self, ods):
        """"""

        childnodes = ods.spreadsheet.childNodes
        qname_childnodes = [(s.qname[1], s) for s in childnodes]
        return [node for name, node in qname_childnodes if name == u"table"]
1208482
def _get_table_rows(parent_table, table_name, row_name):
        
        if parent_table is None:
            return []
        _table = parent_table.get(table_name)
        _table_rows = []
        if isinstance(_table, list):
            _table_rows = [_table_row.get(row_name) for _table_row in _table]
        elif isinstance(_table, dict):
            _table_rows = _table.get(row_name)
        if not isinstance(_table_rows, list):
            _table_rows = [_table_rows]
        return _table_rows
1070050
def _get_table_names(statement):
    

    parts = statement.to_unicode().split()

    tables = set()

    for i, token in enumerate(parts):
        if token.lower() == 'from' or token.lower().endswith('join'):
            tables.add(parts[i + 1].rstrip(';'))

    return list(tables)
761739
public static <T extends Node> List<T> findNodes(List<Node> nodes, Class<T> cls) {
        List<T> results = new ArrayList<>();
        findNodes(nodes, cls, results);
        return results;
    }
1057256
def tables(self):
        """"""
        if len(self._tables) == 0:
            self.refresh_schema(self._exclude_system_tables, self._use_cache)
        return self._tables
290122
def _list_nodes(full=False, for_output=False):
    '''
    
    '''
    fetch = True
    page = 1
    ret = {}

    while fetch:
        items = query(method='droplets',
                      command='?page=' + six.text_type(page) + '&per_page=200')
        for node in items['droplets']:
            name = node['name']
            ret[name] = {}
            if full:
                ret[name] = _get_full_output(node, for_output=for_output)
            else:
                public_ips, private_ips = _get_ips(node['networks'])
                ret[name] = {
                    'id': node['id'],
                    'image': node['image']['name'],
                    'name': name,
                    'private_ips': private_ips,
                    'public_ips': public_ips,
                    'size': node['size_slug'],
                    'state': six.text_type(node['status']),
                }

        page += 1
        try:
            fetch = 'next' in items['links']['pages']
        except KeyError:
            fetch = False

    return ret
227326
def other_Orange_tables(self):
        '''
            
        '''
        target_table = self.db.target_table
        if not self.db.orng_tables:
            return [self.convert_table(table, None) for table in self.db.tables if table != target_table]
        else:
            return [table for name, table in list(self.db.orng_tables.items()) if name != target_table]
929801
def get_nodes(environment=None):
    """"""
    if not os.path.exists('nodes'):
        return []
    nodes = []
    for filename in sorted(
            [f for f in os.listdir('nodes')
             if (not os.path.isdir(f)
                 and f.endswith(".json") and not f.startswith('.'))]):
        fqdn = ".".join(filename.split('.')[:-1])  # Remove .json from name
        node = get_node(fqdn)
        if environment is None or node.get('chef_environment') == environment:
            nodes.append(node)
    return nodes
869188
def _build_object_table(self):
        ''''''
        types = self.domain.types
        objects = dict(self.non_fluents.objects)
        self.object_table = dict()
        for name, value in self.domain.types:
            if value == 'object':
                objs = objects[name]
                idx = { obj: i for i, obj in enumerate(objs) }
                self.object_table[name] = {
                    'size': len(objs),
                    'idx': idx,
                    'objects': objs
                }
625745
def get_collection_tree(collection_ident, cursor):
    """"""
    cursor.execute('''
    WITH RECURSIVE t(node, parent, document, path) AS (
        SELECT tr.nodeid, tr.parent_id, tr.documentid, ARRAY[tr.nodeid]
        FROM trees tr
        WHERE tr.documentid = %s and tr.is_collated = 'False'
    UNION ALL
        SELECT c.nodeid, c.parent_id, c.documentid, path || ARRAY[c.nodeid]
        FROM trees c JOIN t ON c.parent_id = t.node
        WHERE NOT c.nodeid = ANY(t.path)
    )
    SELECT t.document, m.portal_type
    FROM t JOIN modules m
    ON t.document = m.module_ident''', [collection_ident])
    for i in cursor.fetchall():
        yield i
799394
def list_nodes():
    '''
    
    '''
    ret = {}
    nodes = list_nodes_full()
    for node in nodes:
        ret[node] = {
            'id': nodes[node]['UUID'],
            'image': nodes[node]['Guest OS'],
            'name': nodes[node]['Name'],
            'state': None,
            'private_ips': [],
            'public_ips': [],
        }
        ret[node]['size'] = '{0} RAM, {1} CPU'.format(
            nodes[node]['Memory size'],
            nodes[node]['Number of CPUs'],
        )
    return ret
179432
def list_nodes(full=False, call=None):
    '''
    
    '''
    if call == 'action':
        raise SaltCloudSystemExit(
            'The list_nodes function must be called with -f or --function.'
        )

    ret = {}
    nodes = list_nodes_full('function')
    if full:
        return nodes

    for node in nodes:
        ret[node] = {}
        for item in ('id', 'image', 'size', 'public_ips', 'private_ips', 'state'):
            ret[node][item] = nodes[node][item]

    return ret
823500
def list_nodes(conn=None, call=None):
    '''
    

    '''
    if call == 'action':
        raise SaltCloudSystemExit(
            'The list_nodes function must be called with -f or --function.'
        )
    ret = {}
    for node, info in list_nodes_full(conn=conn).items():
        for key in ('id', 'name', 'size', 'state', 'private_ips', 'public_ips', 'floating_ips', 'fixed_ips', 'image'):
            ret.setdefault(node, {}).setdefault(key, info.get(key))

    return ret
1069974
def nodes_map(self):
        
        dct = dict()
        for node in self.nodes.values():
            cls = next(base for base in getmro(node.__class__) if "__tablename__" in base.__dict__)
            key = getattr(cls, "__alias__", underscore(cls.__name__))
            dct.setdefault(key, []).append(node)
        return dct
298361
def export_to_dicts(table, *args, **kwargs):
    """"""
    field_names = table.field_names
    return [{key: getattr(row, key) for key in field_names} for row in table]
848835
private DBObject parseObject(TableDefinition tableDef, UNode docNode) {
        assert tableDef != null;
        assert docNode != null;
        assert docNode.getName().equals("doc");
        
        // Create the DBObject that we will return and parse the child nodes into it.
        DBObject dbObj = new DBObject();
        for (UNode childNode: docNode.getMemberList()) {
            // Extract field name and characterize what we expect.
            String fieldName = childNode.getName();
            FieldDefinition fieldDef = tableDef.getFieldDef(fieldName);
            boolean isLinkField = fieldDef == null ? false : fieldDef.isLinkField();
            boolean isGroupField = fieldDef == null ? false : fieldDef.isGroupField();
            boolean isCollection = fieldDef == null ? false : fieldDef.isCollection();
            Utils.require(!isGroupField,    // we currently don't expect group fields in query results
                          "Unexpected group field in query results: " + fieldName);
            
            // Parse value based on what we expect.
            if (isLinkField) {
                parseLinkValue(dbObj, childNode, fieldDef);
            } else if (isCollection) {
                parseMVScalarValue(dbObj, childNode, fieldDef);
            } else {
                // Simple SV scalar value.
                Utils.require(childNode.isValue(),
                              "Value of an SV scalar must be a value: " + childNode);
                dbObj.addFieldValue(fieldName, childNode.getValue());
            }
        }
        
        // Our object is complete
        return dbObj;
    }
979688
function collectNodeIds(stmt) {
  var ids = {},
      stack = [],
      curr;

  var push = stack.push.bind(stack);

  push(stmt);
  while(stack.length) {
    curr = stack.pop();
    switch(curr.type) {
      case "node": ids[curr.id] = true; break;
      case "edge": _.each(curr.elems, push); break;
      case "subgraph": _.each(curr.stmts, push); break;
    }
  }

  return _.keys(ids);
}