Skip to content

Commit 4c0f42b

Browse files
authored
[3.12] Docs: Avoid the deprecated .. cmdoption:: directive (GH-110292) (#110302)
[3.12] Docs: Avoid the deprecated ``.. cmdoption::`` directive (GH-110292). (cherry picked from commit 77e9aae)
1 parent 90dea55 commit 4c0f42b

18 files changed

+203
-203
lines changed

Doc/library/ast.rst

+7-7
Original file line numberDiff line numberDiff line change
@@ -2477,26 +2477,26 @@ The following options are accepted:
24772477

24782478
.. program:: ast
24792479

2480-
.. cmdoption:: -h, --help
2480+
.. option:: -h, --help
24812481

24822482
Show the help message and exit.
24832483

2484-
.. cmdoption:: -m <mode>
2485-
--mode <mode>
2484+
.. option:: -m <mode>
2485+
--mode <mode>
24862486

24872487
Specify what kind of code must be compiled, like the *mode* argument
24882488
in :func:`parse`.
24892489

2490-
.. cmdoption:: --no-type-comments
2490+
.. option:: --no-type-comments
24912491

24922492
Don't parse type comments.
24932493

2494-
.. cmdoption:: -a, --include-attributes
2494+
.. option:: -a, --include-attributes
24952495

24962496
Include attributes such as line numbers and column offsets.
24972497

2498-
.. cmdoption:: -i <indent>
2499-
--indent <indent>
2498+
.. option:: -i <indent>
2499+
--indent <indent>
25002500

25012501
Indentation of nodes in AST (number of spaces).
25022502

Doc/library/compileall.rst

+17-17
Original file line numberDiff line numberDiff line change
@@ -24,74 +24,74 @@ compile Python sources.
2424

2525
.. program:: compileall
2626

27-
.. cmdoption:: directory ...
28-
file ...
27+
.. option:: directory ...
28+
file ...
2929

3030
Positional arguments are files to compile or directories that contain
3131
source files, traversed recursively. If no argument is given, behave as if
3232
the command line was :samp:`-l {<directories from sys.path>}`.
3333

34-
.. cmdoption:: -l
34+
.. option:: -l
3535

3636
Do not recurse into subdirectories, only compile source code files directly
3737
contained in the named or implied directories.
3838

39-
.. cmdoption:: -f
39+
.. option:: -f
4040

4141
Force rebuild even if timestamps are up-to-date.
4242

43-
.. cmdoption:: -q
43+
.. option:: -q
4444

4545
Do not print the list of files compiled. If passed once, error messages will
4646
still be printed. If passed twice (``-qq``), all output is suppressed.
4747

48-
.. cmdoption:: -d destdir
48+
.. option:: -d destdir
4949

5050
Directory prepended to the path to each file being compiled. This will
5151
appear in compilation time tracebacks, and is also compiled in to the
5252
byte-code file, where it will be used in tracebacks and other messages in
5353
cases where the source file does not exist at the time the byte-code file is
5454
executed.
5555

56-
.. cmdoption:: -s strip_prefix
57-
.. cmdoption:: -p prepend_prefix
56+
.. option:: -s strip_prefix
57+
.. option:: -p prepend_prefix
5858

5959
Remove (``-s``) or append (``-p``) the given prefix of paths
6060
recorded in the ``.pyc`` files.
6161
Cannot be combined with ``-d``.
6262

63-
.. cmdoption:: -x regex
63+
.. option:: -x regex
6464

6565
regex is used to search the full path to each file considered for
6666
compilation, and if the regex produces a match, the file is skipped.
6767

68-
.. cmdoption:: -i list
68+
.. option:: -i list
6969

7070
Read the file ``list`` and add each line that it contains to the list of
7171
files and directories to compile. If ``list`` is ``-``, read lines from
7272
``stdin``.
7373

74-
.. cmdoption:: -b
74+
.. option:: -b
7575

7676
Write the byte-code files to their legacy locations and names, which may
7777
overwrite byte-code files created by another version of Python. The default
7878
is to write files to their :pep:`3147` locations and names, which allows
7979
byte-code files from multiple versions of Python to coexist.
8080

81-
.. cmdoption:: -r
81+
.. option:: -r
8282

8383
Control the maximum recursion level for subdirectories.
8484
If this is given, then ``-l`` option will not be taken into account.
8585
:program:`python -m compileall <directory> -r 0` is equivalent to
8686
:program:`python -m compileall <directory> -l`.
8787

88-
.. cmdoption:: -j N
88+
.. option:: -j N
8989

9090
Use *N* workers to compile the files within the given directory.
9191
If ``0`` is used, then the result of :func:`os.cpu_count()`
9292
will be used.
9393

94-
.. cmdoption:: --invalidation-mode [timestamp|checked-hash|unchecked-hash]
94+
.. option:: --invalidation-mode [timestamp|checked-hash|unchecked-hash]
9595

9696
Control how the generated byte-code files are invalidated at runtime.
9797
The ``timestamp`` value, means that ``.pyc`` files with the source timestamp
@@ -104,17 +104,17 @@ compile Python sources.
104104
variable is not set, and ``checked-hash`` if the ``SOURCE_DATE_EPOCH``
105105
environment variable is set.
106106

107-
.. cmdoption:: -o level
107+
.. option:: -o level
108108

109109
Compile with the given optimization level. May be used multiple times
110110
to compile for multiple levels at a time (for example,
111111
``compileall -o 1 -o 2``).
112112

113-
.. cmdoption:: -e dir
113+
.. option:: -e dir
114114

115115
Ignore symlinks pointing outside the given directory.
116116

117-
.. cmdoption:: --hardlink-dupes
117+
.. option:: --hardlink-dupes
118118

119119
If two ``.pyc`` files with different optimization level have
120120
the same content, use hard links to consolidate duplicate files.

Doc/library/gzip.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -266,23 +266,23 @@ Once executed the :mod:`gzip` module keeps the input file(s).
266266
Command line options
267267
^^^^^^^^^^^^^^^^^^^^
268268

269-
.. cmdoption:: file
269+
.. option:: file
270270

271271
If *file* is not specified, read from :data:`sys.stdin`.
272272

273-
.. cmdoption:: --fast
273+
.. option:: --fast
274274

275275
Indicates the fastest compression method (less compression).
276276

277-
.. cmdoption:: --best
277+
.. option:: --best
278278

279279
Indicates the slowest compression method (best compression).
280280

281-
.. cmdoption:: -d, --decompress
281+
.. option:: -d, --decompress
282282

283283
Decompress the given file.
284284

285-
.. cmdoption:: -h, --help
285+
.. option:: -h, --help
286286

287287
Show the help message.
288288

Doc/library/inspect.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1650,6 +1650,6 @@ By default, accepts the name of a module and prints the source of that
16501650
module. A class or function within the module can be printed instead by
16511651
appended a colon and the qualified name of the target object.
16521652

1653-
.. cmdoption:: --details
1653+
.. option:: --details
16541654

16551655
Print information about the specified object rather than the source code

Doc/library/json.rst

+7-7
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ specified, :data:`sys.stdin` and :data:`sys.stdout` will be used respectively:
703703
Command line options
704704
^^^^^^^^^^^^^^^^^^^^
705705

706-
.. cmdoption:: infile
706+
.. option:: infile
707707

708708
The JSON file to be validated or pretty-printed:
709709

@@ -723,36 +723,36 @@ Command line options
723723
724724
If *infile* is not specified, read from :data:`sys.stdin`.
725725

726-
.. cmdoption:: outfile
726+
.. option:: outfile
727727

728728
Write the output of the *infile* to the given *outfile*. Otherwise, write it
729729
to :data:`sys.stdout`.
730730

731-
.. cmdoption:: --sort-keys
731+
.. option:: --sort-keys
732732

733733
Sort the output of dictionaries alphabetically by key.
734734

735735
.. versionadded:: 3.5
736736

737-
.. cmdoption:: --no-ensure-ascii
737+
.. option:: --no-ensure-ascii
738738

739739
Disable escaping of non-ascii characters, see :func:`json.dumps` for more information.
740740

741741
.. versionadded:: 3.9
742742

743-
.. cmdoption:: --json-lines
743+
.. option:: --json-lines
744744

745745
Parse every input line as separate JSON object.
746746

747747
.. versionadded:: 3.8
748748

749-
.. cmdoption:: --indent, --tab, --no-indent, --compact
749+
.. option:: --indent, --tab, --no-indent, --compact
750750

751751
Mutually exclusive options for whitespace control.
752752

753753
.. versionadded:: 3.9
754754

755-
.. cmdoption:: -h, --help
755+
.. option:: -h, --help
756756

757757
Show the help message.
758758

Doc/library/pickletools.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -51,24 +51,24 @@ Command line options
5151

5252
.. program:: pickletools
5353

54-
.. cmdoption:: -a, --annotate
54+
.. option:: -a, --annotate
5555

5656
Annotate each line with a short opcode description.
5757

58-
.. cmdoption:: -o, --output=<file>
58+
.. option:: -o, --output=<file>
5959

6060
Name of a file where the output should be written.
6161

62-
.. cmdoption:: -l, --indentlevel=<num>
62+
.. option:: -l, --indentlevel=<num>
6363

6464
The number of blanks by which to indent a new MARK level.
6565

66-
.. cmdoption:: -m, --memo
66+
.. option:: -m, --memo
6767

6868
When multiple objects are disassembled, preserve memo between
6969
disassemblies.
7070

71-
.. cmdoption:: -p, --preamble=<preamble>
71+
.. option:: -p, --preamble=<preamble>
7272

7373
When more than one pickle file are specified, print given preamble
7474
before each disassembly.

Doc/library/py_compile.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,13 @@ not be compiled.
138138

139139
.. program:: python -m py_compile
140140

141-
.. cmdoption:: <file> ... <fileN>
142-
-
141+
.. option:: <file> ... <fileN>
142+
-
143143

144144
Positional arguments are files to compile. If ``-`` is the only
145145
parameter, the list of files is taken from standard input.
146146

147-
.. cmdoption:: -q, --quiet
147+
.. option:: -q, --quiet
148148

149149
Suppress errors output.
150150

Doc/library/site.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -266,11 +266,11 @@ If it is called without arguments, it will print the contents of
266266
:data:`USER_BASE` and whether the directory exists, then the same thing for
267267
:data:`USER_SITE`, and finally the value of :data:`ENABLE_USER_SITE`.
268268

269-
.. cmdoption:: --user-base
269+
.. option:: --user-base
270270

271271
Print the path to the user base directory.
272272

273-
.. cmdoption:: --user-site
273+
.. option:: --user-site
274274

275275
Print the path to the user site-packages directory.
276276

Doc/library/tarfile.rst

+10-10
Original file line numberDiff line numberDiff line change
@@ -1151,31 +1151,31 @@ For a list of the files in a tar archive, use the :option:`-l` option:
11511151
Command-line options
11521152
~~~~~~~~~~~~~~~~~~~~
11531153

1154-
.. cmdoption:: -l <tarfile>
1155-
--list <tarfile>
1154+
.. option:: -l <tarfile>
1155+
--list <tarfile>
11561156

11571157
List files in a tarfile.
11581158

1159-
.. cmdoption:: -c <tarfile> <source1> ... <sourceN>
1160-
--create <tarfile> <source1> ... <sourceN>
1159+
.. option:: -c <tarfile> <source1> ... <sourceN>
1160+
--create <tarfile> <source1> ... <sourceN>
11611161

11621162
Create tarfile from source files.
11631163

1164-
.. cmdoption:: -e <tarfile> [<output_dir>]
1165-
--extract <tarfile> [<output_dir>]
1164+
.. option:: -e <tarfile> [<output_dir>]
1165+
--extract <tarfile> [<output_dir>]
11661166

11671167
Extract tarfile into the current directory if *output_dir* is not specified.
11681168

1169-
.. cmdoption:: -t <tarfile>
1170-
--test <tarfile>
1169+
.. option:: -t <tarfile>
1170+
--test <tarfile>
11711171

11721172
Test whether the tarfile is valid or not.
11731173

1174-
.. cmdoption:: -v, --verbose
1174+
.. option:: -v, --verbose
11751175

11761176
Verbose output.
11771177

1178-
.. cmdoption:: --filter <filtername>
1178+
.. option:: --filter <filtername>
11791179

11801180
Specifies the *filter* for ``--extract``.
11811181
See :ref:`tarfile-extraction-filter` for details.

Doc/library/timeit.rst

+7-7
Original file line numberDiff line numberDiff line change
@@ -214,36 +214,36 @@ Where the following options are understood:
214214

215215
.. program:: timeit
216216

217-
.. cmdoption:: -n N, --number=N
217+
.. option:: -n N, --number=N
218218

219219
how many times to execute 'statement'
220220

221-
.. cmdoption:: -r N, --repeat=N
221+
.. option:: -r N, --repeat=N
222222

223223
how many times to repeat the timer (default 5)
224224

225-
.. cmdoption:: -s S, --setup=S
225+
.. option:: -s S, --setup=S
226226

227227
statement to be executed once initially (default ``pass``)
228228

229-
.. cmdoption:: -p, --process
229+
.. option:: -p, --process
230230

231231
measure process time, not wallclock time, using :func:`time.process_time`
232232
instead of :func:`time.perf_counter`, which is the default
233233

234234
.. versionadded:: 3.3
235235

236-
.. cmdoption:: -u, --unit=U
236+
.. option:: -u, --unit=U
237237

238238
specify a time unit for timer output; can select ``nsec``, ``usec``, ``msec``, or ``sec``
239239

240240
.. versionadded:: 3.5
241241

242-
.. cmdoption:: -v, --verbose
242+
.. option:: -v, --verbose
243243

244244
print raw timing results; repeat for more digits precision
245245

246-
.. cmdoption:: -h, --help
246+
.. option:: -h, --help
247247

248248
print a short usage message and exit
249249

Doc/library/tokenize.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,11 @@ The following options are accepted:
166166

167167
.. program:: tokenize
168168

169-
.. cmdoption:: -h, --help
169+
.. option:: -h, --help
170170

171171
show this help message and exit
172172

173-
.. cmdoption:: -e, --exact
173+
.. option:: -e, --exact
174174

175175
display token names using the exact type
176176

0 commit comments

Comments
 (0)