Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit050d50a

Browse files
miss-islingtonhugovkserhiy-storchakaAlexWaygood
authored
[3.11]gh-101100: Fix Sphinx warnings inlibrary/cmd.rst (GH-113502) (#113510)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
1 parente095f37 commit050d50a

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

‎Doc/library/cmd.rst

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -66,27 +66,30 @@ A :class:`Cmd` instance has the following methods:
6666
single: ! (exclamation); in a command interpreter
6767

6868
An interpreter instance will recognize a command name ``foo`` if and only if it
69-
has a method:meth:`do_foo`. As a special case, a line beginning with the
69+
has a method:meth:`!do_foo`. As a special case, a line beginning with the
7070
character ``'?'`` is dispatched to the method:meth:`do_help`. As another
7171
special case, a line beginning with the character ``'!'`` is dispatched to the
72-
method:meth:`do_shell` (if such a method is defined).
72+
method:meth:`!do_shell` (if such a method is defined).
7373

7474
This method will return when the:meth:`postcmd` method returns a true value.
7575
The *stop* argument to:meth:`postcmd` is the return value from the command's
7676
corresponding:meth:`!do_\*` method.
7777

7878
If completion is enabled, completing commands will be done automatically, and
79-
completing of commands args is done by calling:meth:`complete_foo` with
79+
completing of commands args is done by calling:meth:`!complete_foo` with
8080
arguments *text*, *line*, *begidx*, and *endidx*. *text* is the string prefix
8181
we are attempting to match: all returned matches must begin with it. *line* is
8282
the current input line with leading whitespace removed, *begidx* and *endidx*
8383
are the beginning and ending indexes of the prefix text, which could be used to
8484
provide different completion depending upon which position the argument is in.
8585

86-
All subclasses of:class:`Cmd` inherit a predefined:meth:`do_help`. This
86+
87+
..method::Cmd.do_help(arg)
88+
89+
All subclasses of:class:`Cmd` inherit a predefined:meth:`!do_help`. This
8790
method, called with an argument ``'bar'``, invokes the corresponding method
88-
:meth:`help_bar`, and if that is not present, prints the docstring of
89-
:meth:`do_bar`, if available. With no argument,:meth:`do_help` lists all
91+
:meth:`!help_bar`, and if that is not present, prints the docstring of
92+
:meth:`!do_bar`, if available. With no argument,:meth:`!do_help` lists all
9093
available help topics (that is, all commands with corresponding
9194
:meth:`!help_\*` methods or commands that have docstrings), and also lists any
9295
undocumented commands.
@@ -219,8 +222,8 @@ Instances of :class:`Cmd` subclasses have some public instance variables:
219222
..attribute::Cmd.use_rawinput
220223

221224
A flag, defaulting to true. If true,:meth:`cmdloop` uses:func:`input` to
222-
display a prompt and read the next command; if false,:meth:`sys.stdout.write`
223-
and:meth:`sys.stdin.readline` are used. (This means that by importing
225+
display a prompt and read the next command; if false,:data:`sys.stdout.write() <sys.stdout>`
226+
and:data:`sys.stdin.readline() <sys.stdin>` are used. (This means that by importing
224227
:mod:`readline`, on systems that support it, the interpreter will automatically
225228
support:program:`Emacs`\-like line editing and command-history keystrokes.)
226229

@@ -239,14 +242,14 @@ This section presents a simple example of how to build a shell around a few of
239242
the commands in the:mod:`turtle` module.
240243

241244
Basic turtle commands such as:meth:`~turtle.forward` are added to a
242-
:class:`Cmd` subclass with method named:meth:`do_forward`. The argument is
245+
:class:`Cmd` subclass with method named:meth:`!do_forward`. The argument is
243246
converted to a number and dispatched to the turtle module. The docstring is
244247
used in the help utility provided by the shell.
245248

246249
The example also includes a basic record and playback facility implemented with
247250
the:meth:`~Cmd.precmd` method which is responsible for converting the input to
248-
lowercase and writing the commands to a file. The:meth:`do_playback` method
249-
reads the file and adds the recorded commands to the:attr:`cmdqueue` for
251+
lowercase and writing the commands to a file. The:meth:`!do_playback` method
252+
reads the file and adds the recorded commands to the:attr:`~Cmd.cmdqueue` for
250253
immediate playback::
251254

252255
import cmd, sys

‎Doc/tools/.nitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ Doc/library/asyncio-policy.rst
3131
Doc/library/asyncio-subprocess.rst
3232
Doc/library/asyncio-task.rst
3333
Doc/library/bdb.rst
34-
Doc/library/cmd.rst
3534
Doc/library/collections.rst
3635
Doc/library/concurrent.futures.rst
3736
Doc/library/configparser.rst

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp