| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -116,7 +116,7 @@ Some facts and figures: | |||
| 116 | 116 | ``'filemode|[compression]'``. :func:`tarfile.open` will return a :class:`TarFile` | |
| 117 | 117 | object that processes its data as a stream of blocks. No random seeking will | |
| 118 | 118 | 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* | ||
| 120 | 120 | specifies the blocksize and defaults to ``20 * 512`` bytes. Use this variant | |
| 121 | 121 | in combination with e.g. ``sys.stdin``, a socket :term:`file object` or a tape | |
| 122 | 122 | 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: | |||
| 255 | 255 | The default character encoding: ``'utf-8'`` on Windows, the value returned by | |
| 256 | 256 | :func:`sys.getfilesystemencoding` otherwise. | |
| 257 | 257 | ||
| 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 | + | ||
| 258 | 303 | ||
| 259 | 304 | Each of the following constants defines a tar archive format that the | |
| 260 | 305 | :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 | |||
| 325 | 370 | ||
| 326 | 371 | *name* is the pathname of the archive. *name* may be a :term:`path-like object`. | |
| 327 | 372 | 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. | ||
| 329 | 374 | ||
| 330 | 375 | *mode* is either ``'r'`` to read from an existing archive, ``'a'`` to append | |
| 331 | 376 | 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 | |||
| 359 | 404 | messages). The messages are written to ``sys.stderr``. | |
| 360 | 405 | ||
| 361 | 406 | *errorlevel* controls how extraction errors are handled, | |
| 362 | - see :attr:`the corresponding attribute <~TarFile.errorlevel>`. | ||
| 407 | + see :attr:`the corresponding attribute <TarFile.errorlevel>`. | ||
| 363 | 408 | ||
| 364 | 409 | The *encoding* and *errors* arguments define the character encoding to be | |
| 365 | 410 | used for reading or writing the archive and how conversion errors are going | |
@@ -645,8 +690,8 @@ It does *not* contain the file's data itself. | |||
| 645 | 690 | :meth:`~TarFile.getmember`, :meth:`~TarFile.getmembers` and | |
| 646 | 691 | :meth:`~TarFile.gettarinfo`. | |
| 647 | 692 | ||
| 648 | - Modifying the objects returned by :meth:`~!TarFile.getmember` or | ||
| 649 | - :meth:`~!TarFile.getmembers` will affect all subsequent | ||
| 693 | + Modifying the objects returned by :meth:`~TarFile.getmember` or | ||
| 694 | + :meth:`~TarFile.getmembers` will affect all subsequent | ||
| 650 | 695 | operations on the archive. | |
| 651 | 696 | For cases where this is unwanted, you can use :mod:`copy.copy() <copy>` or | |
| 652 | 697 | call the :meth:`~TarInfo.replace` method to create a modified copy in one step. | |
@@ -795,8 +840,8 @@ A ``TarInfo`` object has the following public data attributes: | |||
| 795 | 840 | ||
| 796 | 841 | A dictionary containing key-value pairs of an associated pax extended header. | |
| 797 | 842 | ||
| 798 | - .. method:: TarInfo.replace(name=..., mtime=..., mode=..., linkname=..., | ||
| 799 | - uid=..., gid=..., uname=..., gname=..., | ||
| 843 | + .. method:: TarInfo.replace(name=..., mtime=..., mode=..., linkname=..., \ | ||
| 844 | + uid=..., gid=..., uname=..., gname=..., \ | ||
| 800 | 845 | deep=True) | |
| 801 | 846 | ||
| 802 | 847 | .. versionadded:: 3.12 | |
@@ -816,7 +861,7 @@ A :class:`TarInfo` object also provides some convenient query methods: | |||
| 816 | 861 | ||
| 817 | 862 | .. method:: TarInfo.isfile() | |
| 818 | 863 | ||
| 819 | - Return :const:`True` if the :class:`Tarinfo` object is a regular file. | ||
| 864 | + Return :const:`True` if the :class:`TarInfo` object is a regular file. | ||
| 820 | 865 | ||
| 821 | 866 | ||
| 822 | 867 | .. method:: TarInfo.isreg() | |
@@ -952,7 +997,7 @@ reused in custom filters: | |||
| 952 | 997 | path (after following symlinks) would end up outside the destination. | |
| 953 | 998 | This raises :class:`~tarfile.OutsideDestinationError`. | |
| 954 | 999 | - Clear high mode bits (setuid, setgid, sticky) and group/other write bits | |
| 955 | - (:const:`~stat.S_IWGRP`|:const:`~stat.S_IWOTH`). | ||
| 1000 | + (:const:`~stat.S_IWGRP` | :const:`~stat.S_IWOTH`). | ||
| 956 | 1001 | ||
| 957 | 1002 | Return the modified ``TarInfo`` member. | |
| 958 | 1003 | ||
@@ -977,9 +1022,9 @@ reused in custom filters: | |||
| 977 | 1022 | - For regular files, including hard links: | |
| 978 | 1023 | ||
| 979 | 1024 | - Set the owner read and write permissions | |
| 980 | - (:const:`~stat.S_IRUSR`|:const:`~stat.S_IWUSR`). | ||
| 1025 | + (:const:`~stat.S_IRUSR` | :const:`~stat.S_IWUSR`). | ||
| 981 | 1026 | - Remove the group & other executable permission | |
| 982 | - (:const:`~stat.S_IXGRP`|:const:`~stat.S_IXOTH`) | ||
| 1027 | + (:const:`~stat.S_IXGRP` | :const:`~stat.S_IXOTH`) | ||
| 983 | 1028 | if the owner doesn’t have it (:const:`~stat.S_IXUSR`). | |
| 984 | 1029 | ||
| 985 | 1030 | - For other files (directories), set ``mode`` to ``None``, so | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -86,7 +86,6 @@ Doc/library/ssl.rst | |||
| 86 | 86 | Doc/library/stdtypes.rst | |
| 87 | 87 | Doc/library/string.rst | |
| 88 | 88 | Doc/library/subprocess.rst | |
| 89 | - Doc/library/tarfile.rst | ||
| 90 | 89 | Doc/library/termios.rst | |
| 91 | 90 | Doc/library/test.rst | |
| 92 | 91 | Doc/library/tkinter.rst | |
| Back | FazBrowse Home | New Git URL |
0 commit comments