| 1523 | |
| 1524 | |
| 1525 | class _MutuallyExclusiveGroup(_ArgumentGroup): |
| 1526 | |
| 1527 | def __init__(self, container, required=False): |
| 1528 | super(_MutuallyExclusiveGroup, self).__init__(container) |
| 1529 | self.required = required |
| 1530 | self._container = container |
| 1531 | |
| 1532 | def _add_action(self, action): |
| 1533 | if action.required: |
| 1534 | msg = _('mutually exclusive arguments must be optional') |
| 1535 | raise ValueError(msg) |
| 1536 | action = self._container._add_action(action) |
| 1537 | self._group_actions.append(action) |
| 1538 | return action |
| 1539 | |
| 1540 | def _remove_action(self, action): |
| 1541 | self._container._remove_action(action) |
| 1542 | self._group_actions.remove(action) |
| 1543 | |
| 1544 | |
| 1545 | class ArgumentParser(_AttributeHolder, _ActionsContainer): |
no outgoing calls
no test coverage detected