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

Commit8c51e40

Browse files
[3.11]gh-101100: Fix Sphinx nitpicks inlibrary/tempfile.rst (#112886) (#112913)
(cherry-picked from commit54410e6)Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
1 parentc95aa4e commit8c51e40

File tree

2 files changed

+27
-22
lines changed

2 files changed

+27
-22
lines changed

‎Doc/library/tempfile.rst

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ This module creates temporary files and directories. It works on all
1818
supported platforms.:class:`TemporaryFile`,:class:`NamedTemporaryFile`,
1919
:class:`TemporaryDirectory`, and:class:`SpooledTemporaryFile` are high-level
2020
interfaces which provide automatic cleanup and can be used as
21-
context managers.:func:`mkstemp` and
21+
:term:`context managers <context manager>`.:func:`mkstemp` and
2222
:func:`mkdtemp` are lower-level functions which require manual cleanup.
2323

2424
All the user-callable functions and constructors take additional arguments which
@@ -41,7 +41,7 @@ The module defines the following user-callable items:
4141
this; your code should not rely on a temporary file created using this
4242
function having or not having a visible name in the file system.
4343

44-
The resulting object can be used as a context manager (see
44+
The resulting object can be used as a:term:`context manager` (see
4545
:ref:`tempfile-examples`). On completion of the context or
4646
destruction of the file object the temporary file will be removed
4747
from the filesystem.
@@ -107,18 +107,20 @@ The module defines the following user-callable items:
107107
contents are written to disk and operation proceeds as with
108108
:func:`TemporaryFile`.
109109

110-
The resulting file has one additional method,:func:`rollover`, which
111-
causes the file to roll over to an on-disk file regardless of its size.
110+
..method::SpooledTemporaryFile.rollover
112111

113-
The returned object is a file-like object whose:attr:`_file` attribute
112+
The resulting file has one additional method,:meth:`!rollover`, which
113+
causes the file to roll over to an on-disk file regardless of its size.
114+
115+
The returned object is a file-like object whose:attr:`!_file` attribute
114116
is either an:class:`io.BytesIO` or:class:`io.TextIOWrapper` object
115117
(depending on whether binary or text *mode* was specified) or a true file
116-
object, depending on whether:func:`rollover` has been called. This
118+
object, depending on whether:meth:`rollover` has been called. This
117119
file-like object can be used in a:keyword:`with` statement, just like
118120
a normal file.
119121

120122
..versionchanged::3.3
121-
the truncate method now accepts a``size`` argument.
123+
the truncate method now accepts a*size* argument.
122124

123125
..versionchanged::3.8
124126
Added *errors* parameter.
@@ -132,24 +134,28 @@ The module defines the following user-callable items:
132134
..class::TemporaryDirectory(suffix=None, prefix=None, dir=None, ignore_cleanup_errors=False)
133135

134136
This class securely creates a temporary directory using the same rules as:func:`mkdtemp`.
135-
The resulting object can be used as a context manager (see
137+
The resulting object can be used as a:term:`context manager` (see
136138
:ref:`tempfile-examples`). On completion of the context or destruction
137139
of the temporary directory object, the newly created temporary directory
138140
and all its contents are removed from the filesystem.
139141

140-
The directory name can be retrieved from the:attr:`name` attribute of the
141-
returned object. When the returned object is used as a context manager, the
142-
:attr:`name` will be assigned to the target of the:keyword:`!as` clause in
143-
the:keyword:`with` statement, if there is one.
144-
145-
The directory can be explicitly cleaned up by calling the
146-
:func:`cleanup` method. If *ignore_cleanup_errors* is true, any unhandled
147-
exceptions during explicit or implicit cleanup (such as a
148-
:exc:`PermissionError` removing open files on Windows) will be ignored,
149-
and the remaining removable items deleted on a "best-effort" basis.
150-
Otherwise, errors will be raised in whatever context cleanup occurs
151-
(the:func:`cleanup` call, exiting the context manager, when the object
152-
is garbage-collected or during interpreter shutdown).
142+
..attribute::TemporaryDirectory.name
143+
144+
The directory name can be retrieved from the:attr:`!name` attribute of the
145+
returned object. When the returned object is used as a:term:`context manager`, the
146+
:attr:`!name` will be assigned to the target of the:keyword:`!as` clause in
147+
the:keyword:`with` statement, if there is one.
148+
149+
..method::TemporaryDirectory.cleanup
150+
151+
The directory can be explicitly cleaned up by calling the
152+
:meth:`!cleanup` method. If *ignore_cleanup_errors* is true, any unhandled
153+
exceptions during explicit or implicit cleanup (such as a
154+
:exc:`PermissionError` removing open files on Windows) will be ignored,
155+
and the remaining removable items deleted on a "best-effort" basis.
156+
Otherwise, errors will be raised in whatever context cleanup occurs
157+
(the:meth:`!cleanup` call, exiting the context manager, when the object
158+
is garbage-collected or during interpreter shutdown).
153159

154160
..audit-event::tempfile.mkdtemp fullpath tempfile.TemporaryDirectory
155161

‎Doc/tools/.nitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ Doc/library/string.rst
9797
Doc/library/subprocess.rst
9898
Doc/library/syslog.rst
9999
Doc/library/tarfile.rst
100-
Doc/library/tempfile.rst
101100
Doc/library/termios.rst
102101
Doc/library/test.rst
103102
Doc/library/tkinter.rst

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp