Eliminates None or empty items from lists, tuples or sets passed in.
    If values is None or empty after filtering, the default is returned.
487960
def filter_empty(values, default=None):
    

    if values is None:
        return default
    elif hasattr(values, '__len__') and len(values) == 0:
        return default
    elif hasattr(values, '__iter__') and not isinstance(values, _filtered_types):
        filtered = type(values) if isinstance(values, _filter_types) else list
        values = filtered(
            v for v in values if not (v is None or (hasattr(v, '__len__') and len(v) == 0))
        )
        return default if len(values) == 0 else values

    return values
936103
def clean(self, value):
        """"""

        if isinstance(value, numpy.ndarray):
            return value
        elif isinstance(value, (list, tuple)):
            return numpy.array(value)

        raise ParameterNotValidError
1309491
def filter_none(data: Dict[str, Any],
                keys: OptKeys = None) -> Dict[str, Any]:
    

    def limited_filter(k: str, v: Any) -> bool:
        return k not in keys or v is not None  # type: ignore

    def full_filter(k: str, v: Any) -> bool:
        return v is not None

    f = limited_filter if keys is not None else full_filter
    return {k: v for k, v in data.items() if f(k, v)}
532860
def default_empty(shape, dtype):
    
    default = numpy.zeros(shape, dtype=dtype)
    set_default_empty(default)
    return default
1316320
def clean(self, value):
		

		# If the value is None and it's optional, return as is
		if value is None and self._optional:
			return None

		# Go through each of the nodes
		for i in range(len(self._nodes)):

			# If it's valid
			if self._nodes[i].valid(value):

				# Use it's clean
				return self._nodes[i].clean(value)

		# Something went wrong
		raise ValueError('value', value)
734705
def without(self, *values):
        
        if self._clean.isDict():
            newlist = {}
            for i, k in enumerate(self.obj):
                # if k not in values:  # use indexof to check identity
                if _(values).indexOf(k) is -1:
                    newlist.set(k, self.obj[k])
        else:
            newlist = []
            for i, v in enumerate(self.obj):
                # if v not in values:  # use indexof to check identity
                if _(values).indexOf(v) is -1:
                    newlist.append(v)

        return self._wrap(newlist)
1363255
private int filterNondominatedSet(double[][] front, int noPoints, int noObjectives) {
    int i, j;
    int n;

    n = noPoints;
    i = 0;
    while (i < n) {
      j = i + 1;
      while (j < n) {
        if (dominates(front[i], front[j], noObjectives)) {
  /* remove point 'j' */
          n--;
          swap(front, j, n);
        } else if (dominates(front[j], front[i], noObjectives)) {
	/* remove point 'i'; ensure that the point copied to index 'i'
	   is considered in the next outer loop (thus, decrement i) */
          n--;
          swap(front, i, n);
          i--;
          break;
        } else {
          j++;
        }
      }
      i++;
    }
    return n;
  }
1072051
def remove_none_dict_values(obj):
    
    if isinstance(obj, (list, tuple, set)):
        return type(obj)(remove_none_dict_values(x) for x in obj)
    elif isinstance(obj, dict):
        return type(obj)((k, remove_none_dict_values(v))
                         for k, v in obj.items()
                         if v is not None)
    else:
        return obj
685570
def clean(self, value):
		

		# If the value is None and it's optional, return as is
		if value is None and self._optional:
			return None

		# If the value is not a dict
		if not isinstance(value, dict):
			raise ValueError('value')

		# Init the return value
		dRet = {}

		# Go through each value and clean it using the associated node
		for k in value.keys():
			try:
				dRet[k] = self._nodes[k].clean(value[k])
			except KeyError:
				raise ValueError('%s is not a valid node in the parent' % k)

		# Return the cleaned values
		return dRet
749022
def drop_empty(rows):
    
    return zip(*[col for col in zip(*rows) if bool(filter(bool, col[1:]))])
984253
def clean(self, value):
        """"""

        if isinstance(value, (list, tuple)):
            return [super(FeatureCollectionParameter, self).clean(x) for x in value]

        raise ParameterNotValidError
492016
def clean(self, value):
        """"""
        if not value:
            return None

        # if any value exists, then add "0" as a placeholder to the remaining
        # values.
        if isinstance(value, list) and any(value):
            for i, item in enumerate(value):
                if not item:
                    value[i] = '0'

        return super(MultipleDecimalField, self).clean(value)
1023508
def remove_properties_containing_None(properties_dict):
    
    # remove empty properties - as validations may fail
    new_dict  = dict()
    for key in properties_dict.keys():
        value = properties_dict[key]
        if value is not None:
            new_dict[key] = value
    return new_dict
1371312
def clean(self, value):
		

		# If the value is None and it's optional, return as is
		if value is None and self._optional:
			return None

		# If the value is not a dict
		if not isinstance(value, dict):
			raise ValueError('value')

		# Recurse and return it
		return {str(self._key.clean(k)):self._node.clean(v) for k,v in iteritems(value)}
7582
def empty_tree(input_list):
    """"""
    for item in input_list:
        if not isinstance(item, list) or not empty_tree(item):
            return False
    return True
608950
def _remove_none(data):
    
    if isinstance(data, list) or isinstance(data, tuple):
        return [x for x in data if x is not None]

    out = OrderedDict()
    for key, val in data.iteritems():
        if val is not None:
            out[key] = val

    return out
1160446
def preprocess_value(self, value, default=tuple()):
        
        # empty value
        if not value:
            return default

        # list with one empty item
        if isinstance(value, (list, tuple)):
            if len(value) == 1 and not value[0]:
                return default

        if not isinstance(value, (list, tuple)):
            value = value,

        return value