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

Class _ArgumentGroup

lib/0xtools/argparse.py:1493–1524  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1491
1492
1493class _ArgumentGroup(_ActionsContainer):
1494
1495 def __init__(self, container, title=None, description=None, **kwargs):
1496 # add any missing keyword arguments by checking the container
1497 update = kwargs.setdefault
1498 update('conflict_handler', container.conflict_handler)
1499 update('prefix_chars', container.prefix_chars)
1500 update('argument_default', container.argument_default)
1501 super_init = super(_ArgumentGroup, self).__init__
1502 super_init(description=description, **kwargs)
1503
1504 # group attributes
1505 self.title = title
1506 self._group_actions = []
1507
1508 # share most attributes with the container
1509 self._registries = container._registries
1510 self._actions = container._actions
1511 self._option_string_actions = container._option_string_actions
1512 self._defaults = container._defaults
1513 self._has_negative_number_optionals = \
1514 container._has_negative_number_optionals
1515 self._mutually_exclusive_groups = container._mutually_exclusive_groups
1516
1517 def _add_action(self, action):
1518 action = super(_ArgumentGroup, self)._add_action(action)
1519 self._group_actions.append(action)
1520 return action
1521
1522 def _remove_action(self, action):
1523 super(_ArgumentGroup, self)._remove_action(action)
1524 self._group_actions.remove(action)
1525
1526
1527class _MutuallyExclusiveGroup(_ArgumentGroup):

Callers 1

add_argument_groupMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected