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

Method _add_action

Lib/argparse.py:1647–1666  ·  view source on GitHub ↗
(self, action)

Source from the content-addressed store, hash-verified

1645 return group
1646
1647 def _add_action(self, action):
1648 # resolve any conflicts
1649 self._check_conflict(action)
1650
1651 # add to actions list
1652 self._actions.append(action)
1653 action.container = self
1654
1655 # index the action by any option strings it has
1656 for option_string in action.option_strings:
1657 self._option_string_actions[option_string] = action
1658
1659 # set the flag if any option strings look like negative numbers
1660 for option_string in action.option_strings:
1661 if self._negative_number_matcher.match(option_string):
1662 if not self._has_negative_number_optionals:
1663 self._has_negative_number_optionals.append(True)
1664
1665 # return the created action
1666 return action
1667
1668 def _remove_action(self, action):
1669 self._actions.remove(action)

Callers 1

add_argumentMethod · 0.95

Calls 3

_check_conflictMethod · 0.95
appendMethod · 0.45
matchMethod · 0.45

Tested by

no test coverage detected