| 1791 | raise ValueError('argument groups cannot be nested') |
| 1792 | |
| 1793 | class _MutuallyExclusiveGroup(_ArgumentGroup): |
| 1794 | |
| 1795 | def __init__(self, container, required=False): |
| 1796 | super(_MutuallyExclusiveGroup, self).__init__(container) |
| 1797 | self.required = required |
| 1798 | self._container = container |
| 1799 | |
| 1800 | def _add_action(self, action): |
| 1801 | if action.required: |
| 1802 | msg = 'mutually exclusive arguments must be optional' |
| 1803 | raise ValueError(msg) |
| 1804 | action = self._container._add_action(action) |
| 1805 | self._group_actions.append(action) |
| 1806 | return action |
| 1807 | |
| 1808 | def _remove_action(self, action): |
| 1809 | self._container._remove_action(action) |
| 1810 | self._group_actions.remove(action) |
| 1811 | |
| 1812 | def add_mutually_exclusive_group(self, **kwargs): |
| 1813 | raise ValueError('mutually exclusive groups cannot be nested') |
| 1814 | |
| 1815 | def _prog_name(prog=None): |
| 1816 | if prog is not None: |
no outgoing calls
no test coverage detected