Get a simplified description of the args_type for a flow.
516929
def _GetArgsDescription(self, args_type):
    """"""
    args = {}
    if args_type:
      for type_descriptor in args_type.type_infos:
        if not type_descriptor.hidden:
          args[type_descriptor.name] = {
              "description": type_descriptor.description,
              "default": type_descriptor.default,
              "type": "",
          }
          if type_descriptor.type:
            args[type_descriptor.name]["type"] = type_descriptor.type.__name__
    return args
225080
def getArguments(parser):
    ""
    args = parser.parse_args()
    if args.width <= 0:
        raise argparse.ArgumentError(args.width, 'The contour width must be a positive number.')
    return args
1155499
def get_args(request_args, allowed_int_args=(), allowed_str_args=(), allowed_bool_args=()):
    """"""
    args = {}

    for allowed_int_arg in allowed_int_args:
        int_value = request_args.get(allowed_int_arg, default=None, type=None)

        if int_value:
            args[allowed_int_arg] = int(int_value)

    for allowed_str_arg in allowed_str_args:
        str_value = request_args.get(allowed_str_arg, default=None, type=None)

        if str_value:
            args[allowed_str_arg] = str_value

    for allowed_bool_arg in allowed_bool_args:
        str_value = request_args.get(allowed_bool_arg, default=None, type=None)

        if str_value == 'true':
            args[allowed_bool_arg] = True

        elif str_value == 'false':
            args[allowed_bool_arg] = False

    return args
510215
def _simplify_arguments(arguments):
    
    if len(arguments.args) == 0:
        return arguments.kwargs
    elif len(arguments.kwargs) == 0:
        return arguments.args
    else:
        return arguments
303888
def arg_type_to_string(arg_type) -> str:
    

    union_params = (
        getattr(arg_type, '__union_params__', None) or
        getattr(arg_type, '__args__', None)
    )

    if union_params and isinstance(union_params, (list, tuple)):
        return ', '.join([arg_type_to_string(item) for item in union_params])

    try:
        return arg_type.__name__
    except AttributeError:
        return '{}'.format(arg_type)
1241819
def make_c_args(arg_pairs):
    
    logging.debug(arg_pairs)
    c_args = [
        '{} {}'.format(arg_type, arg_name) if arg_name else arg_type
        for dummy_number, arg_type, arg_name in sorted(arg_pairs)
    ]
    return ', '.join(c_args)
1186939
def _wrap_type_instantiation(self, type_cls):
        """"""
        def wrapper(*args, **kwargs):
            # use args for struct arguments??
            return type_cls(stream=self._null_stream)
        return wrapper
423737
def __get_type_args(for_type=None, for_types=None):
        
        if for_type:
            if for_types:
                raise ValueError("Cannot pass both for_type and for_types.")
            for_types = (for_type,)
        elif for_types:
            if not isinstance(for_types, tuple):
                raise TypeError("for_types must be passed as a tuple of "
                                "types (classes).")
        else:
            raise ValueError("Must pass either for_type or for_types.")

        return for_types
1355935
def parse_args(argv):
    """"""
    parser = make_parser()

    opts, args = parser.parse_args(argv[1:])

    # Use APPENGINEPY_SDK_VERSION if set.
    if not args and (sdk_version_key in os.environ):
        args = (os.environ[sdk_version_key],)

    return opts, args
379754
def get_args():
    

    prog = "sendIndications"
    usage = '%(prog)s [options] listener-url'
    desc = 'Send indications to a listener. Verify set to False'
    epilog = """
Examples:
  %s https://127.0.0.1 -p 5001
  %s http://localhost:5000
  %s http://[2001:db8::1234-eth0] -(http port 5988 ipv6, zone id eth0)
""" % (prog, prog, prog)

    argparser = _argparse.ArgumentParser(
        prog=prog, usage=usage, description=desc, epilog=epilog,
        add_help=False, formatter_class=_SmartFormatter)

    pos_arggroup = argparser.add_argument_group(
        'Positional arguments')

    pos_arggroup.add_argument(
        'url', metavar='url', nargs='?', default='http://127.0.0.1',
        help='Optional url of listener '
             'If supplied, must be schema+address[:port]. Schema determines ' \
             ' whether http or https are used. Port may be defined in url ' \
             'or with -p option. If not included default port = 5000')

    general_arggroup = argparser.add_argument_group('General options')
    general_arggroup.add_argument(
        '-v', '--verbose', dest='verbose',
        action='store_true', default=False,
        help='Print more messages while processing')

    general_arggroup.add_argument(
        '--listenerPort', '-p', default=None,
        metavar="port",
        type=int,
        help='Integer argument defines listener port.')
    general_arggroup.add_argument(
        '--deliver', '-d', default=1,
        metavar='integer',
        type=int,
        help='Integer argument defines number of indications to send.')

    general_arggroup.add_argument(
        '-h', '--help', action='help',
        help='Show this help message and exit')

    security_arggroup = argparser.add_argument_group(
        'Connection security related options',
        'Specify user name and password or certificates and keys')
    security_arggroup.add_argument(
        '--certfile', '-c', dest='cert_file', metavar='certfile',
        help='R|Client certificate file for authenticating with the\n' \
             'WBEM listener. If option specified the client attempts\n' \
             'to execute server authentication.\n'
             'Default: None so that there is no verification of server cert.')
    security_arggroup.add_argument(
        '--keyfile', '-k', dest='key_file', metavar='keyfile',
        help='R|Client private key file for authenticating with the\n' \
             'WBEM listener. Specify as a single file (containing private ' \
             ' key and certificate or a tuple of key and certificate files')

    args = argparser.parse_args()

    if re.match('^http', args.url) is None:
        print('ERROR: url must include schema. received %s' % args.url)
        sys.exit(1)

    if args.verbose:
        print('args: %s' % args)

    return args, argparser
921327
def detect_output_type(args):
    """"""
    if not args['single'] and not args['multiple']:
        # Save to multiple files if multiple files/URLs entered
        if len(args['query']) > 1 or len(args['out']) > 1:
            args['multiple'] = True
        else:
            args['single'] = True
1353698
def _make_type_comment(args_info, return_type):
    # type: (ArgTypes, InternalType) -> str
    """"""
    if not args_info.pos_args:
        args_string = ''
    else:
        args_string = ', '.join([repr(t) for t in args_info.pos_args])
    if args_info.varargs:
        varargs = '*%s' % repr(args_info.varargs)
        if args_string:
            args_string += ', %s' % varargs
        else:
            args_string = varargs
    return_name = name_from_type(return_type)
    return '(%s) -> %s' % (args_string, return_name)
601459
def link_type(arg_type, arg_name=None, include_bt:bool=True):
    ""
    arg_name = arg_name or fn_name(arg_type)
    if include_bt: arg_name = code_esc(arg_name)
    if belongs_to_module(arg_type, 'torch') and ('Tensor' not in arg_name): return f'[{arg_name}]({get_pytorch_link(arg_type)})'
    if is_fastai_class(arg_type): return f'[{arg_name}]({get_fn_link(arg_type)})'
    return arg_name
925158
def pretty_arg_types(self):
        

        if self.is_method:
            types = self.get_arg_type_descriptors()
            return (_pretty_type(t) for t in types)
        else:
            return tuple()
332430
def get_args_pairs(arguments):
    

    return ' '.join(' '.join(['-' + k, tcl_str(str(v))]) for k, v in arguments.items())
1168741
def getargspec(f):
    """"""
    spec = getfullargspec(f)
    return ArgSpec(spec.args, spec.varargs, spec.varkw, spec.defaults)
679594
def port_type(arg):
	""""""
	error_msg = "{0} is not a valid port".format(repr(arg))
	try:
		arg = ast.literal_eval(arg)
	except ValueError:
		raise argparse.ArgumentTypeError(error_msg)
	if arg < 0 or arg > 65535:
		raise argparse.ArgumentTypeError(error_msg)
	return arg