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

Method _get_positional_kwargs

Lib/argparse.py:1717–1732  ·  view source on GitHub ↗
(self, dest, **kwargs)

Source from the content-addressed store, hash-verified

1715 group_map.get(action, self)._add_action(action)
1716
1717 def _get_positional_kwargs(self, dest, **kwargs):
1718 # make sure required is not specified
1719 if 'required' in kwargs:
1720 msg = "'required' is an invalid argument for positionals"
1721 raise TypeError(msg)
1722
1723 # mark positional arguments as required if at least one is
1724 # always required
1725 nargs = kwargs.get('nargs')
1726 if nargs == 0:
1727 raise ValueError('nargs for positionals must be != 0')
1728 if nargs not in [OPTIONAL, ZERO_OR_MORE, REMAINDER, SUPPRESS]:
1729 kwargs['required'] = True
1730
1731 # return the keyword arguments with no option strings
1732 return dict(kwargs, dest=dest, option_strings=[])
1733
1734 def _get_optional_kwargs(self, *args, **kwargs):
1735 # determine short and long option strings

Callers 1

add_argumentMethod · 0.95

Calls 1

getMethod · 0.45

Tested by

no test coverage detected