MCPcopy Index your code
hub / github.com/RustPython/RustPython / take_action

Method take_action

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

Source from the content-addressed store, hash-verified

2099 warned = set()
2100
2101 def take_action(action, argument_strings, option_string=None):
2102 seen_actions.add(action)
2103 argument_values = self._get_values(action, argument_strings)
2104
2105 # error if this argument is not allowed with other previously
2106 # seen arguments
2107 if action.option_strings or argument_strings:
2108 seen_non_default_actions.add(action)
2109 for conflict_action in action_conflicts.get(action, []):
2110 if conflict_action in seen_non_default_actions:
2111 msg = _('not allowed with argument %s')
2112 action_name = _get_action_name(conflict_action)
2113 raise ArgumentError(action, msg % action_name)
2114
2115 # take the action if we didn't receive a SUPPRESS value
2116 # (e.g. from a default)
2117 if argument_values is not SUPPRESS:
2118 action(self, namespace, argument_values, option_string)
2119
2120 # function to convert arg_strings into an optional action
2121 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