MCPcopy
hub / github.com/tanelpoder/0xtools / __call__

Method __call__

lib/0xtools/argparse.py:1093–1115  ·  view source on GitHub ↗
(self, parser, namespace, values, option_string=None)

Source from the content-addressed store, hash-verified

1091 return self._choices_actions
1092
1093 def __call__(self, parser, namespace, values, option_string=None):
1094 parser_name = values[0]
1095 arg_strings = values[1:]
1096
1097 # set the parser name if requested
1098 if self.dest is not SUPPRESS:
1099 setattr(namespace, self.dest, parser_name)
1100
1101 # select the parser
1102 try:
1103 parser = self._name_parser_map[parser_name]
1104 except KeyError:
1105 tup = parser_name, ', '.join(self._name_parser_map)
1106 msg = _('unknown parser %r (choices: %s)') % tup
1107 raise ArgumentError(self, msg)
1108
1109 # parse all the remaining options into the namespace
1110 # store any unrecognized options on the object, so that the top
1111 # level parser can decide what to do with them
1112 namespace, arg_strings = parser.parse_known_args(arg_strings, namespace)
1113 if arg_strings:
1114 vars(namespace).setdefault(_UNRECOGNIZED_ARGS_ATTR, [])
1115 getattr(namespace, _UNRECOGNIZED_ARGS_ATTR).extend(arg_strings)
1116
1117
1118# ==============

Callers

nothing calls this directly

Calls 2

ArgumentErrorClass · 0.85
parse_known_argsMethod · 0.80

Tested by

no test coverage detected