Functions available for listing columns and filters.
515246
def make_funcs(dataset, setdir, store):
    """"""
    return {
        'cat': lambda *lists: [x for lst in lists for x in lst],
        'comments': lambda: None,
        'detail_route': detail_route,
        'format': lambda fmt, *args: fmt.format(*args),
        'get': partial(getnode, dataset, setdir, store),
        'join': lambda sep, *args: sep.join([x for x in args if x]),
        'len': len,
        'link': (lambda href, title, target=None:
                 {'href': href or "",
                  'title': title or "",
                  'target': '_blank' if target is None else target}),
        'list': lambda *x: filter(None, list(x)),
        'max': max,
        'min': min,
        'status': lambda: ['#STATUS#'],
        'sum': sum,
        'tags': lambda: ['#TAGS#'],
        'trace': print_trace,
    }
84064
def read_with_columns(func):
    
    def wrapper(*args, **kwargs):
        # parse columns argument
        columns = kwargs.pop("columns", None)

        # read table
        tab = func(*args, **kwargs)

        # filter on columns
        if columns is None:
            return tab
        return tab[columns]

    return _safe_wraps(wrapper, func)
308724
def _with_columns(self, columns):
        """"""
        table = type(self)()
        for label, column in zip(self.labels, columns):
            self._add_column_and_format(table, label, column)
        return table
482065
def local_columns(self):
        
        if self._columns:
            return self._columns
        else:
            self._call_func()
            return self._columns
976371
def column_list(string):
    """"""
    try:
        columns = list(map(int, string.split(',')))
    except ValueError as e:
        raise argparse.ArgumentTypeError(*e.args)
    for column in columns:
        if column < 1:
            raise argparse.ArgumentTypeError(
                'Invalid column {!r}: column numbers start at 1.'
                .format(column))
    return columns
1182105
def _set_column_filter_expressions(self):
        
        # per columns filters:
        for i in range(len(self.columns)):
            filter_expr = None
            value = self.params.get('columns[{:d}][search][value]'.format(i),
                                    '')
            if value:
                search_func = SEARCH_METHODS[self.columns[i].search_method]
                filter_expr = search_func(self.columns[i].sqla_expr, value)
            self.filter_expressions.append(filter_expr)
1255251
def filter(self, func):
        """"""  # noqa: E501
        return self.__class__([x for x in self.res if func(x)],
                              name="filtered %s" % self.listname)
671661
def column_names(self):
        """"""
        return [name for (name, d) in self._columns.items()
                if d.get('show', True)]
64015
def filter(self, table, groups, filter_string):
        """"""
        query = filter_string.lower()
        return [group for group in groups
                if query in group.name.lower()]
139687
def _filter_data_frame(df, data_col, filter_col, filter_str=None):
    """"""
    if filter_str is not None:
        relevant_cols = data_col + [filter_col]
        df.dropna(inplace=True, subset=relevant_cols)
        row_filter = df[filter_col].str.contains(filter_str, case=False)
        data_list = df[row_filter][data_col].to_dict()
    else:
        data_list = df[data_col].to_dict()
    return data_list
1285126
def columns(self):
        
        fields = [f.label for f in self.form_fields
                  if self.cleaned_data["field_%s_export" % f.id]]
        if self.cleaned_data["field_0_export"]:
            fields.append(self.entry_time_name)
        return fields
662777
def filter(self, func):
        """"""
        return self.__class__( [ i for i in self.res if func(*i) ], name='filtered %s'%self.listname)
824375
def filter(self, table, items, filter_string):
        """"""
        query = filter_string.lower()
        return [item for item in items
                if query in item.name.lower()]
1082123
def get_filters(cls, raw_filters, num_cols, columns_dict):  # noqa
        """"""
        filters = None
        for flt in raw_filters:
            col = flt.get('col')
            op = flt.get('op')
            eq = flt.get('val')
            if (
                    not col or
                    not op or
                    (eq is None and op not in ('IS NULL', 'IS NOT NULL'))):
                continue

            # Check if this dimension uses an extraction function
            # If so, create the appropriate pydruid extraction object
            column_def = columns_dict.get(col)
            dim_spec = column_def.dimension_spec if column_def else None
            extraction_fn = None
            if dim_spec and 'extractionFn' in dim_spec:
                (col, extraction_fn) = DruidDatasource._create_extraction_fn(dim_spec)

            cond = None
            is_numeric_col = col in num_cols
            is_list_target = op in ('in', 'not in')
            eq = cls.filter_values_handler(
                eq, is_list_target=is_list_target,
                target_column_is_numeric=is_numeric_col)

            # For these two ops, could have used Dimension,
            # but it doesn't support extraction functions
            if op == '==':
                cond = Filter(dimension=col, value=eq, extraction_function=extraction_fn)
            elif op == '!=':
                cond = ~Filter(dimension=col, value=eq, extraction_function=extraction_fn)
            elif op in ('in', 'not in'):
                fields = []
                # ignore the filter if it has no value
                if not len(eq):
                    continue
                # if it uses an extraction fn, use the "in" operator
                # as Dimension isn't supported
                elif extraction_fn is not None:
                    cond = Filter(
                        dimension=col,
                        values=eq,
                        type='in',
                        extraction_function=extraction_fn,
                    )
                elif len(eq) == 1:
                    cond = Dimension(col) == eq[0]
                else:
                    for s in eq:
                        fields.append(Dimension(col) == s)
                    cond = Filter(type='or', fields=fields)
                if op == 'not in':
                    cond = ~cond
            elif op == 'regex':
                cond = Filter(
                    extraction_function=extraction_fn,
                    type='regex',
                    pattern=eq,
                    dimension=col,
                )

            # For the ops below, could have used pydruid's Bound,
            # but it doesn't support extraction functions
            elif op == '>=':
                cond = Filter(
                    type='bound',
                    extraction_function=extraction_fn,
                    dimension=col,
                    lowerStrict=False,
                    upperStrict=False,
                    lower=eq,
                    upper=None,
                    alphaNumeric=is_numeric_col,
                )
            elif op == '<=':
                cond = Filter(
                    type='bound',
                    extraction_function=extraction_fn,
                    dimension=col,
                    lowerStrict=False,
                    upperStrict=False,
                    lower=None,
                    upper=eq,
                    alphaNumeric=is_numeric_col,
                )
            elif op == '>':
                cond = Filter(
                    type='bound',
                    extraction_function=extraction_fn,
                    lowerStrict=True,
                    upperStrict=False,
                    dimension=col,
                    lower=eq,
                    upper=None,
                    alphaNumeric=is_numeric_col,
                )
            elif op == '<':
                cond = Filter(
                    type='bound',
                    extraction_function=extraction_fn,
                    upperStrict=True,
                    lowerStrict=False,
                    dimension=col,
                    lower=None,
                    upper=eq,
                    alphaNumeric=is_numeric_col,
                )
            elif op == 'IS NULL':
                cond = Dimension(col) == None  # NOQA
            elif op == 'IS NOT NULL':
                cond = Dimension(col) != None  # NOQA

            if filters:
                filters = Filter(type='and', fields=[
                    cond,
                    filters,
                ])
            else:
                filters = cond

        return filters
1126416
def columns(self):
        """"""
        res = [col['name'] for col in self.column_definitions]
        res.extend([col['name'] for col in self.foreign_key_definitions])
        return res
56073
def _where(self, filter_fn):
        '''  '''
        assert callable(filter_fn), 'filter_fn needs to be callable'
        return VList(i for i in self if filter_fn(i()))
1337359
function filter(rows = [], filters = [], filterText, columns) {
  let filteredRows = rows.slice(0);
  if (filters.length === 0 && !filterText) {
    return filteredRows;
  }

  const textFilters = [
    ...(filterText ? [filterText.toLowerCase()] : []),
    ...filters.filter(f => f.textFilter).map(f => f.value),
  ];

  const valueFilters = filters.filter(f => f.valueFilter);

  // apply text filters across all columns
  if (textFilters.length > 0) {
    filteredRows = _.filter(rows, row => _.some(columns, (column) => {
      if (!column.searchable) {
        return false;
      }
      const normalized = String(_.get(row, column.key)).toLowerCase();
      return _.every(textFilters, f => normalized.indexOf(f) > -1);
    }));
  }

  // apply value filters on filterable columns
  if (valueFilters.length > 0) {
    const groups = _.groupBy(valueFilters, 'key');
    filteredRows = _.filter(filteredRows, row => _.every(
      groups,
      (groupFilters, groupKey) => {
        const value = _.get(row, groupKey);
        return _.some(groupFilters, f => f.value === value);
      }
    ));
  }

  return filteredRows;
}