MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / take_action

Method take_action

tools/python-3.11.9-amd64/Lib/argparse.py:1965–1983  ·  view source on GitHub ↗
(action, argument_strings, option_string=None)

Source from the content-addressed store, hash-verified

1963 seen_non_default_actions = set()
1964
1965 def take_action(action, argument_strings, option_string=None):
1966 seen_actions.add(action)
1967 argument_values = self._get_values(action, argument_strings)
1968
1969 # error if this argument is not allowed with other previously
1970 # seen arguments, assuming that actions that use the default
1971 # value don't really count as "present"
1972 if argument_values is not action.default:
1973 seen_non_default_actions.add(action)
1974 for conflict_action in action_conflicts.get(action, []):
1975 if conflict_action in seen_non_default_actions:
1976 msg = _('not allowed with argument %s')
1977 action_name = _get_action_name(conflict_action)
1978 raise ArgumentError(action, msg % action_name)
1979
1980 # take the action if we didn't receive a SUPPRESS value
1981 # (e.g. from a default)
1982 if argument_values is not SUPPRESS:
1983 action(self, namespace, argument_values, option_string)
1984
1985 # function to convert arg_strings into an optional action
1986 def consume_optional(start_index):

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected