Issue #23921: Standardized documentation whitespace formatting.
Original patch by James Edwards.
diff --git a/Doc/library/optparse.rst b/Doc/library/optparse.rst
index 417b3bb..dfb43a1 100644
--- a/Doc/library/optparse.rst
+++ b/Doc/library/optparse.rst
@@ -27,7 +27,7 @@
Here's an example of using :mod:`optparse` in a simple script::
from optparse import OptionParser
- [...]
+ ...
parser = OptionParser()
parser.add_option("-f", "--file", dest="filename",
help="write report to FILE", metavar="FILE")
@@ -254,7 +254,7 @@
program, create an OptionParser instance::
from optparse import OptionParser
- [...]
+ ...
parser = OptionParser()
Then you can start defining options. The basic syntax is::
@@ -721,7 +721,7 @@
condition::
(options, args) = parser.parse_args()
- [...]
+ ...
if options.a and options.b:
parser.error("options -a and -b are mutually exclusive")
@@ -761,7 +761,7 @@
Here's what :mod:`optparse`\ -based scripts usually look like::
from optparse import OptionParser
- [...]
+ ...
def main():
usage = "usage: %prog [options] arg"
parser = OptionParser(usage)
@@ -771,13 +771,13 @@
action="store_true", dest="verbose")
parser.add_option("-q", "--quiet",
action="store_false", dest="verbose")
- [...]
+ ...
(options, args) = parser.parse_args()
if len(args) != 1:
parser.error("incorrect number of arguments")
if options.verbose:
print "reading %s..." % options.filename
- [...]
+ ...
if __name__ == "__main__":
main()
@@ -1412,7 +1412,7 @@
strings::
parser.add_option("-n", "--dry-run", ...)
- [...]
+ ...
parser.add_option("-n", "--noisy", ...)
(This is particularly true if you've defined your own OptionParser subclass with
@@ -1453,7 +1453,7 @@
Options:
--dry-run do no harm
- [...]
+ ...
-n, --noisy be noisy
It's possible to whittle away the option strings for a previously-added option
@@ -1468,7 +1468,7 @@
accessible, so :mod:`optparse` removes it, leaving this help text::
Options:
- [...]
+ ...
-n, --noisy be noisy
--dry-run new dry-run option
@@ -1704,7 +1704,7 @@
if parser.values.b:
raise OptionValueError("can't use -a after -b")
parser.values.a = 1
- [...]
+ ...
parser.add_option("-a", action="callback", callback=check_order)
parser.add_option("-b", action="store_true", dest="b")
@@ -1722,7 +1722,7 @@
if parser.values.b:
raise OptionValueError("can't use %s after -b" % opt_str)
setattr(parser.values, option.dest, 1)
- [...]
+ ...
parser.add_option("-a", action="callback", callback=check_order, dest='a')
parser.add_option("-b", action="store_true", dest="b")
parser.add_option("-c", action="callback", callback=check_order, dest='c')
@@ -1742,7 +1742,7 @@
raise OptionValueError("%s option invalid when moon is full"
% opt_str)
setattr(parser.values, option.dest, 1)
- [...]
+ ...
parser.add_option("--foo",
action="callback", callback=check_moon, dest="foo")
@@ -1765,7 +1765,7 @@
def store_value(option, opt_str, value, parser):
setattr(parser.values, option.dest, value)
- [...]
+ ...
parser.add_option("--foo",
action="callback", callback=store_value,
type="int", nargs=3, dest="foo")
@@ -1827,9 +1827,9 @@
del parser.rargs[:len(value)]
setattr(parser.values, option.dest, value)
- [...]
- parser.add_option("-c", "--callback", dest="vararg_attr",
- action="callback", callback=vararg_callback)
+ ...
+ parser.add_option("-c", "--callback", dest="vararg_attr",
+ action="callback", callback=vararg_callback)
.. _optparse-extending-optparse: