optparse - pydoc - phpman

Look up a command

 

Markdown Format | JSON API | MCP Server Tool


optparse
NAME MODULE REFERENCE DESCRIPTION CLASSES FUNCTIONS DATA VERSION FILE
Help on module optparse:

NAME
    optparse - A powerful, extensible, and easy-to-use option parser.

MODULE REFERENCE
    https://docs.python.org/3.10/library/optparse.html

    The following documentation is automatically generated from the Python
    source files.  It may be incomplete, incorrect or include features that
    are considered implementation detail and may vary between Python
    implementations.  When in doubt, consult the module reference at the
    location listed above.

DESCRIPTION
    By Greg Ward <gward AT python.net>

    Originally distributed as Optik.

    For support, use the optik-users AT lists.net mailing list
    (http://lists.sourceforge.net/lists/listinfo/optik-users).

    Simple usage example:

       from optparse import OptionParser

       parser = OptionParser()
       parser.add_option("-f", "--file", dest="filename",
                         help="write report to FILE", metavar="FILE")
       parser.add_option("-q", "--quiet",
                         action="store_false", dest="verbose", default=True,
                         help="don't print status messages to stdout")

       (options, args) = parser.parse_args()

CLASSES
    builtins.Exception(builtins.BaseException)
        OptParseError
            BadOptionError
            OptionError
                OptionConflictError
            OptionValueError
    builtins.object
        HelpFormatter
            IndentedHelpFormatter
            TitledHelpFormatter
        Option
        OptionContainer
            OptionGroup
            OptionParser
        Values

    class BadOptionError(OptParseError)
     |  BadOptionError(opt_str)
     |
     |  Raised if an invalid option is seen on the command line.
     |
     |  Method resolution order:
     |      BadOptionError
     |      OptParseError
     |      builtins.Exception
     |      builtins.BaseException
     |      builtins.object
     |
     |  Methods defined here:
     |
     |  __init__(self, opt_str)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  __str__(self)
     |      Return str(self).
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from OptParseError:
     |
     |  __weakref__
     |      list of weak references to the object (if defined)
     |
     |  ----------------------------------------------------------------------
     |  Static methods inherited from builtins.Exception:
     |
     |  __new__(*args, **kwargs) from builtins.type
     |      Create and return a new object.  See help(type) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.BaseException:
     |
     |  __delattr__(self, name, /)
     |      Implement delattr(self, name).
     |
     |  __getattribute__(self, name, /)
     |      Return getattr(self, name).
     |
     |  __reduce__(...)
     |      Helper for pickle.
     |
     |  __repr__(self, /)
     |      Return repr(self).
     |
     |  __setattr__(self, name, value, /)
     |      Implement setattr(self, name, value).
     |
     |  __setstate__(...)
     |
     |  with_traceback(...)
     |      Exception.with_traceback(tb) --
     |      set self.__traceback__ to tb and return self.
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from builtins.BaseException:
     |
     |  __cause__
     |      exception cause
     |
     |  __context__
     |      exception context
     |
     |  __dict__
     |
     |  __suppress_context__
     |
     |  __traceback__
     |
     |  args

    class HelpFormatter(builtins.object)
     |  HelpFormatter(indent_increment, max_help_position, width, short_first)
     |
     |  Abstract base class for formatting option help.  OptionParser
     |  instances should use one of the HelpFormatter subclasses for
     |  formatting help; by default IndentedHelpFormatter is used.
     |
     |  Instance attributes:
     |    parser : OptionParser
     |      the controlling OptionParser instance
     |    indent_increment : int
     |      the number of columns to indent per nesting level
     |    max_help_position : int
     |      the maximum starting column for option help text
     |    help_position : int
     |      the calculated starting column for option help text;
     |      initially the same as the maximum
     |    width : int
     |      total number of columns for output (pass None to constructor for
     |      this value to be taken from the $COLUMNS environment variable)
     |    level : int
     |      current indentation level
     |    current_indent : int
     |      current indentation level (in columns)
     |    help_width : int
     |      number of columns available for option help text (calculated)
     |    default_tag : str
     |      text to replace with each option's default value, "%default"
     |      by default.  Set to false value to disable default value expansion.
     |    option_strings : { Option : str }
     |      maps Option instances to the snippet of help text explaining
     |      the syntax of that option, e.g. "-h, --help" or
     |      "-fFILE, --file=FILE"
     |    _short_opt_fmt : str
     |      format string controlling how short options with values are
     |      printed in help text.  Must be either "%s%s" ("-fFILE") or
     |      "%s %s" ("-f FILE"), because those are the two syntaxes that
     |      Optik supports.
     |    _long_opt_fmt : str
     |      similar but for long options; must be either "%s %s" ("--file FILE")
     |      or "%s=%s" ("--file=FILE").
     |
     |  Methods defined here:
     |
     |  __init__(self, indent_increment, max_help_position, width, short_first)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  dedent(self)
     |
     |  expand_default(self, option)
     |
     |  format_description(self, description)
     |
     |  format_epilog(self, epilog)
     |
     |  format_heading(self, heading)
     |
     |  format_option(self, option)
     |
     |  format_option_strings(self, option)
     |      Return a comma-separated list of option strings & metavariables.
     |
     |  format_usage(self, usage)
     |
     |  indent(self)
     |
     |  set_long_opt_delimiter(self, delim)
     |
     |  set_parser(self, parser)
     |
     |  set_short_opt_delimiter(self, delim)
     |
     |  store_option_strings(self, parser)
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |
     |  __dict__
     |      dictionary for instance variables (if defined)
     |
     |  __weakref__
     |      list of weak references to the object (if defined)
     |
     |  ----------------------------------------------------------------------
     |  Data and other attributes defined here:
     |
     |  NO_DEFAULT_VALUE = 'none'

    class IndentedHelpFormatter(HelpFormatter)
     |  IndentedHelpFormatter(indent_increment=2, max_help_position=24, width=None, short_first=1)
     |
     |  Format help with indented section bodies.
     |
     |  Method resolution order:
     |      IndentedHelpFormatter
     |      HelpFormatter
     |      builtins.object
     |
     |  Methods defined here:
     |
     |  __init__(self, indent_increment=2, max_help_position=24, width=None, short_first=1)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  format_heading(self, heading)
     |
     |  format_usage(self, usage)
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from HelpFormatter:
     |
     |  dedent(self)
     |
     |  expand_default(self, option)
     |
     |  format_description(self, description)
     |
     |  format_epilog(self, epilog)
     |
     |  format_option(self, option)
     |
     |  format_option_strings(self, option)
     |      Return a comma-separated list of option strings & metavariables.
     |
     |  indent(self)
     |
     |  set_long_opt_delimiter(self, delim)
     |
     |  set_parser(self, parser)
     |
     |  set_short_opt_delimiter(self, delim)
     |
     |  store_option_strings(self, parser)
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from HelpFormatter:
     |
     |  __dict__
     |      dictionary for instance variables (if defined)
     |
     |  __weakref__
     |      list of weak references to the object (if defined)
     |
     |  ----------------------------------------------------------------------
     |  Data and other attributes inherited from HelpFormatter:
     |
     |  NO_DEFAULT_VALUE = 'none'

    class OptParseError(builtins.Exception)
     |  OptParseError(msg)
     |
     |  Method resolution order:
     |      OptParseError
     |      builtins.Exception
     |      builtins.BaseException
     |      builtins.object
     |
     |  Methods defined here:
     |
     |  __init__(self, msg)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  __str__(self)
     |      Return str(self).
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |
     |  __weakref__
     |      list of weak references to the object (if defined)
     |
     |  ----------------------------------------------------------------------
     |  Static methods inherited from builtins.Exception:
     |
     |  __new__(*args, **kwargs) from builtins.type
     |      Create and return a new object.  See help(type) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.BaseException:
     |
     |  __delattr__(self, name, /)
     |      Implement delattr(self, name).
     |
     |  __getattribute__(self, name, /)
     |      Return getattr(self, name).
     |
     |  __reduce__(...)
     |      Helper for pickle.
     |
     |  __repr__(self, /)
     |      Return repr(self).
     |
     |  __setattr__(self, name, value, /)
     |      Implement setattr(self, name, value).
     |
     |  __setstate__(...)
     |
     |  with_traceback(...)
     |      Exception.with_traceback(tb) --
     |      set self.__traceback__ to tb and return self.
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from builtins.BaseException:
     |
     |  __cause__
     |      exception cause
     |
     |  __context__
     |      exception context
     |
     |  __dict__
     |
     |  __suppress_context__
     |
     |  __traceback__
     |
     |  args

    class Option(builtins.object)
     |  Option(*opts, **attrs)
     |
     |  Instance attributes:
     |    _short_opts : [string]
     |    _long_opts : [string]
     |
     |    action : string
     |    type : string
     |    dest : string
     |    default : any
     |    nargs : int
     |    const : any
     |    choices : [string]
     |    callback : function
     |    callback_args : (any*)
     |    callback_kwargs : { string : any }
     |    help : string
     |    metavar : string
     |
     |  Methods defined here:
     |
     |  __init__(self, *opts, **attrs)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  __repr__ = _repr(self)
     |
     |  __str__(self)
     |      Return str(self).
     |
     |  check_value(self, opt, value)
     |
     |  convert_value(self, opt, value)
     |
     |  get_opt_string(self)
     |
     |  process(self, opt, value, values, parser)
     |
     |  take_action(self, action, dest, opt, value, values, parser)
     |
     |  takes_value(self)
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |
     |  __dict__
     |      dictionary for instance variables (if defined)
     |
     |  __weakref__
     |      list of weak references to the object (if defined)
     |
     |  ----------------------------------------------------------------------
     |  Data and other attributes defined here:
     |
     |  ACTIONS = ('store', 'store_const', 'store_true', 'store_false', 'appen...
     |
     |  ALWAYS_TYPED_ACTIONS = ('store', 'append')
     |
     |  ATTRS = ['action', 'type', 'dest', 'default', 'nargs', 'const', 'choic...
     |
     |  CHECK_METHODS = [<function Option._check_action>, <function Option._ch...
     |
     |  CONST_ACTIONS = ('store_const', 'append_const')
     |
     |  STORE_ACTIONS = ('store', 'store_const', 'store_true', 'store_false', ...
     |
     |  TYPED_ACTIONS = ('store', 'append', 'callback')
     |
     |  TYPES = ('string', 'int', 'long', 'float', 'complex', 'choice')
     |
     |  TYPE_CHECKER = {'choice': <function check_choice>, 'complex': <functio...

    class OptionConflictError(OptionError)
     |  OptionConflictError(msg, option)
     |
     |  Raised if conflicting options are added to an OptionParser.
     |
     |  Method resolution order:
     |      OptionConflictError
     |      OptionError
     |      OptParseError
     |      builtins.Exception
     |      builtins.BaseException
     |      builtins.object
     |
     |  Methods inherited from OptionError:
     |
     |  __init__(self, msg, option)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  __str__(self)
     |      Return str(self).
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from OptParseError:
     |
     |  __weakref__
     |      list of weak references to the object (if defined)
     |
     |  ----------------------------------------------------------------------
     |  Static methods inherited from builtins.Exception:
     |
     |  __new__(*args, **kwargs) from builtins.type
     |      Create and return a new object.  See help(type) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.BaseException:
     |
     |  __delattr__(self, name, /)
     |      Implement delattr(self, name).
     |
     |  __getattribute__(self, name, /)
     |      Return getattr(self, name).
     |
     |  __reduce__(...)
     |      Helper for pickle.
     |
     |  __repr__(self, /)
     |      Return repr(self).
     |
     |  __setattr__(self, name, value, /)
     |      Implement setattr(self, name, value).
     |
     |  __setstate__(...)
     |
     |  with_traceback(...)
     |      Exception.with_traceback(tb) --
     |      set self.__traceback__ to tb and return self.
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from builtins.BaseException:
     |
     |  __cause__
     |      exception cause
     |
     |  __context__
     |      exception context
     |
     |  __dict__
     |
     |  __suppress_context__
     |
     |  __traceback__
     |
     |  args

    class OptionContainer(builtins.object)
     |  OptionContainer(option_class, conflict_handler, description)
     |
     |  Abstract base class.
     |
     |  Class attributes:
     |    standard_option_list : [Option]
     |      list of standard options that will be accepted by all instances
     |      of this parser class (intended to be overridden by subclasses).
     |
     |  Instance attributes:
     |    option_list : [Option]
     |      the list of Option objects contained by this OptionContainer
     |    _short_opt : { string : Option }
     |      dictionary mapping short option strings, eg. "-f" or "-X",
     |      to the Option instances that implement them.  If an Option
     |      has multiple short option strings, it will appear in this
     |      dictionary multiple times. [1]
     |    _long_opt : { string : Option }
     |      dictionary mapping long option strings, eg. "--file" or
     |      "--exclude", to the Option instances that implement them.
     |      Again, a given Option can occur multiple times in this
     |      dictionary. [1]
     |    defaults : { string : any }
     |      dictionary mapping option destination names to default
     |      values for each destination [1]
     |
     |  [1] These mappings are common to (shared by) all components of the
     |      controlling OptionParser, where they are initially created.
     |
     |  Methods defined here:
     |
     |  __init__(self, option_class, conflict_handler, description)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  add_option(self, *args, **kwargs)
     |      add_option(Option)
     |      add_option(opt_str, ..., kwarg=val, ...)
     |
     |  add_options(self, option_list)
     |
     |  destroy(self)
     |      see OptionParser.destroy().
     |
     |  format_description(self, formatter)
     |
     |  format_help(self, formatter)
     |
     |  format_option_help(self, formatter)
     |
     |  get_description(self)
     |
     |  get_option(self, opt_str)
     |
     |  has_option(self, opt_str)
     |
     |  remove_option(self, opt_str)
     |
     |  set_conflict_handler(self, handler)
     |
     |  set_description(self, description)
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |
     |  __dict__
     |      dictionary for instance variables (if defined)
     |
     |  __weakref__
     |      list of weak references to the object (if defined)

    class OptionError(OptParseError)
     |  OptionError(msg, option)
     |
     |  Raised if an Option instance is created with invalid or
     |  inconsistent arguments.
     |
     |  Method resolution order:
     |      OptionError
     |      OptParseError
     |      builtins.Exception
     |      builtins.BaseException
     |      builtins.object
     |
     |  Methods defined here:
     |
     |  __init__(self, msg, option)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  __str__(self)
     |      Return str(self).
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from OptParseError:
     |
     |  __weakref__
     |      list of weak references to the object (if defined)
     |
     |  ----------------------------------------------------------------------
     |  Static methods inherited from builtins.Exception:
     |
     |  __new__(*args, **kwargs) from builtins.type
     |      Create and return a new object.  See help(type) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.BaseException:
     |
     |  __delattr__(self, name, /)
     |      Implement delattr(self, name).
     |
     |  __getattribute__(self, name, /)
     |      Return getattr(self, name).
     |
     |  __reduce__(...)
     |      Helper for pickle.
     |
     |  __repr__(self, /)
     |      Return repr(self).
     |
     |  __setattr__(self, name, value, /)
     |      Implement setattr(self, name, value).
     |
     |  __setstate__(...)
     |
     |  with_traceback(...)
     |      Exception.with_traceback(tb) --
     |      set self.__traceback__ to tb and return self.
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from builtins.BaseException:
     |
     |  __cause__
     |      exception cause
     |
     |  __context__
     |      exception context
     |
     |  __dict__
     |
     |  __suppress_context__
     |
     |  __traceback__
     |
     |  args

    class OptionGroup(OptionContainer)
     |  OptionGroup(parser, title, description=None)
     |
     |  Method resolution order:
     |      OptionGroup
     |      OptionContainer
     |      builtins.object
     |
     |  Methods defined here:
     |
     |  __init__(self, parser, title, description=None)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  destroy(self)
     |      see OptionParser.destroy().
     |
     |  format_help(self, formatter)
     |
     |  set_title(self, title)
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from OptionContainer:
     |
     |  add_option(self, *args, **kwargs)
     |      add_option(Option)
     |      add_option(opt_str, ..., kwarg=val, ...)
     |
     |  add_options(self, option_list)
     |
     |  format_description(self, formatter)
     |
     |  format_option_help(self, formatter)
     |
     |  get_description(self)
     |
     |  get_option(self, opt_str)
     |
     |  has_option(self, opt_str)
     |
     |  remove_option(self, opt_str)
     |
     |  set_conflict_handler(self, handler)
     |
     |  set_description(self, description)
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from OptionContainer:
     |
     |  __dict__
     |      dictionary for instance variables (if defined)
     |
     |  __weakref__
     |      list of weak references to the object (if defined)

    class OptionParser(OptionContainer)
     |  OptionParser(usage=None, option_list=None, option_class=<class 'optparse.Option'>, version=None, conflict_handler='error', description=None, formatter=None, add_help_option=True, prog=None, epilog=None)
     |
     |  Class attributes:
     |    standard_option_list : [Option]
     |      list of standard options that will be accepted by all instances
     |      of this parser class (intended to be overridden by subclasses).
     |
     |  Instance attributes:
     |    usage : string
     |      a usage string for your program.  Before it is displayed
     |      to the user, "%prog" will be expanded to the name of
     |      your program (self.prog or os.path.basename(sys.argv[0])).
     |    prog : string
     |      the name of the current program (to override
     |      os.path.basename(sys.argv[0])).
     |    description : string
     |      A paragraph of text giving a brief overview of your program.
     |      optparse reformats this paragraph to fit the current terminal
     |      width and prints it when the user requests help (after usage,
     |      but before the list of options).
     |    epilog : string
     |      paragraph of help text to print after option help
     |
     |    option_groups : [OptionGroup]
     |      list of option groups in this parser (option groups are
     |      irrelevant for parsing the command-line, but very useful
     |      for generating help)
     |
     |    allow_interspersed_args : bool = true
     |      if true, positional arguments may be interspersed with options.
     |      Assuming -a and -b each take a single argument, the command-line
     |        -ablah foo bar -bboo baz
     |      will be interpreted the same as
     |        -ablah -bboo -- foo bar baz
     |      If this flag were false, that command line would be interpreted as
     |        -ablah -- foo bar -bboo baz
     |      -- ie. we stop processing options as soon as we see the first
     |      non-option argument.  (This is the tradition followed by
     |      Python's getopt module, Perl's Getopt::Std, and other argument-
     |      parsing libraries, but it is generally annoying to users.)
     |
     |    process_default_values : bool = true
     |      if true, option default values are processed similarly to option
     |      values from the command line: that is, they are passed to the
     |      type-checking function for the option's type (as long as the
     |      default value is a string).  (This really only matters if you
     |      have defined custom types; see SF bug #955889.)  Set it to false
     |      to restore the behaviour of Optik 1.4.1 and earlier.
     |
     |    rargs : [string]
     |      the argument list currently being parsed.  Only set when
     |      parse_args() is active, and continually trimmed down as
     |      we consume arguments.  Mainly there for the benefit of
     |      callback options.
     |    largs : [string]
     |      the list of leftover arguments that we have skipped while
     |      parsing options.  If allow_interspersed_args is false, this
     |      list is always empty.
     |    values : Values
     |      the set of option values currently being accumulated.  Only
     |      set when parse_args() is active.  Also mainly for callbacks.
     |
     |  Because of the 'rargs', 'largs', and 'values' attributes,
     |  OptionParser is not thread-safe.  If, for some perverse reason, you
     |  need to parse command-line arguments simultaneously in different
     |  threads, use different OptionParser instances.
     |
     |  Method resolution order:
     |      OptionParser
     |      OptionContainer
     |      builtins.object
     |
     |  Methods defined here:
     |
     |  __init__(self, usage=None, option_list=None, option_class=<class 'optparse.Option'>, version=None, conflict_handler='error', description=None, formatter=None, add_help_option=True, prog=None, epilog=None)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  add_option_group(self, *args, **kwargs)
     |
     |  check_values(self, values, args)
     |      check_values(values : Values, args : [string])
     |      -> (values : Values, args : [string])
     |
     |      Check that the supplied option values and leftover arguments are
     |      valid.  Returns the option values and leftover arguments
     |      (possibly adjusted, possibly completely new -- whatever you
     |      like).  Default implementation just returns the passed-in
     |      values; subclasses may override as desired.
     |
     |  destroy(self)
     |      Declare that you are done with this OptionParser.  This cleans up
     |      reference cycles so the OptionParser (and all objects referenced by
     |      it) can be garbage-collected promptly.  After calling destroy(), the
     |      OptionParser is unusable.
     |
     |  disable_interspersed_args(self)
     |      Set parsing to stop on the first non-option. Use this if
     |      you have a command processor which runs another command that
     |      has options of its own and you want to make sure these options
     |      don't get confused.
     |
     |  enable_interspersed_args(self)
     |      Set parsing to not stop on the first non-option, allowing
     |      interspersing switches with command arguments. This is the
     |      default behavior. See also disable_interspersed_args() and the
     |      class documentation description of the attribute
     |      allow_interspersed_args.
     |
     |  error(self, msg)
     |      error(msg : string)
     |
     |      Print a usage message incorporating 'msg' to stderr and exit.
     |      If you override this in a subclass, it should not return -- it
     |      should either exit or raise an exception.
     |
     |  exit(self, status=0, msg=None)
     |
     |  expand_prog_name(self, s)
     |
     |  format_epilog(self, formatter)
     |
     |  format_help(self, formatter=None)
     |
     |  format_option_help(self, formatter=None)
     |
     |  get_default_values(self)
     |
     |  get_description(self)
     |
     |  get_option_group(self, opt_str)
     |
     |  get_prog_name(self)
     |
     |  get_usage(self)
     |
     |  get_version(self)
     |
     |  parse_args(self, args=None, values=None)
     |      parse_args(args : [string] = sys.argv[1:],
     |                 values : Values = None)
     |      -> (values : Values, args : [string])
     |
     |      Parse the command-line options found in 'args' (default:
     |      sys.argv[1:]).  Any errors result in a call to 'error()', which
     |      by default prints the usage message to stderr and calls
     |      sys.exit() with an error message.  On success returns a pair
     |      (values, args) where 'values' is a Values instance (with all
     |      your option values) and 'args' is the list of arguments left
     |      over after parsing options.
     |
     |  print_help(self, file=None)
     |      print_help(file : file = stdout)
     |
     |      Print an extended help message, listing all options and any
     |      help text provided with them, to 'file' (default stdout).
     |
     |  print_usage(self, file=None)
     |      print_usage(file : file = stdout)
     |
     |      Print the usage message for the current program (self.usage) to
     |      'file' (default stdout).  Any occurrence of the string "%prog" in
     |      self.usage is replaced with the name of the current program
     |      (basename of sys.argv[0]).  Does nothing if self.usage is empty
     |      or not defined.
     |
     |  print_version(self, file=None)
     |      print_version(file : file = stdout)
     |
     |      Print the version message for this program (self.version) to
     |      'file' (default stdout).  As with print_usage(), any occurrence
     |      of "%prog" in self.version is replaced by the current program's
     |      name.  Does nothing if self.version is empty or undefined.
     |
     |  set_default(self, dest, value)
     |
     |  set_defaults(self, **kwargs)
     |
     |  set_process_default_values(self, process)
     |
     |  set_usage(self, usage)
     |
     |  ----------------------------------------------------------------------
     |  Data and other attributes defined here:
     |
     |  standard_option_list = []
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from OptionContainer:
     |
     |  add_option(self, *args, **kwargs)
     |      add_option(Option)
     |      add_option(opt_str, ..., kwarg=val, ...)
     |
     |  add_options(self, option_list)
     |
     |  format_description(self, formatter)
     |
     |  get_option(self, opt_str)
     |
     |  has_option(self, opt_str)
     |
     |  remove_option(self, opt_str)
     |
     |  set_conflict_handler(self, handler)
     |
     |  set_description(self, description)
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from OptionContainer:
     |
     |  __dict__
     |      dictionary for instance variables (if defined)
     |
     |  __weakref__
     |      list of weak references to the object (if defined)

    class OptionValueError(OptParseError)
     |  OptionValueError(msg)
     |
     |  Raised if an invalid option value is encountered on the command
     |  line.
     |
     |  Method resolution order:
     |      OptionValueError
     |      OptParseError
     |      builtins.Exception
     |      builtins.BaseException
     |      builtins.object
     |
     |  Methods inherited from OptParseError:
     |
     |  __init__(self, msg)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  __str__(self)
     |      Return str(self).
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from OptParseError:
     |
     |  __weakref__
     |      list of weak references to the object (if defined)
     |
     |  ----------------------------------------------------------------------
     |  Static methods inherited from builtins.Exception:
     |
     |  __new__(*args, **kwargs) from builtins.type
     |      Create and return a new object.  See help(type) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.BaseException:
     |
     |  __delattr__(self, name, /)
     |      Implement delattr(self, name).
     |
     |  __getattribute__(self, name, /)
     |      Return getattr(self, name).
     |
     |  __reduce__(...)
     |      Helper for pickle.
     |
     |  __repr__(self, /)
     |      Return repr(self).
     |
     |  __setattr__(self, name, value, /)
     |      Implement setattr(self, name, value).
     |
     |  __setstate__(...)
     |
     |  with_traceback(...)
     |      Exception.with_traceback(tb) --
     |      set self.__traceback__ to tb and return self.
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from builtins.BaseException:
     |
     |  __cause__
     |      exception cause
     |
     |  __context__
     |      exception context
     |
     |  __dict__
     |
     |  __suppress_context__
     |
     |  __traceback__
     |
     |  args

    class TitledHelpFormatter(HelpFormatter)
     |  TitledHelpFormatter(indent_increment=0, max_help_position=24, width=None, short_first=0)
     |
     |  Format help with underlined section headers.
     |
     |  Method resolution order:
     |      TitledHelpFormatter
     |      HelpFormatter
     |      builtins.object
     |
     |  Methods defined here:
     |
     |  __init__(self, indent_increment=0, max_help_position=24, width=None, short_first=0)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  format_heading(self, heading)
     |
     |  format_usage(self, usage)
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from HelpFormatter:
     |
     |  dedent(self)
     |
     |  expand_default(self, option)
     |
     |  format_description(self, description)
     |
     |  format_epilog(self, epilog)
     |
     |  format_option(self, option)
     |
     |  format_option_strings(self, option)
     |      Return a comma-separated list of option strings & metavariables.
     |
     |  indent(self)
     |
     |  set_long_opt_delimiter(self, delim)
     |
     |  set_parser(self, parser)
     |
     |  set_short_opt_delimiter(self, delim)
     |
     |  store_option_strings(self, parser)
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from HelpFormatter:
     |
     |  __dict__
     |      dictionary for instance variables (if defined)
     |
     |  __weakref__
     |      list of weak references to the object (if defined)
     |
     |  ----------------------------------------------------------------------
     |  Data and other attributes inherited from HelpFormatter:
     |
     |  NO_DEFAULT_VALUE = 'none'

    class Values(builtins.object)
     |  Values(defaults=None)
     |
     |  Methods defined here:
     |
     |  __eq__(self, other)
     |      Return self==value.
     |
     |  __init__(self, defaults=None)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  __repr__ = _repr(self)
     |
     |  __str__(self)
     |      Return str(self).
     |
     |  ensure_value(self, attr, value)
     |
     |  read_file(self, filename, mode='careful')
     |
     |  read_module(self, modname, mode='careful')
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |
     |  __dict__
     |      dictionary for instance variables (if defined)
     |
     |  __weakref__
     |      list of weak references to the object (if defined)
     |
     |  ----------------------------------------------------------------------
     |  Data and other attributes defined here:
     |
     |  __hash__ = None

    make_option = class Option(builtins.object)
     |  make_option(*opts, **attrs)
     |
     |  Instance attributes:
     |    _short_opts : [string]
     |    _long_opts : [string]
     |
     |    action : string
     |    type : string
     |    dest : string
     |    default : any
     |    nargs : int
     |    const : any
     |    choices : [string]
     |    callback : function
     |    callback_args : (any*)
     |    callback_kwargs : { string : any }
     |    help : string
     |    metavar : string
     |
     |  Methods defined here:
     |
     |  __init__(self, *opts, **attrs)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  __repr__ = _repr(self)
     |
     |  __str__(self)
     |      Return str(self).
     |
     |  check_value(self, opt, value)
     |
     |  convert_value(self, opt, value)
     |
     |  get_opt_string(self)
     |
     |  process(self, opt, value, values, parser)
     |
     |  take_action(self, action, dest, opt, value, values, parser)
     |
     |  takes_value(self)
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |
     |  __dict__
     |      dictionary for instance variables (if defined)
     |
     |  __weakref__
     |      list of weak references to the object (if defined)
     |
     |  ----------------------------------------------------------------------
     |  Data and other attributes defined here:
     |
     |  ACTIONS = ('store', 'store_const', 'store_true', 'store_false', 'appen...
     |
     |  ALWAYS_TYPED_ACTIONS = ('store', 'append')
     |
     |  ATTRS = ['action', 'type', 'dest', 'default', 'nargs', 'const', 'choic...
     |
     |  CHECK_METHODS = [<function Option._check_action>, <function Option._ch...
     |
     |  CONST_ACTIONS = ('store_const', 'append_const')
     |
     |  STORE_ACTIONS = ('store', 'store_const', 'store_true', 'store_false', ...
     |
     |  TYPED_ACTIONS = ('store', 'append', 'callback')
     |
     |  TYPES = ('string', 'int', 'long', 'float', 'complex', 'choice')
     |
     |  TYPE_CHECKER = {'choice': <function check_choice>, 'complex': <functio...

FUNCTIONS
    check_choice(option, opt, value)

DATA
    SUPPRESS_HELP = 'SUPPRESSHELP'
    SUPPRESS_USAGE = 'SUPPRESSUSAGE'
    __all__ = ['Option', 'make_option', 'SUPPRESS_HELP', 'SUPPRESS_USAGE',...
    __copyright__ = '\nCopyright (c) 2001-2006 Gregory P. Ward.  All r...E...

VERSION
    1.5.3

FILE
    /usr/lib/python3.10/optparse.py



Generated by phpMan Author: Che Dong Under GNU General Public License
2026-06-02 05:12 @216.73.216.198 CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0 TransitionalValid CSS!

^_back to top