This function handles and validates the wrapper arguments.
557352
def get_arguments(options):
   
   # These the next couple of lines defines the header of the Help output
   parser = ArgumentParser(
      formatter_class=RawDescriptionHelpFormatter,
      usage=("""%(prog)s
--------------------------------------------------------------------------------
"""),
      description=("""
Service Wrapper
===============
This is the service wrapper script, which is a part of the CGE services.
Read the online manual for help.
A list of all published services can be found at:
cge.cbs.dtu.dk/services

"""), epilog=("""
--------------------------------------------------------------------------------
      """))

   #ADDING ARGUMENTS
   setarg = parser.add_argument
   #SERVICE SPECIFIC ARGUMENTS
   if isinstance(options, str):
      options = [[x for i,x in enumerate(line.split()) if i in [1,2]] for line in options.split('\n') if len(line)>0]
      for o in options:
         try:
            setarg(o[1], type=str, dest=o[0], default=None, help=SUPPRESS)
         except:
            None
   else:
      for o in options:
         if o[2] is True:
            # Handle negative flags
            setarg(o[0], action="store_false", dest=o[1], default=o[2],
                   help=o[3])
         elif o[2] is False:
            # Handle positive flags
            setarg(o[0], action="store_true", dest=o[1], default=o[2],
                   help=o[3])
         else:
            help_ = o[3] if o[2] is None else "%s [%s]"%(o[3], '%(default)s')
            setarg(o[0], type=str, dest=o[1], default=o[2],
                   help=help_)
   # VALIDATION OF ARGUMENTS
   args = parser.parse_args()
   debug.log("ARGS: %s"%args)
   return args
688489
def CheckInputArgs(*interfaces):
    
    l = len(interfaces)
    def wrapper(func):
        def check_args(self, *args, **kw):
            for i in range(len(args)):
                if (l > i and interfaces[i].providedBy(args[i])) or interfaces[-1].providedBy(args[i]):
                    continue
                if l > i: raise TypeError, 'arg %s does not implement %s' %(args[i], interfaces[i])
                raise TypeError, 'arg %s does not implement %s' %(args[i], interfaces[-1])
            func(self, *args, **kw)
        return check_args
    return wrapper
832067
function validateRunnerArgs(Ctor, config, argv, cb) {
  if (typeof cb !== 'function') {
    throw new Error('expected a callback function');
  }
  if (argv == null || typeof argv !== 'object') {
    return new Error('expected the third argument to be an options object');
  }

  if (config == null || typeof config !== 'object') {
    return new Error('expected the second argument to be a liftoff config object');
  }

  if (typeof Ctor !== 'function' || typeof Ctor.namespace !== 'function') {
    return new Error('expected the first argument to be a Base constructor');
  }
}
270774
def validate(**vkargs):
    
    def decorator(func):
        def wrapper(**kargs):
            for key, value in six.iteritems(vkargs):
                if key not in kargs:
                    abort(403, 'Missing parameter: %s' % key)
                try:
                    kargs[key] = value(kargs[key])
                except ValueError:
                    abort(403, 'Wrong parameter format for: %s' % key)
            return func(**kargs)
        return wrapper
    return decorator
401012
def validate_key(func):
    

    @wraps(func)
    def wrapper(self, key, *args, **kwargs):
        if posixpath.sep in key:
            raise ValueError('Keys cannot contains slashes')

        return func(self, key, *args, **kwargs)

    return wrapper
1230451
function CallbackHandler(callable) {
    CallbackHandler.super_.call(this);

    if (!_.isFunction(callable)) {
        throw new TypeError(
            'Argument  must be valid callable'
        );
    }

    this.__callable = callable;
}
621034
def validate_parameters(self):
        """"""
        for p in self.params:
            if p not in self.known_params:
                raise errors.UnknownParameter(p, self.known_params)
321861
def validate_args(self):
        
        from ..mixins import ModelMixin

        for arg in ("instance", "decider", "identifier", "fields", "default_language"):
            if getattr(self, arg) is None:
                raise AttributeError("%s must not be None" % arg)

        if not isinstance(self.instance, (ModelMixin,)):
            raise ImproperlyConfigured('"instance" argument must be a Linguist model')

        if not issubclass(self.decider, (models.Model,)):
            raise ImproperlyConfigured(
                '"decider" argument must be a valid Django model'
            )
910988
def validate(self, value=_undefined, name=None):
        
        if self.optional:
            if value is _undefined or value is None:
                if self.default is None:
                    return None
                elif util.is_function(self.default):
                    value = self.default()
                else:
                    value = self.default
        elif value is _undefined:
            if name is not None:
                name_msg = "argument `{}`".format(name)
            else:
                name_msg = "unnamed argument"
            raise TypeError("Missing required value for {}".format(name_msg))

        return self.validator(value)
1275023
def _wrap(method: Callable, wrapper: Callable) -> Callable:
        
        def wrapped(*args, **kwargs):
            return wrapper(method, *args, **kwargs)
        return wrapped
390244
def validate_wrap(self, value):
        '''  '''
        self.item_type.validate_wrap(value)

        if value not in self.values:
            self._fail_validation(value, 'Value was not in the enum values')
1210353
def safe_wraps(wrapper, *args, **kwargs):
    """"""
    while isinstance(wrapper, functools.partial):
        wrapper = wrapper.func
    return functools.wraps(wrapper, *args, **kwargs)
36318
def validate(**vkargs):
    
    depr('Use route wildcard filters instead.')
    def decorator(func):
        @functools.wraps(func)
        def wrapper(*args, **kargs):
            for key, value in vkargs.items():
                if key not in kargs:
                    abort(403, 'Missing parameter: %s' % key)
                try:
                    kargs[key] = value(kargs[key])
                except ValueError:
                    abort(403, 'Wrong parameter format for: %s' % key)
            return func(*args, **kargs)
        return wrapper
    return decorator
1204357
def handle_valid(self, form=None, *args, **kwargs):
        
        # Take a chance and try save a subclass of a ModelForm.
        if hasattr(form, 'save'):
            form.save()
        # Also try and call handle_valid method of the form itself.
        if hasattr(form, 'handle_valid'):
            form.handle_valid(*args, **kwargs)
587075
private function handleUndefinedParameters()
    {
        $leftover = count($this->rawParams);

        if (0 < $leftover) {
            if (1 == $leftover) {
                $msg = 'The parameter \'%s\' is not valid';
            } else {
                $msg = 'The parameters \'%s\' are not valid';
            }

            throw new \Exception(sprintf($msg, implode('\', \'', array_keys($this->rawParams))));
        }
    }
606480
def allow_create(function):
    
    @wraps(function)
    def _wrapped_func(*args, **kwargs):
        form = args[0]
        # If this argument is not a form, there are a lot of chances that
        # you didn't decorate the right method.
        # This decorator is only to be used decorating "form_valid()"
        if isinstance(form, (Form, ModelForm)):
            # If the form is not valid, don't try to create new values
            if not form.is_valid():
                return function(*args, **kwargs)

            for k, field in form.fields.items():
                if getattr(field, 'create', False) \
                        and getattr(field, '_new_values', None):
                    new_values = field.create_new_values()
                    # update the field value
                    form.cleaned_data[k] = form.cleaned_data[k] | new_values

        return function(*args, **kwargs)
    return _wrapped_func
807100
protected void validate() {
        Assert.checkNotNullParam("endpoint", endpoint);
        Assert.checkNotNullParam("optionMap", optionMap);
        Assert.checkNotNullParam("uri", uri);
    }