Override to remove key from raw data when empty to work with server 2.16+ validation
969036
def set_python(self, value):
        """"""
        if self.multiselect:
            value = value or []
            elements = []

            for element in value:
                self.validate_value(element)
                elements.append(element)

            value = elements
        else:
            self.validate_value(value)

        self._set(value)
57010
function validateData(data, schema, fn) {
        debug('Schema:', schema);
        debug('Data:', data);

        if (!tv4.validate(data, schema)) {
            return fn(tv4.error);
        }

        return fn(null, true);
    }
483801
def _strip_empty_keys(self, params):
        
        keys = [k for k, v in params.items() if v == '']
        for key in keys:
            del params[key]
129109
function trimNbspAfterDeleteAndPaddValue() {
        var rng, container, offset;

        rng = selection.getRng(true);
        container = rng.startContainer;
        offset = rng.startOffset;

        if (container.nodeType == 3 && rng.collapsed) {
          if (container.data[offset] === '\u00a0') {
            container.deleteData(offset, 1);

            if (!/[\u00a0| ]$/.test(value)) {
              value += ' ';
            }
          } else if (container.data[offset - 1] === '\u00a0') {
            container.deleteData(offset - 1, 1);

            if (!/[\u00a0| ]$/.test(value)) {
              value = ' ' + value;
            }
          }
        }
      }
1209815
def to_internal_value(self, data):
        
        if html.is_html_input(data):
            data = html.parse_html_list(data)

        if not isinstance(data, list):
            message = self.error_messages['not_a_list'].format(
                input_type=type(data).__name__
            )
            raise ValidationError({
                api_settings.NON_FIELD_ERRORS_KEY: [message]
            })

        if not self.allow_empty and len(data) == 0:
            message = self.error_messages['empty']
            raise ValidationError({
                api_settings.NON_FIELD_ERRORS_KEY: [message]
            })

        ret = []
        errors = []

        for item in data:
            try:
                validated = self.child.run_validation(item)
            except ValidationError as exc:
                errors.append(exc.detail)
            else:
                ret.append(validated)
                errors.append({})

        if any(errors):
            raise ValidationError(errors)

        return ret
1284634
function cleanKey(key, dtype) {
  return (
    key === null ? ESCAPED_KEYS.null :
    isUndefined(key) ? ESCAPED_KEYS.undefined :
    dtype === 'date' ? key.valueOf() :
    key
  );
}
652384
def clean(self):
        
        errors = {}
        cleaned = {}

        for name, validator in self.validate_schema.items():
            val = getattr(self, name, None)
            try:
                cleaned[name] = validator.to_python(val)
            except formencode.api.Invalid, err:
                errors[name] = err

        if errors:
            raise ValidationError('Invalid data', errors)
        return cleaned
516233
function cleanData(originalData) {
            return originalData.reduce((acc, d) => {
                d.value = +d[valueLabel];
                d.key = String(d[nameLabel]);

                return [...acc, d];
            }, []);
        }
278797
function checkUnknown(json, schemaKeys) {
    var jsonKeys = [];
    for (var k in json) {
      if (schemaKeys.indexOf(k) === -1) {
        throw new ValidationException(
          "The key: " +
            k +
            " is not declared in the schema. Declare it or allow unknown keys."
        );
      }
    }
  }
964887
def _validate(self, validator, data, key, position=None, includes=None):
        
        errors = []

        if position:
            position = '%s.%s' % (position, key)
        else:
            position = key

        try:  # Pull value out of data. Data can be a map or a list/sequence
            data_item = util.get_value(data, key)
        except KeyError:  # Oops, that field didn't exist.
            if validator.is_optional:  # Optional? Who cares.
                return errors
            # SHUT DOWN EVERTYHING
            errors.append('%s: Required field missing' % position)
            return errors

        return self._validate_item(validator, data_item, position, includes)
262853
def validate(cls, keystr):
        
        if "#{" in keystr:
            # it's a template with keys vars
            keys = cls.from_template(keystr)
            for k in keys:
                cls.validate_one(cls.extract(k))
        else:
            # plain keys str
            cls.validate_one(keystr)
932308
def invalidate_api_key(self, body, params=None):
        
        if body in SKIP_IN_PATH:
            raise ValueError("Empty value passed for a required argument 'body'.")
        return self.transport.perform_request(
            "DELETE", "/_security/api_key", params=params, body=body
        )
1214266
def validate(key):
    
    if not isinstance(key, (str, bytes)):
        raise KeyError('Key must be of type str or bytes, found type {}'.format(type(key)))
235381
def get_no_validate(self, key):
    """"""
    x, env = self.get_thunk_env(key)

    # Check if this is a Thunk that needs to be lazily evaluated before we
    # return it.
    if isinstance(x, framework.Thunk):
      x = framework.eval(x, env)

    return x
177328
function lomValidData(lomp, data)
{
	var k, i;

	mod_assert.ok(data.hasOwnProperty('results'));
	mod_assert.ok(Array.isArray(data.results));
	mod_assert.bool(data.done);

	if (data.done === false)
		mod_assert.ok(data.results.length > 0 ||
		    lomp.lom_pushed > 0);

	for (k in data) {
		if (!data.hasOwnProperty(k))
			continue;
		for (i = 0; i < LOM_RES_KEYS.length; i++) {
			if (LOM_RES_KEYS[i] === k)
				break;
		}

		mod_assert.ok(i < LOM_RES_KEYS.length,
		    sprintf('unknown result key: %s', k));
	}
}
77093
def clean_key_name(self):
        """"""
        key = self.cleaned_data['key_name']
        # Ensure key starts with prefix
        if not key.startswith(self.get_key_prefix()):
            raise forms.ValidationError('Key does not have required prefix.')
        # Ensure key exists
        if not self.get_upload_key():
            raise forms.ValidationError('Key does not exist.')
        return key
199529
def remove(self, key):
        '''
        
        '''
        encodedKey = json.dumps(key)
        sql = 'DELETE FROM ' + self.table + ' WHERE name = %s'
        with self.connect() as conn:
            with doTransaction(conn):
                return executeSQL(conn, sql, args=[encodedKey])