As :func:`petl.transform.intervals.facetintervallookup` but return records.
323579
def facetintervalrecordlookup(table, key, start='start', stop='stop',
                              include_stop=False):
    

    trees = facetrecordtrees(table, key, start=start, stop=stop)
    out = dict()
    for k in trees:
        out[k] = IntervalTreeLookup(trees[k], include_stop=include_stop)
    return out
705484
def _get_val(record, keys):
    '''
    
    '''
    data = record
    for key in keys:
        if key in data:
            data = data[key]
        else:
            return None
    return data
485359
function getNextVal(searchVal, mapping) {
  let value
  if (isMap(mapping)) {
    for (let [key, val] of mapping.entries()) {
      if (deepEqual(key, searchVal)) {
        value = val
        break
      }
    }
  } else {
    value = (mapping.find(keyVal => deepEqual(keyVal[0], searchVal)) || [])[1]
  }

  if (typeof value === 'function') {
    return value()
  }
  return value
}
878436
def _get_rel_of_type(self, reltype):
        
        matching = [rel for rel in self.values() if rel.reltype == reltype]
        if len(matching) == 0:
            tmpl = "no relationship of type '%s' in collection"
            raise KeyError(tmpl % reltype)
        if len(matching) > 1:
            tmpl = "multiple relationships of type '%s' in collection"
            raise ValueError(tmpl % reltype)
        return matching[0]
510774
def get_vals(self, field, goids=None):
        """"""
        go2nt = self.go2nt
        if goids is None:
            goids = set(go2nt)
        return [getattr(go2nt[go], field) for go in goids]
542481
def returns(prices, method='simple', periods=1, fill_method='pad', limit=None, freq=None):
    
    if method not in ('simple', 'compound', 'log'):
        raise ValueError("Invalid method type. Valid values are ('simple', 'compound')")

    if method == 'simple':
        return prices.pct_change(periods=periods, fill_method=fill_method, limit=limit, freq=freq)
    else:
        if freq is not None:
            raise NotImplementedError("TODO: implement this logic if needed")

        if isinstance(prices, pd.Series):
            if fill_method is None:
                data = prices
            else:
                data = prices.fillna(method=fill_method, limit=limit)

            data = np.log(data / data.shift(periods=periods))
            mask = pd.isnull(prices.values)
            np.putmask(data.values, mask, np.nan)
            return data
        else:
            return pd.DataFrame(
                {name: returns(col, method, periods, fill_method, limit, freq) for name, col in prices.iteritems()},
                columns=prices.columns,
                index=prices.index)
218146
def recordset(method):
        """"""
        def wrapper(self, *args, **kwargs):
            if self.__records__ is None:
                raise ValidationError(
                    'There are no records in the set.',
                )
            return method(self, *args, **kwargs)
        return Api.model(wrapper)
210342
def from_record(cls, record, crs):
        """"""
        if 'type' not in record:
            raise TypeError("The data isn't a valid record.")

        return cls(to_shape(record), crs)
965720
function (values) {
            var record = {};
            _gpfArrayForEach(this._columns, function (name, idx) {
                var value = values[idx];
                if (value !== undefined) {
                    record[name] = values[idx];
                }
            });
            return record;
        }
882141
def _GetDistinctValues(self, field_name):
    
    self._cursor.execute(
        'SELECT {0:s}, COUNT({0:s}) FROM log2timeline GROUP BY {0:s}'.format(
            field_name))

    result = {}
    row = self._cursor.fetchone()
    while row:
      if row[0]:
        result[row[0]] = row[1]
      row = self._cursor.fetchone()
    return result
294458
def _evaluate_lookup(self, key, value, negated, db):
        """"""
        results = {}
        for record_key, record_value in db.items():
            match = True

            stripped_key, lookup_class = self._extract_lookup(key)
            lookup = lookup_class(record_value[stripped_key], value)

            if negated:
                match &= not eval(lookup.as_expression())
            else:
                match &= eval(lookup.as_expression())

            if match:
                results[record_key] = record_value

        return results
652344
def as_df():
    """"""
    records = []
    for sym, ele in vars(_this).items():
        if sym not in ["Element", "Isotope"] and not sym.startswith("_"):
            for k, v in vars(ele).items():
                if k.startswith("_") and k[1].isdigit():
                    records.append({kk: vv for kk, vv in vars(v).items() if not kk.startswith("_")})
    return _DF.from_records(records)
347455
def search(self, *args, **kwargs):
        """"""
        ret = []
        for record in Handler.ALL_VERS_DATA.values():
            matchArgs = list(kwargs.keys())
            for k,v in iteritems(kwargs): # restrict records based on key-value match requirement
                try:
                    if record[k] != v: break # a non-matching requirement means this record doesn't match
                except: break # record doesn't have required key 'k'
                matchArgs.remove(k)
            if matchArgs: continue # didn't match all required kwargs
            matchArgs = list(args)
            for k,v in iteritems(record): # find any record with a <value> in it
                if k in matchArgs: matchArgs.remove(k)
                if v in matchArgs: matchArgs.remove(v)
            if matchArgs: continue # didn't match all required args
            ret.append(record)
        return ret
1024044
def convert_level(self, record):
        """"""
        level = record.levelno
        if level >= logging.CRITICAL:
            return levels.CRITICAL
        if level >= logging.ERROR:
            return levels.ERROR
        if level >= logging.WARNING:
            return levels.WARNING
        if level >= logging.INFO:
            return levels.INFO
        return levels.DEBUG
1045927
def find_by(self, values={}, **kwargs):
        
        try:
            return self(
                **self.select(
                    where=values,
                    limit=1,
                    **kwargs
                    ).to_dict(orient='records')[0]
                )
        except IndexError:
            return None
30427
def intervalsubtract(left, right, lstart='start', lstop='stop', rstart='start',
                     rstop='stop', lkey=None, rkey=None, include_stop=False):
    

    assert (lkey is None) == (rkey is None), \
        'facet key field must be provided for both or neither table'
    return IntervalSubtractView(left, right, lstart=lstart, lstop=lstop,
                                rstart=rstart, rstop=rstop, lkey=lkey,
                                rkey=rkey, include_stop=include_stop)
47006
def get_one_record(self, *args, **kwargs):
        

        records = self.call(*args, **kwargs)
        records = list(records)
        len_ = len(records)

        if len_ != 1:
            raise ValueError("We were told to only return one record, but "
                             "this did not match what was given: (%d)" % 
                             (len_,))

        return records[0]