Skip to content

Commit 8394368

Browse files
authored
[3.11] Docs: Avoid the deprecated .. cmdoption:: directive (GH-110292) (#110303)
[3.11] Docs: Avoid the deprecated ``.. cmdoption::`` directive (GH-110292). (cherry picked from commit 77e9aae)
1 parent 6a6081f commit 8394368

17 files changed

+195
-195
lines changed

Doc/library/ast.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2337,26 +2337,26 @@ The following options are accepted:
23372337

23382338
.. program:: ast
23392339

2340-
.. cmdoption:: -h, --help
2340+
.. option:: -h, --help
23412341

23422342
Show the help message and exit.
23432343

2344-
.. cmdoption:: -m <mode>
2345-
--mode <mode>
2344+
.. option:: -m <mode>
2345+
--mode <mode>
23462346

23472347
Specify what kind of code must be compiled, like the *mode* argument
23482348
in :func:`parse`.
23492349

2350-
.. cmdoption:: --no-type-comments
2350+
.. option:: --no-type-comments
23512351

23522352
Don't parse type comments.
23532353

2354-
.. cmdoption:: -a, --include-attributes
2354+
.. option:: -a, --include-attributes
23552355

23562356
Include attributes such as line numbers and column offsets.
23572357

2358-
.. cmdoption:: -i <indent>
2359-
--indent <indent>
2358+
.. option:: -i <indent>
2359+
--indent <indent>
23602360

23612361
Indentation of nodes in AST (number of spaces).
23622362

Doc/library/compileall.rst

Lines changed: 17 additions & 17 deletions
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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -262,23 +262,23 @@ Once executed the :mod:`gzip` module keeps the input file(s).
262262
Command line options
263263
^^^^^^^^^^^^^^^^^^^^
264264

265-
.. cmdoption:: file
265+
.. option:: file
266266

267267
If *file* is not specified, read from :data:`sys.stdin`.
268268

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

271271
Indicates the fastest compression method (less compression).
272272

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

275275
Indicates the slowest compression method (best compression).
276276

277-
.. cmdoption:: -d, --decompress
277+
.. option:: -d, --decompress
278278

279279
Decompress the given file.
280280

281-
.. cmdoption:: -h, --help
281+
.. option:: -h, --help
282282

283283
Show the help message.
284284

Doc/library/inspect.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1570,6 +1570,6 @@ By default, accepts the name of a module and prints the source of that
15701570
module. A class or function within the module can be printed instead by
15711571
appended a colon and the qualified name of the target object.
15721572

1573-
.. cmdoption:: --details
1573+
.. option:: --details
15741574

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

Doc/library/json.rst

Lines changed: 7 additions & 7 deletions
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

Lines changed: 5 additions & 5 deletions
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

Lines changed: 3 additions & 3 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,31 +1149,31 @@ For a list of the files in a tar archive, use the :option:`-l` option:
11491149
Command-line options
11501150
~~~~~~~~~~~~~~~~~~~~
11511151

1152-
.. cmdoption:: -l <tarfile>
1153-
--list <tarfile>
1152+
.. option:: -l <tarfile>
1153+
--list <tarfile>
11541154

11551155
List files in a tarfile.
11561156

1157-
.. cmdoption:: -c <tarfile> <source1> ... <sourceN>
1158-
--create <tarfile> <source1> ... <sourceN>
1157+
.. option:: -c <tarfile> <source1> ... <sourceN>
1158+
--create <tarfile> <source1> ... <sourceN>
11591159

11601160
Create tarfile from source files.
11611161

1162-
.. cmdoption:: -e <tarfile> [<output_dir>]
1163-
--extract <tarfile> [<output_dir>]
1162+
.. option:: -e <tarfile> [<output_dir>]
1163+
--extract <tarfile> [<output_dir>]
11641164

11651165
Extract tarfile into the current directory if *output_dir* is not specified.
11661166

1167-
.. cmdoption:: -t <tarfile>
1168-
--test <tarfile>
1167+
.. option:: -t <tarfile>
1168+
--test <tarfile>
11691169

11701170
Test whether the tarfile is valid or not.
11711171

1172-
.. cmdoption:: -v, --verbose
1172+
.. option:: -v, --verbose
11731173

11741174
Verbose output.
11751175

1176-
.. cmdoption:: --filter <filtername>
1176+
.. option:: --filter <filtername>
11771177

11781178
Specifies the *filter* for ``--extract``.
11791179
See :ref:`tarfile-extraction-filter` for details.

Doc/library/timeit.rst

Lines changed: 7 additions & 7 deletions
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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,11 @@ The following options are accepted:
171171

172172
.. program:: tokenize
173173

174-
.. cmdoption:: -h, --help
174+
.. option:: -h, --help
175175

176176
show this help message and exit
177177

178-
.. cmdoption:: -e, --exact
178+
.. option:: -e, --exact
179179

180180
display token names using the exact type
181181

0 commit comments

Comments
 (0)