Returns a filtered copy of the given object's own enumerable properties (no inherited
properties), keeping any keys that pass the given filter function.
767090
function applyFilterOnObject(obj, filterFn) {
    if (filterFn == null) {
        return Object.assign({}, obj);
    }

    const filteredObj = {};
    coreObjectEntries(obj).forEach(([key, val]) => {
        if (filterFn(val, key)) {
            filteredObj[key] = val;
        }
    });

    return filteredObj;
}
710284
def get_objects(self):
        
        # Create a mapping of source ARs for copy
        uids = self.request.form.get("uids", "")
        if not uids:
            # check for the `items` parammeter
            uids = self.request.form.get("items", "")
        if isinstance(uids, basestring):
            uids = uids.split(",")
        unique_uids = OrderedDict().fromkeys(uids).keys()
        return filter(None, map(self.get_object_by_uid, unique_uids))
126893
private String[] getCopyFrom(int from, String[] propertyKeyArray) {
		return Arrays.copyOfRange(propertyKeyArray, from,
				propertyKeyArray.length);
	}
31024
static public Map<String,Object> propertiesToMap(Dictionary<?, ?> properties)
    {
        Map<String,Object> map = null;
        if (properties != null)
        {
	        map = new Hashtable<String,Object>();
	        Enumeration<?> keys = properties.keys();
	        while (keys.hasMoreElements())
	        {
	        	Object key = keys.nextElement();
                map.put((String)key, properties.get(key));	            
	        }
        }
        return map;
    }
1301568
def copy(self):
        
        other = PackageFilterList.__new__(PackageFilterList)
        other.filters = [x.copy() for x in self.filters]
        return other
857715
public Object map(Object sourceEnumerable, Function mapFunction) {
        return map(sourceEnumerable, mapFunction, false);
    }
390918
function iterateOverKeys(getFn, obj, fn, hidden) {
  var keys = getFn(obj), desc;
  for (var i = 0, key; key = keys[i]; i++) {
    desc = getOwnPropertyDescriptor(obj, key);
    if (desc.enumerable || hidden) {
      fn(obj[key], key);
    }
  }
}
132414
def from_keyed_iterable(iterable, key, filter_func=None):
    """"""

    generated = {}

    for element in iterable:
        try:
            k = getattr(element, key)
        except AttributeError:
            raise RuntimeError("{} does not have the keyed attribute: {}".format(
                element, key
            ))

        if filter_func is None or filter_func(element):
            if k in generated:
                generated[k] += [element]
            else:
                generated[k] = [element]

    return generated
690032
private Multimap<Type, Class<?>> filterProducibleClasses(Map<Key<?>, Class<?>> bindings) {
        Multimap<Type, Class<?>> defaultFactoryToBind = ArrayListMultimap.create();
        bindings.entrySet()
                .stream()
                .filter(entry -> isCandidate(entry.getKey()
                        .getTypeLiteral()
                        .getType()))
                .forEach(entry -> defaultFactoryToBind.put(entry.getKey()
                        .getTypeLiteral()
                        .getType(), entry.getValue()));
        return defaultFactoryToBind;
    }
628895
def filter(self, *args, **kwargs):
        
        clone = self._clone()
        for f in args:
            clone.filter_obj.add_filter(f)
        for key, value in kwargs.items():
            clone.filter_obj.add_filter_param(key, value)
        return clone
518348
def _normalise_key_values(filter_obj, attr_map=None):
    
    new_filter = {}
    for key, constraints in filter_obj.items():
        aliased_key = key
        if attr_map is not None:
            aliased_key = attr_map.get(key)
            if aliased_key is None:
                raise CloudValueError(
                    'Invalid key %r for filter attribute; must be one of:\n%s' % (
                        key,
                        attr_map.keys()
                    )
                )
        if not isinstance(constraints, dict):
            constraints = {'eq': constraints}
        for operator, value in constraints.items():
            # FIXME: deprecate this $ nonsense
            canonical_operator = FILTER_OPERATOR_ALIASES.get(operator.lstrip('$'))
            if canonical_operator is None:
                raise CloudValueError(
                    'Invalid operator %r for filter key %s; must be one of:\n%s' % (
                        operator,
                        key,
                        FILTER_OPERATOR_ALIASES.keys()
                    )
                )
            canonical_key = str('%s__%s' % (aliased_key, canonical_operator))
            new_filter[canonical_key] = _normalise_value(value)
    return new_filter
618640
private static void removeNonApplicableFilters(
            Collection<EntitySpec> entitySpecs, Set<Filter> filtersCopy,
            EntitySpec entitySpec) {
        Set<EntitySpec> entitySpecsSet = new HashSet<>();
        Set<String> filterPropIds = new HashSet<>();
        String[] entitySpecPropIds = entitySpec.getPropositionIds();
        for (Iterator<Filter> itr = filtersCopy.iterator(); itr.hasNext();) {
            Filter f = itr.next();
            Arrays.addAll(filterPropIds, f.getPropositionIds());
            for (EntitySpec es : entitySpecs) {
                if (Collections.containsAny(filterPropIds,
                        es.getPropositionIds())) {
                    entitySpecsSet.add(es);
                }
            }
            if (Collections.containsAny(filterPropIds, entitySpecPropIds)) {
                return;
            }
            if (!atLeastOneInInboundReferences(entitySpecsSet, entitySpec)) {
                itr.remove();
            }
            entitySpecsSet.clear();
            filterPropIds.clear();
        }
    }
276658
function filterByKeys(keys, values) {
  var filtered = {};

  forEach(keys, function (name) {
    filtered[name] = values[name];
  });
  return filtered;
}
176874
def copy(self):
        
        retfilters = Filters(self.filter_converter, self.datamodel)
        retfilters.filters = copy.copy(self.filters)
        retfilters.values = copy.copy(self.values)
        return retfilters
722007
@GwtIncompatible // Class.isInstance
  public static <T> Iterable<T> filter(final Iterable<?> unfiltered, final Class<T> desiredType) {
    checkNotNull(unfiltered);
    checkNotNull(desiredType);
    return new FluentIterable<T>() {
      @Override
      public Iterator<T> iterator() {
        return Iterators.filter(unfiltered.iterator(), desiredType);
      }
    };
  }
52961
private List<E> getFilteredList(Class<E> enumeration, E... excludedValues) {
        List<E> filteredValues = new ArrayList<>();
        Collections.addAll(filteredValues, enumeration.getEnumConstants());
        if (excludedValues != null) {
            for (E element : excludedValues) {
                filteredValues.remove(element);
            }
        }
        return filteredValues;
    }
591145
private FilterList getExtPropertyFilters(EntityMetadata m, FilterList filterList)
    {
        Filter filter = getFilter(m.getTableName());
        if (filter != null)
        {
            if (filterList == null)
            {
                filterList = new FilterList();
            }
            filterList.addFilter(filter);
        }
        return filterList;
    }