[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 77e9aae383)
This commit is contained in:
Adam Turner 2023-10-03 18:55:29 +01:00 committed by GitHub
parent 90dea557bb
commit 4c0f42bbc6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 203 additions and 203 deletions

View file

@ -2477,26 +2477,26 @@ The following options are accepted:
.. program:: ast
.. cmdoption:: -h, --help
.. option:: -h, --help
Show the help message and exit.
.. cmdoption:: -m <mode>
--mode <mode>
.. option:: -m <mode>
--mode <mode>
Specify what kind of code must be compiled, like the *mode* argument
in :func:`parse`.
.. cmdoption:: --no-type-comments
.. option:: --no-type-comments
Don't parse type comments.
.. cmdoption:: -a, --include-attributes
.. option:: -a, --include-attributes
Include attributes such as line numbers and column offsets.
.. cmdoption:: -i <indent>
--indent <indent>
.. option:: -i <indent>
--indent <indent>
Indentation of nodes in AST (number of spaces).

View file

@ -24,28 +24,28 @@ compile Python sources.
.. program:: compileall
.. cmdoption:: directory ...
file ...
.. option:: directory ...
file ...
Positional arguments are files to compile or directories that contain
source files, traversed recursively. If no argument is given, behave as if
the command line was :samp:`-l {<directories from sys.path>}`.
.. cmdoption:: -l
.. option:: -l
Do not recurse into subdirectories, only compile source code files directly
contained in the named or implied directories.
.. cmdoption:: -f
.. option:: -f
Force rebuild even if timestamps are up-to-date.
.. cmdoption:: -q
.. option:: -q
Do not print the list of files compiled. If passed once, error messages will
still be printed. If passed twice (``-qq``), all output is suppressed.
.. cmdoption:: -d destdir
.. option:: -d destdir
Directory prepended to the path to each file being compiled. This will
appear in compilation time tracebacks, and is also compiled in to the
@ -53,45 +53,45 @@ compile Python sources.
cases where the source file does not exist at the time the byte-code file is
executed.
.. cmdoption:: -s strip_prefix
.. cmdoption:: -p prepend_prefix
.. option:: -s strip_prefix
.. option:: -p prepend_prefix
Remove (``-s``) or append (``-p``) the given prefix of paths
recorded in the ``.pyc`` files.
Cannot be combined with ``-d``.
.. cmdoption:: -x regex
.. option:: -x regex
regex is used to search the full path to each file considered for
compilation, and if the regex produces a match, the file is skipped.
.. cmdoption:: -i list
.. option:: -i list
Read the file ``list`` and add each line that it contains to the list of
files and directories to compile. If ``list`` is ``-``, read lines from
``stdin``.
.. cmdoption:: -b
.. option:: -b
Write the byte-code files to their legacy locations and names, which may
overwrite byte-code files created by another version of Python. The default
is to write files to their :pep:`3147` locations and names, which allows
byte-code files from multiple versions of Python to coexist.
.. cmdoption:: -r
.. option:: -r
Control the maximum recursion level for subdirectories.
If this is given, then ``-l`` option will not be taken into account.
:program:`python -m compileall <directory> -r 0` is equivalent to
:program:`python -m compileall <directory> -l`.
.. cmdoption:: -j N
.. option:: -j N
Use *N* workers to compile the files within the given directory.
If ``0`` is used, then the result of :func:`os.cpu_count()`
will be used.
.. cmdoption:: --invalidation-mode [timestamp|checked-hash|unchecked-hash]
.. option:: --invalidation-mode [timestamp|checked-hash|unchecked-hash]
Control how the generated byte-code files are invalidated at runtime.
The ``timestamp`` value, means that ``.pyc`` files with the source timestamp
@ -104,17 +104,17 @@ compile Python sources.
variable is not set, and ``checked-hash`` if the ``SOURCE_DATE_EPOCH``
environment variable is set.
.. cmdoption:: -o level
.. option:: -o level
Compile with the given optimization level. May be used multiple times
to compile for multiple levels at a time (for example,
``compileall -o 1 -o 2``).
.. cmdoption:: -e dir
.. option:: -e dir
Ignore symlinks pointing outside the given directory.
.. cmdoption:: --hardlink-dupes
.. option:: --hardlink-dupes
If two ``.pyc`` files with different optimization level have
the same content, use hard links to consolidate duplicate files.

View file

@ -266,23 +266,23 @@ Once executed the :mod:`gzip` module keeps the input file(s).
Command line options
^^^^^^^^^^^^^^^^^^^^
.. cmdoption:: file
.. option:: file
If *file* is not specified, read from :data:`sys.stdin`.
.. cmdoption:: --fast
.. option:: --fast
Indicates the fastest compression method (less compression).
.. cmdoption:: --best
.. option:: --best
Indicates the slowest compression method (best compression).
.. cmdoption:: -d, --decompress
.. option:: -d, --decompress
Decompress the given file.
.. cmdoption:: -h, --help
.. option:: -h, --help
Show the help message.

View file

@ -1650,6 +1650,6 @@ By default, accepts the name of a module and prints the source of that
module. A class or function within the module can be printed instead by
appended a colon and the qualified name of the target object.
.. cmdoption:: --details
.. option:: --details
Print information about the specified object rather than the source code

View file

@ -703,7 +703,7 @@ specified, :data:`sys.stdin` and :data:`sys.stdout` will be used respectively:
Command line options
^^^^^^^^^^^^^^^^^^^^
.. cmdoption:: infile
.. option:: infile
The JSON file to be validated or pretty-printed:
@ -723,36 +723,36 @@ Command line options
If *infile* is not specified, read from :data:`sys.stdin`.
.. cmdoption:: outfile
.. option:: outfile
Write the output of the *infile* to the given *outfile*. Otherwise, write it
to :data:`sys.stdout`.
.. cmdoption:: --sort-keys
.. option:: --sort-keys
Sort the output of dictionaries alphabetically by key.
.. versionadded:: 3.5
.. cmdoption:: --no-ensure-ascii
.. option:: --no-ensure-ascii
Disable escaping of non-ascii characters, see :func:`json.dumps` for more information.
.. versionadded:: 3.9
.. cmdoption:: --json-lines
.. option:: --json-lines
Parse every input line as separate JSON object.
.. versionadded:: 3.8
.. cmdoption:: --indent, --tab, --no-indent, --compact
.. option:: --indent, --tab, --no-indent, --compact
Mutually exclusive options for whitespace control.
.. versionadded:: 3.9
.. cmdoption:: -h, --help
.. option:: -h, --help
Show the help message.

View file

@ -51,24 +51,24 @@ Command line options
.. program:: pickletools
.. cmdoption:: -a, --annotate
.. option:: -a, --annotate
Annotate each line with a short opcode description.
.. cmdoption:: -o, --output=<file>
.. option:: -o, --output=<file>
Name of a file where the output should be written.
.. cmdoption:: -l, --indentlevel=<num>
.. option:: -l, --indentlevel=<num>
The number of blanks by which to indent a new MARK level.
.. cmdoption:: -m, --memo
.. option:: -m, --memo
When multiple objects are disassembled, preserve memo between
disassemblies.
.. cmdoption:: -p, --preamble=<preamble>
.. option:: -p, --preamble=<preamble>
When more than one pickle file are specified, print given preamble
before each disassembly.

View file

@ -138,13 +138,13 @@ not be compiled.
.. program:: python -m py_compile
.. cmdoption:: <file> ... <fileN>
-
.. option:: <file> ... <fileN>
-
Positional arguments are files to compile. If ``-`` is the only
parameter, the list of files is taken from standard input.
.. cmdoption:: -q, --quiet
.. option:: -q, --quiet
Suppress errors output.

View file

@ -266,11 +266,11 @@ If it is called without arguments, it will print the contents of
:data:`USER_BASE` and whether the directory exists, then the same thing for
:data:`USER_SITE`, and finally the value of :data:`ENABLE_USER_SITE`.
.. cmdoption:: --user-base
.. option:: --user-base
Print the path to the user base directory.
.. cmdoption:: --user-site
.. option:: --user-site
Print the path to the user site-packages directory.

View file

@ -1151,31 +1151,31 @@ For a list of the files in a tar archive, use the :option:`-l` option:
Command-line options
~~~~~~~~~~~~~~~~~~~~
.. cmdoption:: -l <tarfile>
--list <tarfile>
.. option:: -l <tarfile>
--list <tarfile>
List files in a tarfile.
.. cmdoption:: -c <tarfile> <source1> ... <sourceN>
--create <tarfile> <source1> ... <sourceN>
.. option:: -c <tarfile> <source1> ... <sourceN>
--create <tarfile> <source1> ... <sourceN>
Create tarfile from source files.
.. cmdoption:: -e <tarfile> [<output_dir>]
--extract <tarfile> [<output_dir>]
.. option:: -e <tarfile> [<output_dir>]
--extract <tarfile> [<output_dir>]
Extract tarfile into the current directory if *output_dir* is not specified.
.. cmdoption:: -t <tarfile>
--test <tarfile>
.. option:: -t <tarfile>
--test <tarfile>
Test whether the tarfile is valid or not.
.. cmdoption:: -v, --verbose
.. option:: -v, --verbose
Verbose output.
.. cmdoption:: --filter <filtername>
.. option:: --filter <filtername>
Specifies the *filter* for ``--extract``.
See :ref:`tarfile-extraction-filter` for details.

View file

@ -214,36 +214,36 @@ Where the following options are understood:
.. program:: timeit
.. cmdoption:: -n N, --number=N
.. option:: -n N, --number=N
how many times to execute 'statement'
.. cmdoption:: -r N, --repeat=N
.. option:: -r N, --repeat=N
how many times to repeat the timer (default 5)
.. cmdoption:: -s S, --setup=S
.. option:: -s S, --setup=S
statement to be executed once initially (default ``pass``)
.. cmdoption:: -p, --process
.. option:: -p, --process
measure process time, not wallclock time, using :func:`time.process_time`
instead of :func:`time.perf_counter`, which is the default
.. versionadded:: 3.3
.. cmdoption:: -u, --unit=U
.. option:: -u, --unit=U
specify a time unit for timer output; can select ``nsec``, ``usec``, ``msec``, or ``sec``
.. versionadded:: 3.5
.. cmdoption:: -v, --verbose
.. option:: -v, --verbose
print raw timing results; repeat for more digits precision
.. cmdoption:: -h, --help
.. option:: -h, --help
print a short usage message and exit

View file

@ -166,11 +166,11 @@ The following options are accepted:
.. program:: tokenize
.. cmdoption:: -h, --help
.. option:: -h, --help
show this help message and exit
.. cmdoption:: -e, --exact
.. option:: -e, --exact
display token names using the exact type

View file

@ -34,11 +34,11 @@ all Python modules imported during the execution into the current directory.
.. program:: trace
.. cmdoption:: --help
.. option:: --help
Display usage and exit.
.. cmdoption:: --version
.. option:: --version
Display the version of the module and exit.
@ -56,28 +56,28 @@ the :option:`--trace <-t>` and :option:`--count <-c>` options. When
.. program:: trace
.. cmdoption:: -c, --count
.. option:: -c, --count
Produce a set of annotated listing files upon program completion that shows
how many times each statement was executed. See also
:option:`--coverdir <-C>`, :option:`--file <-f>` and
:option:`--no-report <-R>` below.
.. cmdoption:: -t, --trace
.. option:: -t, --trace
Display lines as they are executed.
.. cmdoption:: -l, --listfuncs
.. option:: -l, --listfuncs
Display the functions executed by running the program.
.. cmdoption:: -r, --report
.. option:: -r, --report
Produce an annotated list from an earlier program run that used the
:option:`--count <-c>` and :option:`--file <-f>` option. This does not
execute any code.
.. cmdoption:: -T, --trackcalls
.. option:: -T, --trackcalls
Display the calling relationships exposed by running the program.
@ -86,33 +86,33 @@ Modifiers
.. program:: trace
.. cmdoption:: -f, --file=<file>
.. option:: -f, --file=<file>
Name of a file to accumulate counts over several tracing runs. Should be
used with the :option:`--count <-c>` option.
.. cmdoption:: -C, --coverdir=<dir>
.. option:: -C, --coverdir=<dir>
Directory where the report files go. The coverage report for
``package.module`` is written to file :file:`{dir}/{package}/{module}.cover`.
.. cmdoption:: -m, --missing
.. option:: -m, --missing
When generating annotated listings, mark lines which were not executed with
``>>>>>>``.
.. cmdoption:: -s, --summary
.. option:: -s, --summary
When using :option:`--count <-c>` or :option:`--report <-r>`, write a brief
summary to stdout for each file processed.
.. cmdoption:: -R, --no-report
.. option:: -R, --no-report
Do not generate annotated listings. This is useful if you intend to make
several runs with :option:`--count <-c>`, and then produce a single set of
annotated listings at the end.
.. cmdoption:: -g, --timing
.. option:: -g, --timing
Prefix each line with the time since the program started. Only used while
tracing.
@ -124,12 +124,12 @@ These options may be repeated multiple times.
.. program:: trace
.. cmdoption:: --ignore-module=<mod>
.. option:: --ignore-module=<mod>
Ignore each of the given module names and its submodules (if it is a
package). The argument can be a list of names separated by a comma.
.. cmdoption:: --ignore-dir=<dir>
.. option:: --ignore-dir=<dir>
Ignore all modules and packages in the named directory and subdirectories.
The argument can be a list of directories separated by :data:`os.pathsep`.

View file

@ -206,13 +206,13 @@ Command-line options
.. program:: unittest
.. cmdoption:: -b, --buffer
.. option:: -b, --buffer
The standard output and standard error streams are buffered during the test
run. Output during a passing test is discarded. Output is echoed normally
on test fail or error and is added to the failure messages.
.. cmdoption:: -c, --catch
.. option:: -c, --catch
:kbd:`Control-C` during the test run waits for the current test to end and then
reports all the results so far. A second :kbd:`Control-C` raises the normal
@ -220,11 +220,11 @@ Command-line options
See `Signal Handling`_ for the functions that provide this functionality.
.. cmdoption:: -f, --failfast
.. option:: -f, --failfast
Stop the test run on the first error or failure.
.. cmdoption:: -k
.. option:: -k
Only run test methods and classes that match the pattern or substring.
This option may be used multiple times, in which case all test cases that
@ -240,11 +240,11 @@ Command-line options
For example, ``-k foo`` matches ``foo_tests.SomeTest.test_something``,
``bar_tests.SomeTest.test_foo``, but not ``bar_tests.FooTest.test_something``.
.. cmdoption:: --locals
.. option:: --locals
Show local variables in tracebacks.
.. cmdoption:: --durations N
.. option:: --durations N
Show the N slowest test cases (N=0 for all).
@ -292,19 +292,19 @@ The ``discover`` sub-command has the following options:
.. program:: unittest discover
.. cmdoption:: -v, --verbose
.. option:: -v, --verbose
Verbose output
.. cmdoption:: -s, --start-directory directory
.. option:: -s, --start-directory directory
Directory to start discovery (``.`` default)
.. cmdoption:: -p, --pattern pattern
.. option:: -p, --pattern pattern
Pattern to match test files (``test*.py`` default)
.. cmdoption:: -t, --top-level-directory directory
.. option:: -t, --top-level-directory directory
Top level directory of project (defaults to start directory)

View file

@ -289,25 +289,25 @@ The following options are accepted:
.. program:: uuid
.. cmdoption:: -h, --help
.. option:: -h, --help
Show the help message and exit.
.. cmdoption:: -u <uuid>
--uuid <uuid>
.. option:: -u <uuid>
--uuid <uuid>
Specify the function name to use to generate the uuid. By default :func:`uuid4`
is used.
.. cmdoption:: -n <namespace>
--namespace <namespace>
.. option:: -n <namespace>
--namespace <namespace>
The namespace is a ``UUID``, or ``@ns`` where ``ns`` is a well-known predefined UUID
addressed by namespace name. Such as ``@dns``, ``@url``, ``@oid``, and ``@x500``.
Only required for :func:`uuid3` / :func:`uuid5` functions.
.. cmdoption:: -N <name>
--name <name>
.. option:: -N <name>
--name <name>
The name used as part of generating the uuid. Only required for
:func:`uuid3` / :func:`uuid5` functions.

View file

@ -54,7 +54,7 @@ The following options are understood:
.. program:: zipapp
.. cmdoption:: -o <output>, --output=<output>
.. option:: -o <output>, --output=<output>
Write the output to a file named *output*. If this option is not specified,
the output filename will be the same as the input *source*, with the
@ -64,13 +64,13 @@ The following options are understood:
An output filename must be specified if the *source* is an archive (and in
that case, *output* must not be the same as *source*).
.. cmdoption:: -p <interpreter>, --python=<interpreter>
.. option:: -p <interpreter>, --python=<interpreter>
Add a ``#!`` line to the archive specifying *interpreter* as the command
to run. Also, on POSIX, make the archive executable. The default is to
write no ``#!`` line, and not make the file executable.
.. cmdoption:: -m <mainfn>, --main=<mainfn>
.. option:: -m <mainfn>, --main=<mainfn>
Write a ``__main__.py`` file to the archive that executes *mainfn*. The
*mainfn* argument should have the form "pkg.mod:fn", where "pkg.mod" is a
@ -79,7 +79,7 @@ The following options are understood:
:option:`--main` cannot be specified when copying an archive.
.. cmdoption:: -c, --compress
.. option:: -c, --compress
Compress files with the deflate method, reducing the size of the output
file. By default, files are stored uncompressed in the archive.
@ -88,13 +88,13 @@ The following options are understood:
.. versionadded:: 3.7
.. cmdoption:: --info
.. option:: --info
Display the interpreter embedded in the archive, for diagnostic purposes. In
this case, any other options are ignored and SOURCE must be an archive, not a
directory.
.. cmdoption:: -h, --help
.. option:: -h, --help
Print a short usage message and exit.

View file

@ -905,27 +905,27 @@ For a list of the files in a ZIP archive, use the :option:`-l` option:
Command-line options
~~~~~~~~~~~~~~~~~~~~
.. cmdoption:: -l <zipfile>
--list <zipfile>
.. option:: -l <zipfile>
--list <zipfile>
List files in a zipfile.
.. cmdoption:: -c <zipfile> <source1> ... <sourceN>
--create <zipfile> <source1> ... <sourceN>
.. option:: -c <zipfile> <source1> ... <sourceN>
--create <zipfile> <source1> ... <sourceN>
Create zipfile from source files.
.. cmdoption:: -e <zipfile> <output_dir>
--extract <zipfile> <output_dir>
.. option:: -e <zipfile> <output_dir>
--extract <zipfile> <output_dir>
Extract zipfile into target directory.
.. cmdoption:: -t <zipfile>
--test <zipfile>
.. option:: -t <zipfile>
--test <zipfile>
Test whether the zipfile is valid or not.
.. cmdoption:: --metadata-encoding <encoding>
.. option:: --metadata-encoding <encoding>
Specify encoding of member names for :option:`-l`, :option:`-e` and
:option:`-t`.