class_docstr: The option parser is an internal class that is ultimately used to
  parse options and arguments.  It's modelled after optparse and brings
  a similar but vastly simplified API.  It should generally not be used
  directly as the high level Click classes wrap it for you.
  
  It's not nearly as extensible as optparse or argparse as it does not
  implement features that are implemented on a higher level (such as
  types or defaults).
  
  :param ctx: optionally the :class:`~click.Context` where this parser
              should go with.
class_docstr_tok: ["The","option","parser","is","an","internal","class","that","is","ultimately","used","to","parse","options","and","arguments",".","It","'s","modelled","after","optparse","and","brings","a","similar","but","vastly","simplified","API",".","It","should","generally","not","be","used","directly","as","the","high","level","Click","classes","wrap","it","for","you",".","It","'s","not","nearly","as","extensible","as","optparse","or","argparse","as","it","does","not","implement","features","that","are","implemented","on","a","higher","level","(","such","as","types","or","defaults",")",".",":","param","ctx",":","optionally","the",":","class",":","`","~click.Context","`","where","this","parser","should","go","with","."]
code: def __init__(self, ctx=None):
      #: The :class:`~click.Context` for this parser.  This might be
      #: `None` for some advanced use cases.
      self.ctx = ctx
      #: This controls how the parser deals with interspersed arguments.
      #: If this is set to `False`, the parser will stop on the first
      #: non-option.  Click uses this to implement nested subcommands
      #: safely.
      self.allow_interspersed_args = True
      #: This tells the parser how to deal with unknown options.  By
      #: default it will error out (which is sensible), but there is a
      #: second mode where it will ignore it and continue processing
      #: after shifting all the unknown options into the resulting args.
      self.ignore_unknown_options = False
      if ctx is not None:
          self.allow_interspersed_args = ctx.allow_interspersed_args
          self.ignore_unknown_options = ctx.ignore_unknown_options
      self._short_opt = {}
      self._long_opt = {}
      self._opt_prefixes = {"-", "--"}
      self._args = []
  
imports: import re
  from collections import deque
  from .exceptions import BadArgumentUsage
  from .exceptions import BadOptionUsage
  from .exceptions import NoSuchOption
  from .exceptions import UsageError
label_desc: Use image node_id 1 to create a new OptionParser object from inherited base classes: object with example: obj = OptionParser(ctx)