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

Class _MutuallyExclusiveGroup

Lib/argparse.py:1875–1895  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1873 raise ValueError('argument groups cannot be nested')
1874
1875class _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
1897def _prog_name(prog=None):
1898 if prog is not None:

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…