| 1873 | raise ValueError('argument groups cannot be nested') |
| 1874 | |
| 1875 | class _MutuallyExclusiveGroup(_ArgumentGroup): |
| 1876 | |
| 1877 | def __init__(self, container, required=False): |
| 1878 | super(_MutuallyExclusiveGroup, self).__init__(container) |
| 1879 | self.required = required |
| 1880 | self._container = container |
| 1881 | |
| 1882 | def _add_action(self, action): |
| 1883 | if action.required: |
| 1884 | msg = 'mutually exclusive arguments must be optional' |
| 1885 | raise ValueError(msg) |
| 1886 | action = self._container._add_action(action) |
| 1887 | self._group_actions.append(action) |
| 1888 | return action |
| 1889 | |
| 1890 | def _remove_action(self, action): |
| 1891 | self._container._remove_action(action) |
| 1892 | self._group_actions.remove(action) |
| 1893 | |
| 1894 | def add_mutually_exclusive_group(self, **kwargs): |
| 1895 | raise ValueError('mutually exclusive groups cannot be nested') |
| 1896 | |
| 1897 | def _prog_name(prog=None): |
| 1898 | if prog is not None: |
no outgoing calls
no test coverage detected
searching dependent graphs…