MCPcopy Index your code
hub / github.com/tanelpoder/0xtools / take_action

Method take_action

lib/0xtools/argparse.py:1798–1816  ·  view source on GitHub ↗
(action, argument_strings, option_string=None)

Source from the content-addressed store, hash-verified

1796 seen_non_default_actions = set()
1797
1798 def take_action(action, argument_strings, option_string=None):
1799 seen_actions.add(action)
1800 argument_values = self._get_values(action, argument_strings)
1801
1802 # error if this argument is not allowed with other previously
1803 # seen arguments, assuming that actions that use the default
1804 # value don't really count as "present"
1805 if argument_values is not action.default:
1806 seen_non_default_actions.add(action)
1807 for conflict_action in action_conflicts.get(action, []):
1808 if conflict_action in seen_non_default_actions:
1809 msg = _('not allowed with argument %s')
1810 action_name = _get_action_name(conflict_action)
1811 raise ArgumentError(action, msg % action_name)
1812
1813 # take the action if we didn't receive a SUPPRESS value
1814 # (e.g. from a default)
1815 if argument_values is not SUPPRESS:
1816 action(self, namespace, argument_values, option_string)
1817
1818 # function to convert arg_strings into an optional action
1819 def consume_optional(start_index):

Callers

nothing calls this directly

Calls 3

_get_valuesMethod · 0.95
_get_action_nameFunction · 0.85
ArgumentErrorClass · 0.85

Tested by

no test coverage detected