Find the MRCA using a temporary table.
176565
def _large_mrca(self, ts):
        """"""
        cursor = self.db.cursor()

        cursor.execute("""
            DROP TABLE IF EXISTS _mrca_temp
        """)

        cursor.execute("""
            CREATE TEMPORARY TABLE _mrca_temp(
                child TEXT PRIMARY KEY REFERENCES taxa (tax_id) NOT NULL
            )
        """)

        cursor.executemany("""
            INSERT INTO _mrca_temp
            VALUES (?)
        """, ((tid,) for tid in ts))
        cursor.execute("""
            SELECT parent
            FROM   _mrca_temp
                   JOIN parents USING (child)
                   JOIN taxa
                     ON parent = taxa.tax_id
                   JOIN ranks USING (rank)
            GROUP  BY parent
            HAVING COUNT(*) = ?
            ORDER  BY rank_order DESC
            LIMIT  1
        """, (len(ts),))

        return cursor.fetchall()
408965
def millRule(self,aLvlNow,pLvlNow):
        '''
        
        '''
        MrkvNow = self.MrkvNow_hist[self.Shk_idx]
        temp =  self.calcRandW(aLvlNow,pLvlNow)
        temp(MrkvNow = MrkvNow)
        return temp
267126
public Table findUserTable(Session session, String name,
                               String schemaName) {

        Schema schema = (Schema) schemaMap.get(schemaName);

        if (schema == null) {
            return null;
        }

        if (session != null) {
            Table table = session.getLocalTable(name);
            if (table != null) {
                return table;
            }
        }

        int i = schema.tableList.getIndex(name);

        if (i == -1) {
            return null;
        }

        return (Table) schema.tableList.get(i);
    }
778170
def _fill_table_entry(self, row, col):
        ""
        self.observation_table[row, col] = self._membership_query(row + col)
411337
def select(table, index_track, field_name, op, value, includeMissing):
    '''
    '''
    result = []
    result_index = []
    counter = 0
    for row in table:
        if detect_fields(field_name, convert_to_dict(row)):
            final_value = get_value(row, field_name)
            if do_op(final_value, op, value):
                result.append(row)
                result_index.append(index_track[counter])
        else:
            if includeMissing:
                result.append(row)
                result_index.append(index_track[counter])
        counter += 1
    #table = result
    #index_track = result_index
    return (result, result_index)
1106196
def MRCA(list_of_taxids):
    

    from ete2 import Tree

    t = TaxIDTree(list_of_taxids)
    t = Tree(str(t), format=8)

    ancestor = t.get_common_ancestor(*t.get_leaves())

    return ancestor.name
688958
def describe(self, tablename, refresh=False, metrics=False, require=False):
        
        table = self.cached_descriptions.get(tablename)
        if refresh or table is None or (metrics and not table.consumed_capacity):
            desc = self.connection.describe_table(tablename)
            if desc is None:
                if require:
                    raise RuntimeError("Table %r not found" % tablename)
                else:
                    return None
            table = TableMeta.from_description(desc)
            self.cached_descriptions[tablename] = table
            if metrics:
                read, write = self.get_capacity(tablename)
                table.consumed_capacity["__table__"] = {"read": read, "write": write}
                for index_name in table.global_indexes:
                    read, write = self.get_capacity(tablename, index_name)
                    table.consumed_capacity[index_name] = {"read": read, "write": write}

        return table
313439
def table_abcd():
    """"""
    table_instance = SingleTable([['A', 'B'], ['C', 'D']])

    # Get first table lines.
    table_instance.outer_border = False
    table_inner_borders = table_instance.table.splitlines()

    # Get second table lines.
    table_instance.outer_border = True
    table_instance.inner_heading_row_border = False
    table_instance.inner_column_border = False
    table_outer_borders = table_instance.table.splitlines()

    # Combine.
    smallest, largest = sorted([table_inner_borders, table_outer_borders], key=len)
    smallest += [''] * (len(largest) - len(smallest))  # Make both same size.
    combined = list()
    for i, row in enumerate(largest):
        combined.append(row.ljust(10) + '          ' + smallest[i])
    return '\n'.join(combined)
4716
Table findUserTableForIndex(Session session, String name,
                                String schemaName) {

        Schema   schema    = (Schema) schemaMap.get(schemaName);
        HsqlName indexName = schema.indexLookup.getName(name);

        if (indexName == null) {
            return null;
        }

        return findUserTable(session, indexName.parent.name, schemaName);
    }
1238077
def find_model(self, constructor, constraints=None, *, columns=None, table_name=None,
                 order_by=None):
    """"""
    return self._find_model(constructor, table_name or constructor.table_name, constraints,
                            columns=columns, order_by=order_by)
849787
private Table findTable(String alias) {
		List<String> names = null;
		if (tableScope == null) {
			// no tables to find
			return null;
		}

		for (ScopeChild child : tableScope.children) {
			if (catalogReader.nameMatcher().matches(child.name, alias)) {
				names = ((SqlIdentifier) child.namespace.getNode()).names;
				break;
			}
		}
		if (names == null || names.size() == 0) {
			return null;
		} else if (names.size() == 1) {
			return findTable(catalogReader.getRootSchema(), names.get(0),
				catalogReader.nameMatcher().isCaseSensitive());
		}

		CalciteSchema.TableEntry entry =
			SqlValidatorUtil.getTableEntry(catalogReader, names);

		return entry == null ? null : entry.getTable();
	}
1048450
private static AbstractScanPlanNode
    getScanAccessPlanForTable(StmtTableScan tableScan, AccessPath path)
    {
        // build the scan node
        SeqScanPlanNode scanNode = new SeqScanPlanNode(tableScan);
        // build the predicate
        scanNode.setPredicate(path.otherExprs);
        return scanNode;
    }
1011721
function templ_table($attrib)
    {
        if (empty($attrib['id']))
            $attrib['id'] = 'acl-table';

        $out = $this->list_rights($attrib);

        $this->rc->output->add_gui_object('acltable', $attrib['id']);

        return $out;
    }
25509
def GetSource(self, row, col, table=None):
        """"""

        if table is None:
            table = self.grid.current_table

        value = self.code_array((row, col, table))

        if value is None:
            return u""
        else:
            return value
380167
def _get_k(self):
        '''
        
        '''
        if not self.ready:
            self.k.create() # create table if it does not exist.
            self.ready = True

        return self.k
703431
private void findAfterLocal(Result<Cursor> result,
                              RowCursor cursor,
                              Object []args,
                              Cursor cursorLocal)
  {
    long version = 0;
    
    if (cursorLocal != null) {
      version = cursorLocal.getVersion();
      long time = cursorLocal.getUpdateTime();
      long timeout = cursorLocal.getTimeout();
      
      long now = CurrentTime.currentTime();
      
      if (now <= time + timeout) {
        result.ok(cursorLocal);
        return;
      }
    }
    
    TablePod tablePod = _table.getTablePod();
    
    tablePod.getIfUpdate(cursor.getKey(), version,
                         result.then((table,r)->_selectQueryLocal.findOne(r, args)));
  }
443702
function findLargestAbsElement (M) {
  const te = M.elements;
  const n = M.dimension;
  let max = _Math.abs(te[0]);
  let rowCol = {
    row: 0,
    column: 0,
    value: te[0]
  };
  for (let i = 0; i < n; ++i) {
    for (let j = 0; j < n; ++j) {
      const val = te[i * n + j];
      const ti = _Math.abs(val);
      if (ti > max) {
        max = ti;
        rowCol.row = j;
        rowCol.column = i;
        rowCol.value = val;
      }
    }
  }
  return rowCol;
}