| 1639 | group_map.get(action, self)._add_action(action) |
| 1640 | |
| 1641 | def _get_positional_kwargs(self, dest, **kwargs): |
| 1642 | # make sure required is not specified |
| 1643 | if 'required' in kwargs: |
| 1644 | msg = "'required' is an invalid argument for positionals" |
| 1645 | raise TypeError(msg) |
| 1646 | |
| 1647 | # mark positional arguments as required if at least one is |
| 1648 | # always required |
| 1649 | nargs = kwargs.get('nargs') |
| 1650 | if nargs == 0: |
| 1651 | raise ValueError('nargs for positionals must be != 0') |
| 1652 | if nargs not in [OPTIONAL, ZERO_OR_MORE, REMAINDER, SUPPRESS]: |
| 1653 | kwargs['required'] = True |
| 1654 | |
| 1655 | # return the keyword arguments with no option strings |
| 1656 | return dict(kwargs, dest=dest, option_strings=[]) |
| 1657 | |
| 1658 | def _get_optional_kwargs(self, *args, **kwargs): |
| 1659 | # determine short and long option strings |