Skip to content

Commit 523caa5

Browse files
committed
gh-126031: Mark argparse constructor parameter headings as code
1 parent 7159b15 commit 523caa5

1 file changed

Lines changed: 30 additions & 30 deletions

File tree

‎Doc/library/argparse.rst‎

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ The following sections describe how each of these are used.
139139

140140
.. _prog:
141141

142-
prog
143-
^^^^
142+
``prog``
143+
^^^^^^^^
144144

145145

146146
By default, :class:`ArgumentParser` calculates the name of the program
@@ -185,8 +185,8 @@ specifier.
185185
The default ``prog`` value now reflects how ``__main__`` was actually executed,
186186
rather than always being ``os.path.basename(sys.argv[0])``.
187187

188-
usage
189-
^^^^^
188+
``usage``
189+
^^^^^^^^^
190190

191191
By default, :class:`ArgumentParser` calculates the usage message from the
192192
arguments it contains. The default message can be overridden with the
@@ -217,8 +217,8 @@ usage information across subparsers.
217217

218218
.. _description:
219219

220-
description
221-
^^^^^^^^^^^
220+
``description``
221+
^^^^^^^^^^^^^^^
222222

223223
Most calls to the :class:`ArgumentParser` constructor will use the
224224
``description=`` keyword argument. This argument gives a brief description of
@@ -230,8 +230,8 @@ By default, the description will be line-wrapped so that it fits within the
230230
given space. To change this behavior, see the formatter_class_ argument.
231231

232232

233-
epilog
234-
^^^^^^
233+
``epilog``
234+
^^^^^^^^^^
235235

236236
Some programs like to display additional description of the program after the
237237
description of the arguments. Such text can be specified using the ``epilog=``
@@ -255,8 +255,8 @@ line-wrapped, but this behavior can be adjusted with the formatter_class_
255255
argument to :class:`ArgumentParser`.
256256

257257

258-
parents
259-
^^^^^^^
258+
``parents``
259+
^^^^^^^^^^^
260260

261261
Sometimes, several parsers share a common set of arguments. Rather than
262262
repeating the definitions of these arguments, a single parser with all the
@@ -290,8 +290,8 @@ and one in the child) and raise an error.
290290

291291
.. _formatter_class:
292292

293-
formatter_class
294-
^^^^^^^^^^^^^^^
293+
``formatter_class``
294+
^^^^^^^^^^^^^^^^^^^
295295

296296
:class:`ArgumentParser` objects allow the help formatting to be customized by
297297
specifying an alternate formatting class. Currently, there are four such
@@ -396,8 +396,8 @@ as the regular formatter does)::
396396
--foo int
397397

398398

399-
prefix_chars
400-
^^^^^^^^^^^^
399+
``prefix_chars``
400+
^^^^^^^^^^^^^^^^
401401

402402
Most command-line options will use ``-`` as the prefix, e.g. ``-f/--foo``.
403403
Parsers that need to support different or additional prefix
@@ -416,8 +416,8 @@ characters that does not include ``-`` will cause ``-f/--foo`` options to be
416416
disallowed.
417417

418418

419-
fromfile_prefix_chars
420-
^^^^^^^^^^^^^^^^^^^^^
419+
``fromfile_prefix_chars``
420+
^^^^^^^^^^^^^^^^^^^^^^^^^
421421

422422
Sometimes, when dealing with a particularly long argument list, it
423423
may make sense to keep the list of arguments in a file rather than typing it out
@@ -458,8 +458,8 @@ arguments will never be treated as file references.
458458
Arguments file should be encoded in UTF-8 instead of ANSI Codepage on Windows.
459459

460460

461-
argument_default
462-
^^^^^^^^^^^^^^^^
461+
``argument_default``
462+
^^^^^^^^^^^^^^^^^^^^
463463

464464
Generally, argument defaults are specified either by passing a default to
465465
:meth:`~ArgumentParser.add_argument` or by calling the
@@ -480,8 +480,8 @@ calls, we supply ``argument_default=SUPPRESS``::
480480

481481
.. _allow_abbrev:
482482

483-
allow_abbrev
484-
^^^^^^^^^^^^
483+
``allow_abbrev``
484+
^^^^^^^^^^^^^^^^
485485

486486
Normally, when you pass an argument list to the
487487
:meth:`~ArgumentParser.parse_args` method of an :class:`ArgumentParser`,
@@ -499,8 +499,8 @@ This feature can be disabled by setting ``allow_abbrev`` to ``False``::
499499
.. versionadded:: 3.5
500500

501501

502-
conflict_handler
503-
^^^^^^^^^^^^^^^^
502+
``conflict_handler``
503+
^^^^^^^^^^^^^^^^^^^^
504504

505505
:class:`ArgumentParser` objects do not allow two actions with the same option
506506
string. By default, :class:`ArgumentParser` objects raise an exception if an
@@ -536,8 +536,8 @@ action is retained as the ``-f`` action, because only the ``--foo`` option
536536
string was overridden.
537537

538538

539-
add_help
540-
^^^^^^^^
539+
``add_help``
540+
^^^^^^^^^^^^
541541

542542
By default, :class:`ArgumentParser` objects add an option which simply displays
543543
the parser's help message. If ``-h`` or ``--help`` is supplied at the command
@@ -569,8 +569,8 @@ the help options::
569569
+h, ++help show this help message and exit
570570

571571

572-
exit_on_error
573-
^^^^^^^^^^^^^
572+
``exit_on_error``
573+
^^^^^^^^^^^^^^^^^
574574

575575
Normally, when you pass an invalid argument list to the :meth:`~ArgumentParser.parse_args`
576576
method of an :class:`ArgumentParser`, it will print a *message* to :data:`sys.stderr` and exit with a status
@@ -591,8 +591,8 @@ If the user would like to catch errors manually, the feature can be enabled by s
591591

592592
.. versionadded:: 3.9
593593

594-
suggest_on_error
595-
^^^^^^^^^^^^^^^^
594+
``suggest_on_error``
595+
^^^^^^^^^^^^^^^^^^^^
596596

597597
By default, when a user passes an invalid argument choice or subparser name,
598598
:class:`ArgumentParser` will exit with error info and provide suggestions for
@@ -613,8 +613,8 @@ You can disable suggestions by setting ``suggest_on_error`` to ``False``.
613613
.. versionchanged:: 3.15
614614
Changed default value of ``suggest_on_error`` from ``False`` to ``True``.
615615

616-
color
617-
^^^^^
616+
``color``
617+
^^^^^^^^^
618618

619619
By default, the help message is printed in color using `ANSI escape sequences
620620
<https://en.wikipedia.org/wiki/ANSI_escape_code>`__.

0 commit comments

Comments
 (0)