The full_clean method is hijacked to apply special treatment to invalid
        field inputs. For example adding extra options/classes to widgets.
541483
def full_clean(self, *args, **kwargs):
        
        super().full_clean(*args, **kwargs)
        for field in self.errors:
            if field != NON_FIELD_ERRORS:
                self.apply_widget_invalid_options(field)
152615
function clean(method) {
  for (let m of methods) {
    if (new RegExp(m, 'i').test(method)) {
      return m;
    }
  }

  throw new Error(`Invalid method name: ${method}`);
}
941200
public static function clean_input()
	{
		$_GET		= static::clean($_GET);
		$_POST		= static::clean($_POST);
		$_COOKIE	= static::clean($_COOKIE);
	}
389994
def _SanitizeField(self, field):
    
    if self._field_delimiter and isinstance(field, py2to3.STRING_TYPES):
      return field.replace(self._field_delimiter, ' ')
    return field
910546
def clean_value(self):
        '''
        
        '''
        # XXX cached_property is used only for set initial state
        #     this property should be set every time field data
        #     has been changed, for instance, in accept method
        python_data = self.parent.python_data
        if self.name in python_data:
            return python_data[self.name]
        return self.get_initial()
647366
def mongoengine_validate_wrapper(old_clean, new_clean):
    

    def inner_validate(value):
        value = old_clean(value)
        try:
            new_clean(value)
            return value
        except ValidationError, e:
            raise forms.ValidationError(e)
    return inner_validate
827066
def pre_save_full_clean_handler(sender, instance, *args, **kwargs):
    
    from django.contrib.sessions.models import Session
    if sender != Session:
        instance.full_clean()
911963
function _removeInvalidFields(newModel) {
  if (!ExplorerUtils.isEmailExtraction(newModel)) {
    newModel.query.latest = null;
    newModel.query.email = null;
  }
  if (newModel.query.analysis_type === 'extraction') {
    newModel.query.group_by = null;
    newModel.query.order_by = null;
    newModel.query.limit = null;
    newModel.query.interval = null;
  }
  if (newModel.query.analysis_type !== 'extraction') {
    newModel.query.latest = null;
  }
  if (newModel.query.analysis_type !== 'percentile') {
    newModel.query.percentile = null;
  }
  if (_.includes(['count', 'extraction', 'funnel'], newModel.query.analysis_type)) {
    newModel.query.target_property = null;
  }
  if (newModel.query.analysis_type !== 'funnel') {
    newModel.query.steps = [];
  }
  if(newModel.query.analysis_type === 'funnel') {
    newModel.query.filters = [];
    newModel.query.time = null;
    newModel.query.timezone = null;
    newModel.query.group_by = null;
    newModel.query.order_by = null;
    newModel.query.limit = null;
    newModel.query.timeframe = null;
    newModel.query.interval = null;
  }
  return newModel;
}
450325
def _clean(cls, value, invalid):
        """"""
        cls._deprecation_warning()
        return BlockUsageLocator._clean(value, invalid)
836951
function removeInvalidNodeErrorsInTemplateLiteral(node) {
            if (typeof node.value.raw === "string") {
                if (ALL_IRREGULARS.test(node.value.raw)) {
                    removeWhitespaceError(node);
                }
            }
        }
507818
def clean(self, value):
        
        value = super(ListField, self).clean(value)
        if value is not None:
            return map(self.itemspec.clean, value)
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
1049688
function(fields, template_name) {
    var fields_sanitized = [];
    if (fields && fields.length > 0) {
      var self = this;
      fields_sanitized = _.map(fields, function(field,i) {
        // Return whole attribute sanitized
        return self._sanitizeField(field, template_name, field.index || i);
      });
    }
    return fields_sanitized;
  }
492079
def clean(self):
        
        for prop in ('imported_from', 'use', 'plus', 'templates', 'register'):
            try:
                delattr(self, prop)
            except AttributeError:
                pass
        for prop in ('configuration_warnings', 'configuration_errors'):
            try:
                if getattr(self, prop, None) is not None and not getattr(self, prop):
                    delattr(self, prop)
            except AttributeError:
                pass
300471
def sanitize_html(value, valid_tags=VALID_TAGS, strip=True):
    
    return bleach.clean(value, tags=list(VALID_TAGS.keys()), attributes=VALID_TAGS, strip=strip)
71343
public function cleanString()
		{
			//get rid of newline holders in values
			$this->processString = str_replace('\\\\\\\\n', ' ', $this->processString);

			//replace newline holders with newline
			$this->processString = str_replace('\n', "\n", $this->processString);

			//match returns extra curly bracket at EOL, get rid of it
			$this->processString = substr($this->processString, 0, -1);

			//convert unicode encoded characters to html entities hex
			$this->processString = preg_replace('/\\\\u([0-9a-fA-F]{4})/', '&#x$1;', $this->processString);

			//get rid of escapes added for javascript
			$this->processString = stripslashes($this->processString);
		}
381148
def full_clean(self, *args, **kwargs):
        
        name = getattr(self, 'name', self.slugName.title())
        self.title = "{} for {}".format(name, dateFormat(self.except_date))
        self.slug = "{}-{}".format(self.except_date, self.slugName)
        super().full_clean(*args, **kwargs)