type:: Object types
 Return filters of given type or all filters
 if not type is supplied
514991
def filters(type=nil)
      unless(type)
        @filters.dup
      else
        const = Splib.find_const(type)
        type = const unless const.nil?
        @filters[type] ? @filters[type].dup : nil
      end
    end
1230967
function (filters) {
      if (!this.isArray(filters)) {
        throw 'Invalid filters type supplied. Expected Array.';
      }

      for (var i = 0; i < filters.length; i++) {
        this.enableFilter(filters[i]);
      }

      return this;
    }
503939
function(type, filter, tabs) {
			if (isType(type)) {
				return JSON.stringify(parse(type), filter, tabs);
			} else {
				throw new TypeError("Expected edb.Object|edb.Array");
			}
		}
462083
function filter(pred, m) {
  if(!isPredOrFunc(pred)) {
    throw new TypeError('filter: Pred or predicate function required for first argument')
  }

  const fn =
    x => predOrFunc(pred, x)

  if(m && isFunction(m.filter)) {
    return m.filter(fn)
  }

  if(m && isObject(m)) {
    return object.filter(fn, m)
  }

  throw new TypeError('filter: Filterable or Object required for second argument')
}
461264
function getTypeClass(type) {
  switch (type) {
    case String:
      return types.String;
    case Number:
      return types.Number;
    case Date:
      return types.Date;
    case Boolean:
      return types.Boolean;
    case Buffer:
      return types.Buffer;
  }

  if (typeof type === 'string') return types[type];

  for (const ii in types) {
    if (types[ii] === type) return types[ii];
  }
  return null;
}
331495
function filter(type) {
  if (utils.isObject(type)) {
    return type
  }
  else if (!filters.hasOwnProperty(type)) {
    throw new FieldError('Bad filter type: ' + type)
  }

  var args = utils.args(arguments, 1)
    , filter = {
      type: type
    }

  filters[type].apply(filter, args)

  return filter
}
858921
public function filter($filters)
    {
        $filtered = [];
        foreach ($this->objectArr as $obj) {
            $success = true;
            foreach ($filters as $prop => $value) {
                if ($obj->$prop !== $value) {
                    $success = false;
                    break;
                }
            }
            if ($success) {
                $filtered[] = $obj;
            }
        }
        return $filtered;
    }
1339836
function queryFilter(where) {
  if (where.$or) {
    return object =>
      _.reduce(where.$or, (result, subclause) => result ||
        queryFilter(subclause)(object), false);
  }

  // Go through each key in where clause
  return object => _.reduce(where, (result, whereParams, key) => {
    const match = evaluateObject(object, whereParams, key);
    return result && match;
  }, true);
}
470568
def filter_by(self, **filters):
        ''' '''
        for name, value in filters.items():
            self.filter(resolve_name(self.type, name) == value)
        return self
1125639
function prepareTypesArg (types) {
  if (Array.isArray(types)) {
    return types
  }
  if (types instanceof String) {
    types += ''
  }
  if (typeof types === 'string') {
    return types.trim().split(' ').filter(Boolean)
  }
  return [types]
}
258498
def get_by_type(self, _type):
        
        r = {}
        for k, v in self.items():
            if get_component_type(k) is _type:
                r[k] = v
        return r
604512
def get_types(func):
    
    return _get_types(func, util.is_classmethod(func), util.is_method(func))
1077078
def is_object_type(type_):
    

    object_types = _get_types(Types.OBJECT)
    if is_typing_type(type_):
        return type_ in object_types or (
            hasattr(type_, "__origin__") and type_.__origin__ in object_types
        )
    return type_ in object_types
1262933
def add(type, filter=nil, &block)
      if((filter.nil? && !block_given?) || (filter && !filter.is_a?(Filter)))
        raise ArgumentError.new('Filter or proc must be provided for filter')
      end
      const = Splib.find_const(type)
      type = const unless const.nil?
      @lock.synchronize do
        @filters[type] ||= {}
      end
      if(block_given?)
        unless(block.arity == 1 || block.arity < 0)
          raise ArgumentError.new('Block must accept a parameter')
        end
        @lock.synchronize do
          @filters[type][:procs] ||= []
          unless(@filters[type][:procs].include?(block))
            @filters[type][:procs] << block
          end
        end
      end
      if(filter)
        @lock.synchronize do
          unless(@filters[type].include?(filter))
            @filters[type][:filters] ||= []
            unless(@filters[type][:filters].include?(filter))
              @filters[type][:filters] << filter
            end
          end
        end
      end
      filter ? block_given? ? [filter, block] : filter : block
    end
599292
def of_type(*types)
      Specification.new(reader, result.dup{ |r| r.with_types = types.flatten })
    end
1352822
def is_filter_type(target):
    # type: (Any) -> Union[bool, Text]
    
    if not is_class(target):
        return 'not a class'

    if not issubclass(target, BaseFilter):
        return 'does not extend BaseFilter'

    if is_abstract(target):
        return 'abstract class'

    return True
1208604
def _build_filter_part(self, cls, filters, order_by=None, select=None):
        
        import types
        query_parts = []

        order_by_filtered = False

        if order_by:
            if order_by[0] == "-":
                order_by_method = "DESC";
                order_by = order_by[1:]
            else:
                order_by_method = "ASC";

        if select:
            if order_by and order_by in select:
                order_by_filtered = True
            query_parts.append("(%s)" % select)

        if isinstance(filters, str) or isinstance(filters, unicode):
            query = "WHERE %s AND `__type__` = '%s'" % (filters, cls.__name__)
            if order_by in ["__id__", "itemName()"]:
                query += " ORDER BY itemName() %s" % order_by_method
            elif order_by != None:
                query += " ORDER BY `%s` %s" % (order_by, order_by_method)
            return query

        for filter in filters:
            filter_parts = []
            filter_props = filter[0]
            if type(filter_props) != list:
                filter_props = [filter_props]
            for filter_prop in filter_props:
                (name, op) = filter_prop.strip().split(" ", 1)
                value = filter[1]
                property = cls.find_property(name)
                if name == order_by:
                    order_by_filtered = True
                if types.TypeType(value) == types.ListType:
                    filter_parts_sub = []
                    for val in value:
                        val = self.encode_value(property, val)
                        if isinstance(val, list):
                            for v in val:
                                filter_parts_sub.append(self._build_filter(property, name, op, v))
                        else:
                            filter_parts_sub.append(self._build_filter(property, name, op, val))
                    filter_parts.append("(%s)" % (" OR ".join(filter_parts_sub)))
                else:
                    val = self.encode_value(property, value)
                    if isinstance(val, list):
                        for v in val:
                            filter_parts.append(self._build_filter(property, name, op, v))
                    else:
                        filter_parts.append(self._build_filter(property, name, op, val))
            query_parts.append("(%s)" % (" or ".join(filter_parts)))


        type_query = "(`__type__` = '%s'" % cls.__name__
        for subclass in self._get_all_decendents(cls).keys():
            type_query += " or `__type__` = '%s'" % subclass
        type_query +=")"
        query_parts.append(type_query)

        order_by_query = ""

        if order_by:
            if not order_by_filtered:
                query_parts.append("`%s` LIKE '%%'" % order_by)
            if order_by in ["__id__", "itemName()"]:
                order_by_query = " ORDER BY itemName() %s" % order_by_method
            else:
                order_by_query = " ORDER BY `%s` %s" % (order_by, order_by_method)

        if len(query_parts) > 0:
            return "WHERE %s %s" % (" AND ".join(query_parts), order_by_query)
        else:
            return ""