Validate extra context.
971972
def validate_extra_context(ctx, param, value):
    """"""
    for s in value:
        if '=' not in s:
            raise click.BadParameter(
                'EXTRA_CONTEXT should contain items of the form key=value; '
                "'{}' doesn't match that form".format(s)
            )

    # Convert tuple -- e.g.: (u'program_name=foobar', u'startsecs=66')
    # to dict -- e.g.: {'program_name': 'foobar', 'startsecs': '66'}
    return collections.OrderedDict(s.split('=', 1) for s in value) or None
1152868
def _validate(self, inst: "InstanceNode", scope: ValidationScope,
                  ctype: ContentType) -> None:
        """"""
        if (scope.value & ValidationScope.syntax.value and
                inst.value not in self.type):
            raise YangTypeError(inst.json_pointer(), self.type.error_tag,
                                self.type.error_message)
        if (isinstance(self.type, LinkType) and        # referential integrity
                scope.value & ValidationScope.semantics.value and
                self.type.require_instance):
            try:
                tgt = inst._deref()
            except YangsonException:
                tgt = []
            if not tgt:
                raise SemanticError(inst.json_pointer(), "instance-required")
        super()._validate(inst, scope, ctype)
366950
def check_extras(dist, attr, value):
    """"""
    try:
        list(itertools.starmap(_check_extra, value.items()))
    except (TypeError, ValueError, AttributeError):
        raise DistutilsSetupError(
            "'extras_require' must be a dictionary whose values are "
            "strings or lists of strings containing valid project/version "
            "requirement specifiers."
        )
381067
def validate(self, settings):
        """"""

        if self.envs is None:
            self.envs = [settings.current_env]

        if self.when is not None:
            try:
                # inherit env if not defined
                if self.when.envs is None:
                    self.when.envs = self.envs

                self.when.validate(settings)
            except ValidationError:
                # if when is invalid, return canceling validation flow
                return

        # If only using current_env, skip using_env decoration (reload)
        if (
            len(self.envs) == 1
            and self.envs[0].upper() == settings.current_env.upper()
        ):
            self._validate_items(settings, settings.current_env)
            return

        for env in self.envs:
            with settings.using_env(env):
                self._validate_items(settings, env)
66483
protected function _actionValidate($context)
    {
        $data = $context->data;
        $key = $data->key;
        $value = $data->value;
        $method = 'validate'.ucfirst($key);
        $result = true;
        $result = $this->getValidator()->$method($value);
        $output = $this->getValidator()->getMessage();

        if ($result === false) {
            $context->response->status = AnHttpResponse::PRECONDITION_FAILED;

            if (is_string($output)) {
                $output = array('errorMsg' => $output);
            }

            $context->response->validation = json_encode($output);
        } else {
            $context->response->validation = json_encode($output);
        }
    }
1167212
def _validate_extension(self):
        
        extension = self.fpath.split('.')[-1]
        if extension not in self.supported_extensions:
            raise UnsupportedExtensionError
399195
def validate(self, data, context=None):
        
        try:
            self.load(data, context)
            return None
        except ValidationError as ve:
            return ve.messages
230051
def validate(self):
        """"""
        super(OutputContextVertex, self).validate()

        if self.location.field is not None:
            raise ValueError(u'Expected location at a vertex, but got: {}'.format(self.location))
406354
def _evaluation_context(self, escape, safe_wrapper):
        """"""
        self._escape = escape
        self._safe_wrapper = safe_wrapper

        try:
            yield
        finally:
            self._escape = None
            self._safe_wrapper = None
949405
def validate(self):
        """"""
        missing = []
        for k, v in self._map.items():
            attr = getattr(self, k, False)
            if not attr or attr == CONFIG_PLACEHOLDER:
                missing.append(v)
        if missing:
            return "Missing or invalid config values: {}".format(
                ", ".join(sorted(missing))
            )
1046249
def context_exclude(zap_helper, name, pattern):
    """"""
    console.info('Excluding regex {0} from context with name: {1}'.format(pattern, name))
    with zap_error_handler():
        result = zap_helper.zap.context.exclude_from_context(contextname=name, regex=pattern)

        if result != 'OK':
            raise ZAPError('Excluding regex from context failed: {}'.format(result))
232168
def validate_context(self, context):
        
        return all(
            [
                hasattr(context, attr)
                for attr in [
                    "aws_request_id",
                    "function_name",
                    "function_version",
                    "get_remaining_time_in_millis",
                    "invoked_function_arn",
                    "log_group_name",
                    "log_stream_name",
                    "memory_limit_in_mb",
                ]
            ]
        ) and callable(context.get_remaining_time_in_millis)
900127
protected function validate_data() {
        parent::validate_data();
        // Make sure this class is never used without proper object details.
        if (!$this->contextlevel === CONTEXT_MODULE) {
            throw new \coding_exception('Context level must be CONTEXT_MODULE.');
        }
        if (!isset($this->other['pagetype'])) {
            throw new \coding_exception('The \'pagetype\' value must be set in other.');
        }
    }
423635
def _expect_extra(expected, present, exc_unexpected, exc_missing, exc_args):
    
    if present:
        if not expected:
            raise exc_unexpected(*exc_args)
    elif expected and expected is not Argument.ignore:
        raise exc_missing(*exc_args)
493783
function validate(entityAspect, validator, value, context) {
    var ve = validator.validate(value, context);
    if (ve) {
      entityAspect._addValidationError(ve);
      return false;
    } else {
      var key = ValidationError.getKey(validator, context ? context.propertyName : null);
      entityAspect._removeValidationError(key);
      return true;
    }
  }
154441
def validate(self, instance):
        """"""
        errors = {}
        self._validate_instance(instance, errors)

        if len(errors) > 0:
            raise ValidationException(errors)
1333298
def ensure_context(**vars):
    
    ctx = _context_stack.top
    stacked = False
    if not ctx:
        ctx = Context()
        stacked = True
        _context_stack.push(ctx)
    ctx.update(vars)
    try:
        yield ctx
    finally:
        if stacked:
            _context_stack.pop()