def get_controller_args_for_types(func, arg_types, args, kwargs):
 result_args = []
 result_kwargs = {}
 argspec = inspect.getargspec(func)
 names = argspec.args[1:]
 for (index, name) in enumerate(names):
  if (name in kwargs):
   try:
    value = kwargs[name]
    value_type = arg_types[index]
    value = cast_argument_value(value_type=value_type, value=value)
    result_kwargs[name] = value
   except IndexError:
    LOG.warning("Type definition for '%s' argument of '%s' is missing.", name, func.__name__)
   continue
  try:
   value = args.pop(0)
   value_type = arg_types[index]
   value = cast_argument_value(value_type=value_type, value=value)
   result_args.append(value)
  except IndexError:
   LOG.warning("Type definition for '%s' argument of '%s' is missing.", name, func.__name__)
 return (result_args, result_kwargs)

def get_controller_args_for_types ( func , arg_types , args , kwargs ) : result_args = [ ] result_kwargs = { } argspec = inspect . getargspec ( func ) names = argspec . args [ 1 : ] for ( index , name ) in enumerate ( names ) : if ( name in kwargs ) : try : value = kwargs [ name ] value_type = arg_types [ index ] value = cast_argument_value ( value_type = value_type , value = value ) result_kwargs [ name ] = value except IndexError : LOG . warning ( "Type definition for '%s' argument of '%s' is missing." , name , func . __name__ ) continue try : value = args . pop ( 0 ) value_type = arg_types [ index ] value = cast_argument_value ( value_type = value_type , value = value ) result_args . append ( value ) except IndexError : LOG . warning ( "Type definition for '%s' argument of '%s' is missing." , name , func . __name__ ) return ( result_args , result_kwargs )
build a list of arguments and dictionary of keyword arguments which are passed to the controller method based on the arg_types specification .