Call ConfigParser to validate config

        Args:
            kwargs: are passed to :class:`configparser.ConfigParser`
978459
def validate_format(self, **kwargs):
        
        args = dict(
            dict_type=self._dict,
            allow_no_value=self._allow_no_value,
            inline_comment_prefixes=self._inline_comment_prefixes,
            strict=self._strict,
            empty_lines_in_values=self._empty_lines_in_values
        )
        args.update(kwargs)
        parser = ConfigParser(**args)
        updated_cfg = str(self)
        parser.read_string(updated_cfg)
222126
def _validate_config(config):
    
    required_keys = [KEY_ADDRESS, KEY_MODEL, KEY_PORT, KEY_PATHS]
    for key in required_keys:
        if key not in config:
            raise Error("Required key %s missing from config %s",
                        (key, config))
833839
def _setup_config_from_kwargs(kwargs):
        """"""
        cmd_list = ['--json', '--force']

        if 'file' in kwargs:
            cmd_list.extend(['--file', kwargs['file']])

        if 'system' in kwargs:
            cmd_list.append('--system')

        return cmd_list
774473
def use_kwargs(self, *args, **kwargs) -> typing.Callable:
        
        return super().use_kwargs(*args, **kwargs)
444005
def _set(self, **kwargs):
        
        for param, value in kwargs.items():
            p = getattr(self, param)
            if value is not None:
                try:
                    value = p.typeConverter(value)
                except TypeError as e:
                    raise TypeError('Invalid param value given for param "%s". %s' % (p.name, e))
            self._paramMap[p] = value
        return self
393879
def load_config_from_cli_arguments(self, *args, **kwargs):
        
        self._load_config_from_cli_argument(key='handlers_package', **kwargs)
        self._load_config_from_cli_argument(key='auth', **kwargs)
        self._load_config_from_cli_argument(key='user_stream', **kwargs)
        self._load_config_from_cli_argument(key='min_seconds_between_errors', **kwargs)
        self._load_config_from_cli_argument(key='sleep_seconds_on_consecutive_errors', **kwargs)
591004
def validate(self, config):
        
        if not isinstance(config, ConfigObject):
            raise Exception("Config object expected")

        if config["output"]["componants"] not in ("local", "remote", "embedded", "without"):
            raise ValueError("Unknown componant \"%s\"." % config["output"]["componants"])

        if config["output"]["layout"] not in ("default", "content-only"):
            raise ValueError("Unknown layout \"%s\"." % config["output"]["layout"])

        if config["input"]["locations"] is not None:
            unknown_locations = [x for x in config["input"]["locations"] if not os.path.exists(x)]
            if len(unknown_locations) > 0:
                raise ValueError(
                    "Location%s \"%s\" does not exists"
                    % ("s" if len(unknown_locations) > 1 else "", ("\" and \"").join(unknown_locations))
                )

            config["input"]["locations"] = [os.path.realpath(x) for x in config["input"]["locations"]]

        if config["input"]["arguments"] is not None:
            if not isinstance(config["input"]["arguments"], dict):
                raise ValueError(
                    "Sources arguments \"%s\" are not a dict" % config["input"]["arguments"]
                )
1141458
def parsing(**kwargs):
    

    from .validators import Object
    with _VALIDATOR_FACTORIES_LOCK:
        old_values = {}
        for key, value in iteritems(kwargs):
            if value is not None:
                attr = key.upper()
                old_values[key] = getattr(Object, attr)
                setattr(Object, attr, value)
        try:
            yield
        finally:
            for key, value in iteritems(kwargs):
                if value is not None:
                    setattr(Object, key.upper(), old_values[key])
696617
def set_args(self, **kwargs):
        
        try:
            kwargs_items = kwargs.iteritems()
        except AttributeError:
            kwargs_items = kwargs.items()
        for key, val in kwargs_items:
            self.args[key] = val
110864
def validate(self, **kwargs):
        
        self.check_crossrefs()
        for value in self.values():
            value.validate(**kwargs)
1033914
def check_arguments(self, **kwargs):
        
        for key in kwargs:
            if key in self._rules:
                for val in kwargs[key]:
                    self._rules[key](val)
            else:
                raise LookupError("Rule for {} does not exist. Make sure the rule starts with 'rule_'".format(key))
1223435
def _check_for_invalid_keys(fname, kwargs, compat_args):
    
    # set(dict) --> set of the dictionary's keys
    diff = set(kwargs) - set(compat_args)

    if diff:
        bad_arg = list(diff)[0]
        raise TypeError(("{fname}() got an unexpected "
                         "keyword argument '{arg}'".
                         format(fname=fname, arg=bad_arg)))
262121
def kwargs_to_spec(self, **kwargs):
        

        spec = self.create_spec(**kwargs)
        self.prepare_spec(spec, **kwargs)
        return spec
753925
def _assign_kwargs(self, kwargs):
    
    for k in kwargs:
        if not hasattr(self, k):
            raise AttributeError(k, 'Not valid for', self.__class__.__name__)
        setattr(self, k, kwargs[k])
855536
def valid_options(kwargs, allowed_options):
    

    diff = set(kwargs) - set(allowed_options)
    if diff:
        print("Invalid option(s): ", ', '.join(diff))
        return False
    return True
762064
def _validate(self):
        
        errors = []
        for k in self._defaults.keys():
            try:
                validator = self._defaults[k]['validator']
                if validator is not None:
                    self[k] = validator(self[k])
            except ValueError as e:
                errors.append('\t{}: {}'.format(k, six.text_type(e)))

        if errors:
            raise ValueError(
                'Invalid configuration values were set: \n{}'.format('\n'.join(errors)))
1120332
def override_args(**kwargs):
  

  override_kwargs = kwargs

  def custom_getter(getter, *args, **kwargs):
    """Custom getter with certain named arguments overridden.

    Args:
      getter: Underlying variable getter to invoke.
      *args: Arguments, compatible with those of tf.get_variable.
      **kwargs: Keyword arguments, compatible with those of tf.get_variable.

    Returns:
      The result of invoking `getter(*args, **kwargs)` except that certain
      kwargs entries may have been overridden.
    """
    kwargs.update(override_kwargs)
    return getter(*args, **kwargs)

  return custom_getter