class_docstr: Responsible for parsing configuration from files and CLI.
  
  There are 2 types of configurations: Run configurations and Check
  configurations.
  
  Run Configurations:
  ------------------
  Responsible for deciding things that are related to the user interface and
  configuration discovery, e.g. verbosity, debug options, etc.
  All run configurations default to `False` or `None` and are decided only
  by CLI.
  
  Check Configurations:
  --------------------
  Configurations that are related to which files and errors will be checked.
  These are configurable in 2 ways: using the CLI, and using configuration
  files.
  
  Configuration files are nested within the file system, meaning that the
  closer a configuration file is to a checked file, the more relevant it will
  be. For instance, imagine this directory structure:
  
  A
  +-- tox.ini: sets `select=D100`
  +-- B
      +-- foo.py
      +-- tox.ini: sets `add-ignore=D100`
  
  Then `foo.py` will not be checked for `D100`.
  The configuration build algorithm is described in `self._get_config`.
  
  Note: If any of `BASE_ERROR_SELECTION_OPTIONS` was selected in the CLI, all
  configuration files will be ignored and each file will be checked for
  the error codes supplied in the CLI.
class_docstr_tok: ["Responsible","for","parsing","configuration","from","files","and","CLI",".","There","are","2","types","of","configurations",":","Run","configurations","and","Check","configurations",".","Run","Configurations",":","--","--","--","--","--","--","--","--","--","Responsible","for","deciding","things","that","are","related","to","the","user","interface","and","configuration","discovery",",","e.g",".","verbosity",",","debug","options",",","etc",".","All","run","configurations","default","to","`","False","`","or","`","None","`","and","are","decided","only","by","CLI",".","Check","Configurations",":","--","--","--","--","--","--","--","--","--","--","Configurations","that","are","related","to","which","files","and","errors","will","be","checked",".","These","are","configurable","in","2","ways",":","using","the","CLI",",","and","using","configuration","files",".","Configuration","files","are","nested","within","the","file","system",",","meaning","that","the","closer","a","configuration","file","is","to","a","checked","file",",","the","more","relevant","it","will","be",".","For","instance",",","imagine","this","directory","structure",":","A","+","--","tox.ini",":","sets","`","select=D100","`","+","--","B","+","--","foo.py","+","--","tox.ini",":","sets","`","add-ignore=D100","`","Then","`","foo.py","`","will","not","be","checked","for","`","D100","`",".","The","configuration","build","algorithm","is","described","in","`","self._get_config","`",".","Note",":","If","any","of","`","BASE_ERROR_SELECTION_OPTIONS","`","was","selected","in","the","CLI",",","all","configuration","files","will","be","ignored","and","each","file","will","be","checked","for","the","error","codes","supplied","in","the","CLI","."]
docstr: Return an option parser to parse the command line arguments.
docstr_tok: ["Return","an","option","parser","to","parse","the","command","line","arguments","."]
code: def _create_option_parser(cls):
      """Return an option parser to parse the command line arguments."""
      from optparse import OptionGroup, OptionParser
  
      parser = OptionParser(
          version=__version__,
          usage="Usage: pydocstyle [options] [<file|dir>...]",
      )
  
      option = parser.add_option
  
      # Run configuration options
      option(
          "-e",
          "--explain",
          action="store_true",
          default=False,
          help="show explanation of each error",
      )
      option(
          "-s",
          "--source",
          action="store_true",
          default=False,
          help="show source for each error",
      )
      option(
          "-d",
          "--debug",
          action="store_true",
          default=False,
          help="print debug information",
      )
      option(
          "-v",
          "--verbose",
          action="store_true",
          default=False,
          help="print status information",
      )
      option(
          "--count",
          action="store_true",
          default=False,
          help="print total number of errors to stdout",
      )
      option(
          "--config",
          metavar="<path>",
          default=None,
          help="use given config file and disable config discovery",
      )
  
      parser.add_option_group(
          OptionGroup(
              parser,
              "Note",
              "When using --match, --match-dir or --ignore-decorators consider "
              "whether you should use a single quote (') or a double quote (\"), "
              "depending on your OS, Shell, etc.",
          )
      )
  
      check_group = OptionGroup(
          parser,
          "Error Check Options",
          "Only one of --select, --ignore or --convention can be "
          "specified. If none is specified, defaults to "
          '`--convention=pep257`. These three options select the "basic '
          'list" of error codes to check. If you wish to change that list '
          "(for example, if you selected a known convention but wish to "
          "ignore a specific error from it or add a new one) you can "
          "use `--add-[ignore/select]` in order to do so.",
      )
      add_check = check_group.add_option
  
      # Error check options
      add_check(
          "--select",
          metavar="<codes>",
          default=None,
          help="choose the basic list of checked errors by "
          "specifying which errors to check for (with a list of "
          "comma-separated error codes or prefixes). "
          "for example: --select=D101,D2",
      )
      add_check(
          "--ignore",
          metavar="<codes>",
          default=None,
          help="choose the basic list of checked errors by "
          "specifying which errors to ignore out of all of the "
          "available error codes (with a list of "
          "comma-separated error codes or prefixes). "
          "for example: --ignore=D101,D2",
      )
      add_check(
          "--convention",
          metavar="<name>",
          default=None,
          help="choose the basic list of checked errors by specifying "
          "an existing convention. Possible conventions: {}.".format(
              ", ".join(conventions)
          ),
      )
      add_check(
          "--add-select",
          metavar="<codes>",
          default=None,
          help="add extra error codes to check to the basic list of "
          "errors previously set by --select, --ignore or "
          "--convention.",
      )
      add_check(
          "--add-ignore",
          metavar="<codes>",
          default=None,
          help="ignore extra error codes by removing them from the "
          "basic list previously set by --select, --ignore "
          "or --convention.",
      )
      add_check(
          "--ignore-self-only-init",
          default=None,
          action="store_true",
          help="ignore __init__ methods which only have a self param.",
      )
  
      parser.add_option_group(check_group)
  
      # Match clauses
      option(
          "--match",
          metavar="<pattern>",
          default=None,
          help=(
              "check only files that exactly match <pattern> regular "
              "expression; default is --match='{}' which matches "
              "files that don't start with 'test_' but end with "
              "'.py'"
          ).format(cls.DEFAULT_MATCH_RE),
      )
      option(
          "--match-dir",
          metavar="<pattern>",
          default=None,
          help=(
              "search only dirs that exactly match <pattern> regular "
              "expression; default is --match-dir='{}', which "
              "matches all dirs that don't start with "
              "a dot"
          ).format(cls.DEFAULT_MATCH_DIR_RE),
      )
  
      # Decorators
      option(
          "--ignore-decorators",
          metavar="<decorators>",
          default=None,
          help=(
              "ignore any functions or methods that are decorated "
              "by a function with a name fitting the <decorators> "
              "regular expression; default is --ignore-decorators='{}'"
              " which does not ignore any decorated functions.".format(
                  cls.DEFAULT_IGNORE_DECORATORS_RE
              )
          ),
      )
      option(
          "--property-decorators",
          metavar="<property-decorators>",
          default=None,
          help=(
              "consider any method decorated with one of these "
              "decorators as a property, and consequently allow "
              "a docstring which is not in imperative mood; default "
              "is --property-decorators='{}'".format(
                  cls.DEFAULT_PROPERTY_DECORATORS
              )
          ),
      )
  
      return parser
  
imports: import copy
  import itertools
  import operator
  import os
  import sys
  from collections import namedtuple
  from collections.abc import Set
  from configparser import NoOptionError, NoSectionError, RawConfigParser
  from functools import reduce
  from re import compile
  from ._version import __version__
  from .utils import log
  from .violations import ErrorRegistry, conventions
label_desc: Use image node_id 23 for calling the ConfigurationParser obj's underlying member method code with example usage: obj._create_option_parser(cls) and returns: parser