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

Lines Matching defs:OPTIONAL

7     - handles both optional and positional arguments
30 the parser with actions for optional and positional arguments. Then
77 'OPTIONAL',
101 OPTIONAL = '?'
440 # if the Optional doesn't take a value, format is:
445 # if the Optional takes a value, format is:
452 # make it look optional if it's not required or in a group
540 # if the Optional doesn't take a value, format is:
545 # if the Optional takes a value, format is:
575 elif action.nargs == OPTIONAL:
660 defaulting_nargs = [OPTIONAL, ZERO_OR_MORE]
684 """An error from creating or using an argument (optional or positional).
754 command line. This is only meaningful for optional command-line
820 if const is not None and nargs != OPTIONAL:
821 raise ValueError('nargs must be %r to supply const' % OPTIONAL)
912 if const is not None and nargs != OPTIONAL:
913 raise ValueError('nargs must be %r to supply const' % OPTIONAL)
1141 # Optional and Positional Parsing
1265 # otherwise, we're adding an optional argument
1379 if kwargs.get('nargs') not in [OPTIONAL, ZERO_OR_MORE]:
1514 msg = _('mutually exclusive arguments must be optional')
1535 - prefix_chars -- Characters that prefix optional arguments
1585 self._optionals = add_group(_('optional arguments'))
1634 # Optional/Positional adding methods
1651 # optional arguments and with no "usage:" prefix
1796 # function to convert arg_strings into an optional action
1799 # get the optional identified at this index
1809 # if we found no optional action, skip it
1815 # optional's string arguments to only this
1851 # optional's string arguments with the following strings
1862 # add the Optional to the list and return the index at which
1863 # the Optional's string args stopped
1910 # only try to parse the next optional if we didn't consume
1925 # consume the next optional and any arguments for it
1928 # consume any positionals following the last Optional
2016 OPTIONAL: _('expected at most one argument'),
2095 # it was meant to be an optional but there is no such option
2153 elif nargs == OPTIONAL:
2176 # if this is an optional action, -- is not allowed
2195 # optional argument produces a default when not present
2196 if not arg_strings and action.nargs == OPTIONAL:
2215 # single argument or optional argument produces a single value
2216 elif len(arg_strings) == 1 and action.nargs in [None, OPTIONAL]: