@@ -597,7 +597,7 @@ There are two broad classes of errors that :mod:`optparse` has to worry about:
597597programmer errors and user errors. Programmer errors are usually erroneous
598598calls to ``parser.add_option() ``, e.g. invalid option strings, unknown option
599599attributes, missing option attributes, etc. These are dealt with in the usual
600- way: raise an exception (either ``optparse.OptionError `` or `` TypeError ` `) and
600+ way: raise an exception (either ``optparse.OptionError `` or :exc: ` TypeError `) and
601601let the program crash.
602602
603603Handling user errors is much more important, since they are guaranteed to happen
@@ -794,10 +794,10 @@ And to define an option with only a long option string::
794794The keyword arguments define attributes of the new Option object. The most
795795important option attribute is :attr: `action `, and it largely determines which
796796other attributes are relevant or required. If you pass irrelevant option
797- attributes, or fail to pass required ones, :mod: `optparse ` raises an OptionError
798- exception explaining your mistake.
797+ attributes, or fail to pass required ones, :mod: `optparse ` raises an
798+ :exc: ` OptionError ` exception explaining your mistake.
799799
800- An options 's *action * determines what :mod: `optparse ` does when it encounters
800+ An option 's *action * determines what :mod: `optparse ` does when it encounters
801801this option on the command-line. The standard option actions hard-coded into
802802:mod: `optparse ` are:
803803
@@ -1054,7 +1054,7 @@ Option attributes
10541054The following option attributes may be passed as keyword arguments to
10551055``parser.add_option() ``. If you pass an option attribute that is not relevant
10561056to a particular option, or fail to pass a required option attribute,
1057- :mod: `optparse ` raises OptionError.
1057+ :mod: `optparse ` raises :exc: ` OptionError ` .
10581058
10591059* :attr: `action ` (default: ``"store" ``)
10601060
@@ -1147,7 +1147,7 @@ error message.
11471147``choice `` options are a subtype of ``string `` options. The ``choices `` option
11481148attribute (a sequence of strings) defines the set of allowed option arguments.
11491149``optparse.check_choice() `` compares user-supplied option arguments against this
1150- master list and raises OptionValueError if an invalid string is given.
1150+ master list and raises :exc: ` OptionValueError ` if an invalid string is given.
11511151
11521152
11531153.. _optparse-parsing-arguments :
@@ -1220,10 +1220,10 @@ OptionParser provides several methods to help you out:
12201220 (e.g., ``"-q" `` or ``"--verbose" ``).
12211221
12221222``remove_option(opt_str) ``
1223- If the OptionParser has an option corresponding to ``opt_str ``, that option is
1223+ If the :class: ` OptionParser ` has an option corresponding to ``opt_str ``, that option is
12241224 removed. If that option provided any other option strings, all of those option
12251225 strings become invalid. If ``opt_str `` does not occur in any option belonging to
1226- this OptionParser, raises ValueError.
1226+ this :class: ` OptionParser ` , raises :exc: ` ValueError ` .
12271227
12281228
12291229.. _optparse-conflicts-between-options :
@@ -1254,13 +1254,13 @@ or with a separate call::
12541254The available conflict handlers are:
12551255
12561256 ``error `` (default)
1257- assume option conflicts are a programming error and raise OptionConflictError
1257+ assume option conflicts are a programming error and raise :exc: ` OptionConflictError `
12581258
12591259 ``resolve ``
12601260 resolve option conflicts intelligently (see below)
12611261
12621262
1263- As an example, let's define an OptionParser that resolves conflicts
1263+ As an example, let's define an :class: ` OptionParser ` that resolves conflicts
12641264intelligently and add conflicting options to it::
12651265
12661266 parser = OptionParser(conflict_handler="resolve")
@@ -1490,7 +1490,7 @@ where
14901490Raising errors in a callback
14911491^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14921492
1493- The callback function should raise OptionValueError if there are any problems
1493+ The callback function should raise :exc: ` OptionValueError ` if there are any problems
14941494with the option or its argument(s). :mod: `optparse ` catches this and terminates
14951495the program, printing the error message you supply to stderr. Your message
14961496should be clear, concise, accurate, and mention the option at fault. Otherwise,
@@ -1691,9 +1691,9 @@ type-checking function will wind up in the OptionValues instance returned by
16911691:meth: `OptionParser.parse_args `, or be passed to a callback as the ``value ``
16921692parameter.
16931693
1694- Your type-checking function should raise OptionValueError if it encounters any
1695- problems. OptionValueError takes a single string argument, which is passed
1696- as-is to OptionParser's :meth: `error ` method, which in turn prepends the program
1694+ Your type-checking function should raise :exc: ` OptionValueError ` if it encounters any
1695+ problems. :exc: ` OptionValueError ` takes a single string argument, which is passed
1696+ as-is to :class: ` OptionParser ` 's :meth: `error ` method, which in turn prepends the program
16971697name and the string ``"error:" `` and prints everything to stderr before
16981698terminating the process.
16991699
0 commit comments