MCPcopy Index your code
hub / github.com/python/cpython / take_action

Method take_action

Lib/argparse.py:2183–2200  ·  view source on GitHub ↗
(action, argument_strings, option_string=None)

Source from the content-addressed store, hash-verified

2181 warned = set()
2182
2183 def take_action(action, argument_strings, option_string=None):
2184 seen_actions.add(action)
2185 argument_values = self._get_values(action, argument_strings)
2186
2187 # error if this argument is not allowed with other previously
2188 # seen arguments
2189 if action.option_strings or argument_strings:
2190 seen_non_default_actions.add(action)
2191 for conflict_action in action_conflicts.get(action, []):
2192 if conflict_action in seen_non_default_actions:
2193 msg = _('not allowed with argument %s')
2194 action_name = _get_action_name(conflict_action)
2195 raise ArgumentError(action, msg % action_name)
2196
2197 # take the action if we didn't receive a SUPPRESS value
2198 # (e.g. from a default)
2199 if argument_values is not SUPPRESS:
2200 action(self, namespace, argument_values, option_string)
2201
2202 # function to convert arg_strings into an optional action
2203 def consume_optional(start_index):

Callers

nothing calls this directly

Calls 6

_get_valuesMethod · 0.95
_get_action_nameFunction · 0.85
ArgumentErrorClass · 0.70
_Function · 0.50
addMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected