Home | History | Annotate | Download | only in python2.7

Lines Matching refs:kwargs

1052     def add_parser(self, name, **kwargs):
1054 if kwargs.get('prog') is None:
1055 kwargs['prog'] = '%s %s' % (self._prog_prefix, name)
1058 if 'help' in kwargs:
1059 help = kwargs.pop('help')
1064 parser = self._parser_class(**kwargs)
1151 def __init__(self, **kwargs):
1152 for name in kwargs:
1153 setattr(self, name, kwargs[name])
1231 def set_defaults(self, **kwargs):
1232 self._defaults.update(kwargs)
1237 if action.dest in kwargs:
1238 action.default = kwargs[action.dest]
1250 def add_argument(self, *args, **kwargs):
1261 if args and 'dest' in kwargs:
1263 kwargs = self._get_positional_kwargs(*args, **kwargs)
1267 kwargs = self._get_optional_kwargs(*args, **kwargs)
1270 if 'default' not in kwargs:
1271 dest = kwargs['dest']
1273 kwargs['default'] = self._defaults[dest]
1275 kwargs['default'] = self.argument_default
1278 action_class = self._pop_action_class(kwargs)
1281 action = action_class(**kwargs)
1297 def add_argument_group(self, *args, **kwargs):
1298 group = _ArgumentGroup(self, *args, **kwargs)
1302 def add_mutually_exclusive_group(self, **kwargs):
1303 group = _MutuallyExclusiveGroup(self, **kwargs)
1371 def _get_positional_kwargs(self, dest, **kwargs):
1373 if 'required' in kwargs:
1379 if kwargs.get('nargs') not in [OPTIONAL, ZERO_OR_MORE]:
1380 kwargs['required'] = True
1381 if kwargs.get('nargs') == ZERO_OR_MORE and 'default' not in kwargs:
1382 kwargs['required'] = True
1385 return dict(kwargs, dest=dest, option_strings=[])
1387 def _get_optional_kwargs(self, *args, **kwargs):
1407 dest = kwargs.pop('dest', None)
1420 return dict(kwargs, dest=dest, option_strings=option_strings)
1422 def _pop_action_class(self, kwargs, default=None):
1423 action = kwargs.pop('action', default)
1473 def __init__(self, container, title=None, description=None, **kwargs):
1475 update = kwargs.setdefault
1480 super_init(description=description, **kwargs)
1636 def add_subparsers(self, **kwargs):
1641 kwargs.setdefault('parser_class', type(self))
1643 if 'title' in kwargs or 'description' in kwargs:
1644 title = _(kwargs.pop('title', 'subcommands'))
1645 description = _(kwargs.pop('description', None))
1652 if kwargs.get('prog') is None:
1657 kwargs['prog'] = formatter.format_help().strip()
1660 parsers_class = self._pop_action_class(kwargs, 'parsers')
1661 action = parsers_class(option_strings=[], **kwargs)