| 1831 | class _ArgumentGroup(_ActionsContainer): |
| 1832 | |
| 1833 | def __init__(self, container, title=None, description=None, **kwargs): |
| 1834 | if 'prefix_chars' in kwargs: |
| 1835 | import warnings |
| 1836 | depr_msg = ( |
| 1837 | "The use of the undocumented 'prefix_chars' parameter in " |
| 1838 | "ArgumentParser.add_argument_group() is deprecated." |
| 1839 | ) |
| 1840 | warnings.warn(depr_msg, DeprecationWarning, stacklevel=3) |
| 1841 | |
| 1842 | # add any missing keyword arguments by checking the container |
| 1843 | update = kwargs.setdefault |
| 1844 | update('conflict_handler', container.conflict_handler) |
| 1845 | update('prefix_chars', container.prefix_chars) |
| 1846 | update('argument_default', container.argument_default) |
| 1847 | super_init = super(_ArgumentGroup, self).__init__ |
| 1848 | super_init(description=description, **kwargs) |
| 1849 | |
| 1850 | # group attributes |
| 1851 | self.title = title |
| 1852 | self._group_actions = [] |
| 1853 | |
| 1854 | # share most attributes with the container |
| 1855 | self._registries = container._registries |
| 1856 | self._actions = container._actions |
| 1857 | self._option_string_actions = container._option_string_actions |
| 1858 | self._defaults = container._defaults |
| 1859 | self._has_negative_number_optionals = \ |
| 1860 | container._has_negative_number_optionals |
| 1861 | self._mutually_exclusive_groups = container._mutually_exclusive_groups |
| 1862 | |
| 1863 | def _add_action(self, action): |
| 1864 | action = super(_ArgumentGroup, self)._add_action(action) |