Skip to content

Commit bd8aa9d

Browse files
authored
[3.11] gh-101100: Fix Sphinx warnings in library/tarfile.rst (GH-113237) (#113245)
1 parent 5599513 commit bd8aa9d

File tree

2 files changed

+56
-12
lines changed

2 files changed

+56
-12
lines changed

Doc/library/tarfile.rst

Lines changed: 56 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ Some facts and figures:
109109
``'filemode|[compression]'``. :func:`tarfile.open` will return a :class:`TarFile`
110110
object that processes its data as a stream of blocks. No random seeking will
111111
be done on the file. If given, *fileobj* may be any object that has a
112-
:meth:`read` or :meth:`write` method (depending on the *mode*). *bufsize*
112+
:meth:`~io.TextIOBase.read` or :meth:`~io.TextIOBase.write` method (depending on the *mode*). *bufsize*
113113
specifies the blocksize and defaults to ``20 * 512`` bytes. Use this variant
114114
in combination with e.g. ``sys.stdin``, a socket :term:`file object` or a tape
115115
device. However, such a :class:`TarFile` object is limited in that it does
@@ -245,6 +245,51 @@ The following constants are available at the module level:
245245
The default character encoding: ``'utf-8'`` on Windows, the value returned by
246246
:func:`sys.getfilesystemencoding` otherwise.
247247

248+
.. data:: REGTYPE
249+
AREGTYPE
250+
251+
A regular file :attr:`~TarInfo.type`.
252+
253+
.. data:: LNKTYPE
254+
255+
A link (inside tarfile) :attr:`~TarInfo.type`.
256+
257+
.. data:: SYMTYPE
258+
259+
A symbolic link :attr:`~TarInfo.type`.
260+
261+
.. data:: CHRTYPE
262+
263+
A character special device :attr:`~TarInfo.type`.
264+
265+
.. data:: BLKTYPE
266+
267+
A block special device :attr:`~TarInfo.type`.
268+
269+
.. data:: DIRTYPE
270+
271+
A directory :attr:`~TarInfo.type`.
272+
273+
.. data:: FIFOTYPE
274+
275+
A FIFO special device :attr:`~TarInfo.type`.
276+
277+
.. data:: CONTTYPE
278+
279+
A contiguous file :attr:`~TarInfo.type`.
280+
281+
.. data:: GNUTYPE_LONGNAME
282+
283+
A GNU tar longname :attr:`~TarInfo.type`.
284+
285+
.. data:: GNUTYPE_LONGLINK
286+
287+
A GNU tar longlink :attr:`~TarInfo.type`.
288+
289+
.. data:: GNUTYPE_SPARSE
290+
291+
A GNU tar sparse file :attr:`~TarInfo.type`.
292+
248293

249294
Each of the following constants defines a tar archive format that the
250295
:mod:`tarfile` module is able to create. See section :ref:`tar-formats` for
@@ -315,7 +360,7 @@ be finalized; only the internally used file object will be closed. See the
315360

316361
*name* is the pathname of the archive. *name* may be a :term:`path-like object`.
317362
It can be omitted if *fileobj* is given.
318-
In this case, the file object's :attr:`name` attribute is used if it exists.
363+
In this case, the file object's :attr:`!name` attribute is used if it exists.
319364

320365
*mode* is either ``'r'`` to read from an existing archive, ``'a'`` to append
321366
data to an existing file, ``'w'`` to create a new file overwriting an existing
@@ -349,7 +394,7 @@ be finalized; only the internally used file object will be closed. See the
349394
messages). The messages are written to ``sys.stderr``.
350395

351396
*errorlevel* controls how extraction errors are handled,
352-
see :attr:`the corresponding attribute <~TarFile.errorlevel>`.
397+
see :attr:`the corresponding attribute <TarFile.errorlevel>`.
353398

354399
The *encoding* and *errors* arguments define the character encoding to be
355400
used for reading or writing the archive and how conversion errors are going
@@ -632,8 +677,8 @@ It does *not* contain the file's data itself.
632677
:meth:`~TarFile.getmember`, :meth:`~TarFile.getmembers` and
633678
:meth:`~TarFile.gettarinfo`.
634679

635-
Modifying the objects returned by :meth:`~!TarFile.getmember` or
636-
:meth:`~!TarFile.getmembers` will affect all subsequent
680+
Modifying the objects returned by :meth:`~TarFile.getmember` or
681+
:meth:`~TarFile.getmembers` will affect all subsequent
637682
operations on the archive.
638683
For cases where this is unwanted, you can use :mod:`copy.copy() <copy>` or
639684
call the :meth:`~TarInfo.replace` method to create a modified copy in one step.
@@ -787,8 +832,8 @@ A ``TarInfo`` object has the following public data attributes:
787832

788833
A dictionary containing key-value pairs of an associated pax extended header.
789834

790-
.. method:: TarInfo.replace(name=..., mtime=..., mode=..., linkname=...,
791-
uid=..., gid=..., uname=..., gname=...,
835+
.. method:: TarInfo.replace(name=..., mtime=..., mode=..., linkname=..., \
836+
uid=..., gid=..., uname=..., gname=..., \
792837
deep=True)
793838

794839
.. versionadded:: 3.11.4
@@ -808,7 +853,7 @@ A :class:`TarInfo` object also provides some convenient query methods:
808853

809854
.. method:: TarInfo.isfile()
810855

811-
Return :const:`True` if the :class:`Tarinfo` object is a regular file.
856+
Return :const:`True` if the :class:`TarInfo` object is a regular file.
812857

813858

814859
.. method:: TarInfo.isreg()
@@ -945,7 +990,7 @@ reused in custom filters:
945990
path (after following symlinks) would end up outside the destination.
946991
This raises :class:`~tarfile.OutsideDestinationError`.
947992
- Clear high mode bits (setuid, setgid, sticky) and group/other write bits
948-
(:const:`~stat.S_IWGRP`|:const:`~stat.S_IWOTH`).
993+
(:const:`~stat.S_IWGRP` | :const:`~stat.S_IWOTH`).
949994

950995
Return the modified ``TarInfo`` member.
951996

@@ -970,9 +1015,9 @@ reused in custom filters:
9701015
- For regular files, including hard links:
9711016

9721017
- Set the owner read and write permissions
973-
(:const:`~stat.S_IRUSR`|:const:`~stat.S_IWUSR`).
1018+
(:const:`~stat.S_IRUSR` | :const:`~stat.S_IWUSR`).
9741019
- Remove the group & other executable permission
975-
(:const:`~stat.S_IXGRP`|:const:`~stat.S_IXOTH`)
1020+
(:const:`~stat.S_IXGRP` | :const:`~stat.S_IXOTH`)
9761021
if the owner doesn’t have it (:const:`~stat.S_IXUSR`).
9771022

9781023
- For other files (directories), set ``mode`` to ``None``, so

Doc/tools/.nitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ Doc/library/stdtypes.rst
9090
Doc/library/string.rst
9191
Doc/library/subprocess.rst
9292
Doc/library/syslog.rst
93-
Doc/library/tarfile.rst
9493
Doc/library/termios.rst
9594
Doc/library/test.rst
9695
Doc/library/tkinter.rst

0 commit comments

Comments
 (0)