Cleans a value, using either the user provided clean_value, or cls.reduce_value.
176086
def clean_value(self, value):
    """"""
    if self._clean_value:
      return self._clean_value(value)
    else:
      return self.reduce_value(value)
634979
def clean(some_string, uppercase=False):
    
    if uppercase:
        return some_string.strip().upper()
    else:
        return some_string.strip().lower()
189638
def clean_value(self, val):
        
        if isinstance(val, dict):
            if self.random_name:
                val['random_name'] = self.random_name
            if 'file_name' in val.keys():
                val['name'] = val.pop('file_name')
                val['content'] = val.pop('file_content')
            return self.file_manager().store_file(**val)

        # If val is not instance of dict, it should be return itself because the val is the key of
        # the file
        try:
            return str(val)
        except ValueError:
            raise ValidationError("%r could not be cast to string" % val)
1366440
def clean(self, value):
        
        value = super().clean(value)
        if value in (None, ''):
            value = ''
        value = smart_text(value)
        if value == '':
            return value
        valid_values = []
        for group_label, group in self.choices:
            valid_values += [str(k) for k, v in group]
        if value not in valid_values:
            raise ValidationError(gettext('Select a valid choice. That choice is not one of the available choices.'))
        return value
458421
def clean(self, value):
        """"""

        if isinstance(value, numbers.Number):
            return value
        elif isinstance(value, six.string_types):
            try:
                value = float(value)
                return int(value) if value.is_integer() else value
            except ValueError:
                raise ParameterNotValidError

        raise ParameterNotValidError
336249
private Object filterValue(Object value)
   {
      if (value instanceof Boolean && !((Boolean) value).booleanValue())
      {
         value = null;
      }
      if (value instanceof String && ((String) value).isEmpty())
      {
         value = null;
      }
      if (value instanceof Double && ((Double) value).doubleValue() == 0.0)
      {
         value = null;
      }
      if (value instanceof Integer && ((Integer) value).intValue() == 0)
      {
         value = null;
      }
      if (value instanceof Duration && ((Duration) value).getDuration() == 0.0)
      {
         value = null;
      }

      return value;
   }
1124722
def clean(self, py_value):
        
        try:
            import bleach
            return bleach.clean(py_value, **self.__bleachOptions)
        except ImportError:
            warnings.warn('Unable to clean string column without webhelpers installed.')
            return py_value
1176960
def clean(mapping, bind, values):
    
    categories = {'C': ' '}
    for value in values:
        if isinstance(value, six.string_types):
            value = normality.normalize(value, lowercase=False, collapse=True,
                                        decompose=False,
                                        replace_categories=categories)
        yield value
440186
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 list
		if not isinstance(value, list):
			raise ValueError('value')

		# Recurse and return it
		return [self._node.clean(m) for m in value]
398643
def clean(self, value):
        """"""

        if isinstance(value, six.string_types):
            return value
        elif isinstance(value, numbers.Number):
            return str(value)

        raise ParameterNotValidError
345790
def _recursive_cleanup(foo):
    
    if isinstance(foo, dict):
        for (key, val) in list(foo.items()):
            if isinstance(val, dict):
                _recursive_cleanup(val)
            if val == "" or val == [] or val == {}:
                del foo[key]
111084
def clean(self, value):
        

        obj = self.factory.create(value)

        # todo: what if the field defines properties that have any of
        # these names:
        if obj:
            del obj.fields
            del obj.alias
            del obj.validators
            del obj.required
            del obj.factory

        # do own cleaning first...
        self._validate_existence(obj)
        self._run_validators(obj)

        # ret = {}
        # for name in self.fields.keys():
        #     ret[name] = getattr(obj, name)
        # return ret
        return obj
125431
function(to_clean) {
    _.map(to_clean, function(value, key, to_clean) {
      if (value === undefined) {
        delete to_clean[key];
      }
    });
    return to_clean;
  }
1126834
def clean(self, value):
        
        if not self.create:
            # No new value can be created, use the regular clean field
            return super(AgnocompleteModelMultipleField, self).clean(value)

        # We have to do this here before the call to "super".
        # It'll be called again, but we can't find a way to "pre_clean" the
        # field value before pushing it into the parent class "clean()" method.
        value = self.clear_list_value(value)
        # Split the actual values with the potential new values
        # Numeric values will always be considered as PKs
        pks = [v for v in value if v.isdigit()]
        self._new_values = [v for v in value if not v.isdigit()]

        qs = super(AgnocompleteModelMultipleField, self).clean(pks)

        return qs
483174
def _clean(self, value):
		""""""
		
		value = (str(v) for v in value)
		
		if self.strip:
			value = (v.strip() for v in value)
		
		if not self.empty:
			value = (v for v in value if v)
		
		return value
132215
function _cleanResults (results, stringify) {
  var clean = _.map(results, function (res) {
    return _.reduce(res, _cleanObject, {});
  });
  if (stringify) return JSON.stringify(clean, '', '  ');
  return clean;
}
1183616
private void clean(Instances cleanAgainst, Instances toClean, boolean onlyLast) {
		if (cleanAgainst.numInstances() > this.kOption.getValue() && toClean.numInstances() > 0){
			if (onlyLast){
				cleanSingle(cleanAgainst, (cleanAgainst.numInstances()-1), toClean);
			}else{
				for (int i=0; i < cleanAgainst.numInstances(); i++){
					cleanSingle(cleanAgainst, i, toClean);
				}
			}
		}
	}