Skip to content

Commit e23657f

Browse files
authored
[3.12] gh-101100: Fix Sphinx warnings in library/tarfile.rst (GH-113237) (#113244)
1 parent 38a4182 commit e23657f

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
@@ -116,7 +116,7 @@ Some facts and figures:
116116
``'filemode|[compression]'``. :func:`tarfile.open` will return a :class:`TarFile`
117117
object that processes its data as a stream of blocks. No random seeking will
118118
be done on the file. If given, *fileobj* may be any object that has a
119-
:meth:`read` or :meth:`write` method (depending on the *mode*). *bufsize*
119+
:meth:`~io.TextIOBase.read` or :meth:`~io.TextIOBase.write` method (depending on the *mode*). *bufsize*
120120
specifies the blocksize and defaults to ``20 * 512`` bytes. Use this variant
121121
in combination with e.g. ``sys.stdin``, a socket :term:`file object` or a tape
122122
device. However, such a :class:`TarFile` object is limited in that it does
@@ -255,6 +255,51 @@ The following constants are available at the module level:
255255
The default character encoding: ``'utf-8'`` on Windows, the value returned by
256256
:func:`sys.getfilesystemencoding` otherwise.
257257

258+
.. data:: REGTYPE
259+
AREGTYPE
260+
261+
A regular file :attr:`~TarInfo.type`.
262+
263+
.. data:: LNKTYPE
264+
265+
A link (inside tarfile) :attr:`~TarInfo.type`.
266+
267+
.. data:: SYMTYPE
268+
269+
A symbolic link :attr:`~TarInfo.type`.
270+
271+
.. data:: CHRTYPE
272+
273+
A character special device :attr:`~TarInfo.type`.
274+
275+
.. data:: BLKTYPE
276+
277+
A block special device :attr:`~TarInfo.type`.
278+
279+
.. data:: DIRTYPE
280+
281+
A directory :attr:`~TarInfo.type`.
282+
283+
.. data:: FIFOTYPE
284+
285+
A FIFO special device :attr:`~TarInfo.type`.
286+
287+
.. data:: CONTTYPE
288+
289+
A contiguous file :attr:`~TarInfo.type`.
290+
291+
.. data:: GNUTYPE_LONGNAME
292+
293+
A GNU tar longname :attr:`~TarInfo.type`.
294+
295+
.. data:: GNUTYPE_LONGLINK
296+
297+
A GNU tar longlink :attr:`~TarInfo.type`.
298+
299+
.. data:: GNUTYPE_SPARSE
300+
301+
A GNU tar sparse file :attr:`~TarInfo.type`.
302+
258303

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

326371
*name* is the pathname of the archive. *name* may be a :term:`path-like object`.
327372
It can be omitted if *fileobj* is given.
328-
In this case, the file object's :attr:`name` attribute is used if it exists.
373+
In this case, the file object's :attr:`!name` attribute is used if it exists.
329374

330375
*mode* is either ``'r'`` to read from an existing archive, ``'a'`` to append
331376
data to an existing file, ``'w'`` to create a new file overwriting an existing
@@ -359,7 +404,7 @@ be finalized; only the internally used file object will be closed. See the
359404
messages). The messages are written to ``sys.stderr``.
360405

361406
*errorlevel* controls how extraction errors are handled,
362-
see :attr:`the corresponding attribute <~TarFile.errorlevel>`.
407+
see :attr:`the corresponding attribute <TarFile.errorlevel>`.
363408

364409
The *encoding* and *errors* arguments define the character encoding to be
365410
used for reading or writing the archive and how conversion errors are going
@@ -640,8 +685,8 @@ It does *not* contain the file's data itself.
640685
:meth:`~TarFile.getmember`, :meth:`~TarFile.getmembers` and
641686
:meth:`~TarFile.gettarinfo`.
642687

643-
Modifying the objects returned by :meth:`~!TarFile.getmember` or
644-
:meth:`~!TarFile.getmembers` will affect all subsequent
688+
Modifying the objects returned by :meth:`~TarFile.getmember` or
689+
:meth:`~TarFile.getmembers` will affect all subsequent
645690
operations on the archive.
646691
For cases where this is unwanted, you can use :mod:`copy.copy() <copy>` or
647692
call the :meth:`~TarInfo.replace` method to create a modified copy in one step.
@@ -790,8 +835,8 @@ A ``TarInfo`` object has the following public data attributes:
790835

791836
A dictionary containing key-value pairs of an associated pax extended header.
792837

793-
.. method:: TarInfo.replace(name=..., mtime=..., mode=..., linkname=...,
794-
uid=..., gid=..., uname=..., gname=...,
838+
.. method:: TarInfo.replace(name=..., mtime=..., mode=..., linkname=..., \
839+
uid=..., gid=..., uname=..., gname=..., \
795840
deep=True)
796841

797842
.. versionadded:: 3.12
@@ -811,7 +856,7 @@ A :class:`TarInfo` object also provides some convenient query methods:
811856

812857
.. method:: TarInfo.isfile()
813858

814-
Return :const:`True` if the :class:`Tarinfo` object is a regular file.
859+
Return :const:`True` if the :class:`TarInfo` object is a regular file.
815860

816861

817862
.. method:: TarInfo.isreg()
@@ -947,7 +992,7 @@ reused in custom filters:
947992
path (after following symlinks) would end up outside the destination.
948993
This raises :class:`~tarfile.OutsideDestinationError`.
949994
- Clear high mode bits (setuid, setgid, sticky) and group/other write bits
950-
(:const:`~stat.S_IWGRP`|:const:`~stat.S_IWOTH`).
995+
(:const:`~stat.S_IWGRP` | :const:`~stat.S_IWOTH`).
951996

952997
Return the modified ``TarInfo`` member.
953998

@@ -972,9 +1017,9 @@ reused in custom filters:
9721017
- For regular files, including hard links:
9731018

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

9801025
- 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
@@ -99,7 +99,6 @@ Doc/library/string.rst
9999
Doc/library/subprocess.rst
100100
Doc/library/sunau.rst
101101
Doc/library/syslog.rst
102-
Doc/library/tarfile.rst
103102
Doc/library/telnetlib.rst
104103
Doc/library/termios.rst
105104
Doc/library/test.rst

0 commit comments

Comments
 (0)