Home | History | Annotate | Download | only in Lib

Lines Matching defs:OPTIONAL

7     - handles both optional and positional arguments
30 the parser with actions for optional and positional arguments. Then
78 'OPTIONAL',
94 OPTIONAL = '?'
450 # if the Optional doesn't take a value, format is:
455 # if the Optional takes a value, format is:
462 # make it look optional if it's not required or in a group
551 # if the Optional doesn't take a value, format is:
556 # if the Optional takes a value, format is:
586 elif action.nargs == OPTIONAL:
683 defaulting_nargs = [OPTIONAL, ZERO_OR_MORE]
723 """An error from creating or using an argument (optional or positional).
793 command line. This is only meaningful for optional command-line
859 if const is not None and nargs != OPTIONAL:
860 raise ValueError('nargs must be %r to supply const' % OPTIONAL)
951 if const is not None and nargs != OPTIONAL:
952 raise ValueError('nargs must be %r to supply const' % OPTIONAL)
1216 # Optional and Positional Parsing
1337 # otherwise, we're adding an optional argument
1451 if kwargs.get('nargs') not in [OPTIONAL, ZERO_OR_MORE]:
1589 msg = _('mutually exclusive arguments must be optional')
1610 - prefix_chars -- Characters that prefix optional arguments
1653 self._optionals = add_group(_('optional arguments'))
1695 # Optional/Positional adding methods
1712 # optional arguments and with no "usage:" prefix
1857 # function to convert arg_strings into an optional action
1860 # get the optional identified at this index
1870 # if we found no optional action, skip it
1876 # optional's string arguments to only this
1912 # optional's string arguments with the following strings
1923 # add the Optional to the list and return the index at which
1924 # the Optional's string args stopped
1971 # only try to parse the next optional if we didn't consume
1986 # consume the next optional and any arguments for it
1989 # consume any positionals following the last Optional
2074 OPTIONAL: _('expected at most one argument'),
2157 # it was meant to be an optional but there is no such option
2215 elif nargs == OPTIONAL:
2242 # if this is an optional action, -- is not allowed
2346 # optional argument produces a default when not present
2347 if not arg_strings and action.nargs == OPTIONAL:
2366 # single argument or optional argument produces a single value
2367 elif len(arg_strings) == 1 and action.nargs in [None, OPTIONAL]: