Cleans the value before storing it.

        :param:     py_value : <str>

        :return:    <str>
350640
def clean(self, py_value):
        
        try:
            from webhelpers.text import strip_tags
            return strip_tags(py_value)
        except ImportError:
            warnings.warn('Unable to clean string column without webhelpers installed.')
            return py_value
504736
def clean_value(self):
        
        result = []
        for mdl in self:
            result.append(super(ListNode, mdl).clean_value())
        return result
100492
def clean(self, value):
        """"""

        if isinstance(value, six.string_types) and value.lower() == 'false':
            return False

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

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

        raise ParameterNotValidError
407097
def ver(self, value):
        
        if value == self._defaults['ver'] and 'ver' in self._values:
            del self._values['ver']
        else:
            self._values['ver'] = value
540024
def clean_new(self, value):
        """"""
        value = self.schema_class(value).full_clean()
        return self.object_class(**value)
1267470
def clean(self):
        
        if self.user:
            self.username = self.user.username
        elif not self.username:
            raise ValidationError({
                'username': _NOT_BLANK_MESSAGE,
                'user': _NOT_BLANK_MESSAGE
            })
1105463
def clean(self, data):
        
        try:
            value = data[self.column_name]
        except KeyError:
            raise KeyError("Column '%s' not found in dataset. Available "
                           "columns are: %s" % (self.column_name, list(data)))

        # If ValueError is raised here, import_obj() will handle it
        value = self.widget.clean(value, row=data)

        if value in self.empty_values and self.default != NOT_PROVIDED:
            if callable(self.default):
                return self.default()
            return self.default

        return value
233328
def reduce_value(cls, value):
    
    if isinstance(value, str):
      return to_compressed_string(value)
    elif isinstance(value, bool):
      return value
    elif isinstance(value, Number):
      return reduce_number(value)
    else:
      return value
189593
def strip_filter(value):
    '''
    

    '''
    if isinstance(value, basestring):
        value = bleach.clean(value, tags=ALLOWED_TAGS,
                             attributes=ALLOWED_ATTRIBUTES, 
                             styles=ALLOWED_STYLES, strip=True)
    return value
507818
def clean(self, value):
        
        value = super(ListField, self).clean(value)
        if value is not None:
            return map(self.itemspec.clean, 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]
13466
def _trim_value(self, value):
        

        if value[0] == '"':
            assert value[-1] == '"'
            value = value[1:-1].replace('\\"', '"').replace("\\\\", "\\")
            return Parser._unescape_re.sub(Parser._unescape_fn, value)
        return value
1048839
def clean(self, value):
        """"""

        if not isinstance(value, (list, tuple, set, GeneratorType)):
            value = [value]

        gen = (self.param_type.clean(x) for x in value)

        if isinstance(value, GeneratorType):
            return gen
        else:
            return list(gen)
46026
def _clean(value):
    
    if isinstance(value, np.ndarray):
        if value.dtype.kind == 'S':
            return np.char.decode(value).tolist()
        else:
            return value.tolist()
    elif type(value).__module__ == np.__name__:
        # h5py==2.8.0 on windows sometimes fails to cast this from an np.float64 to a python.float
        # We have explicitly cast in Albacore (merge 488) to avoid this bug, since casting here could be dangerous
        # https://github.com/h5py/h5py/issues/1051
        conversion = np.asscalar(value)
        if sys.version_info.major == 3 and isinstance(conversion, bytes):
            conversion = conversion.decode()
        return conversion
    elif sys.version_info.major == 3 and isinstance(value, bytes):
        return value.decode()
    else:
        return value
140285
def clean(self, value, model_instance):
        
        #: return constant's name instead of constant itself
        value = self.to_python(value).name
        self.validate(value, model_instance)
        self.run_validators(value)
        return value
559677
def get_prep_value(self, value):
        
        if isinstance(value, six.string_types):
            return value
        else:
            return ', '.join(map(lambda s: s.strip(), value))