summaryrefslogtreecommitdiffstats
path: root/Doc/library/tarfile.rst
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2011-01-26 20:34:14 (GMT)
committerRaymond Hettinger <python@rcn.com>2011-01-26 20:34:14 (GMT)
commita63a312a3f5a4f3b76617831e56ac9d295929fa0 (patch)
tree18504231f06733d800b5417cd6e0c4c0de6e8966 /Doc/library/tarfile.rst
parente3b8f7c0fa47bbf7c31a2912789e1618e129b539 (diff)
downloadcpython-a63a312a3f5a4f3b76617831e56ac9d295929fa0.zip
cpython-a63a312a3f5a4f3b76617831e56ac9d295929fa0.tar.gz
cpython-a63a312a3f5a4f3b76617831e56ac9d295929fa0.tar.bz2
Issue #11014: Make 'filter' argument in tarfile.Tarfile.add() into a
keyword-only argument. The preceding positional argument was deprecated, so it made no sense to add filter as a positional argument. (Patch reviewed by Brian Curtin and Anthony Long.)
Diffstat (limited to 'Doc/library/tarfile.rst')
-rw-r--r--Doc/library/tarfile.rst27
1 files changed, 14 insertions, 13 deletions
diff --git a/Doc/library/tarfile.rst b/Doc/library/tarfile.rst
index d7fbf39..d578a79 100644
--- a/Doc/library/tarfile.rst
+++ b/Doc/library/tarfile.rst
@@ -370,19 +370,20 @@ be finalized; only the internally used file object will be closed. See the
and :meth:`close`, and also supports iteration over its lines.
-.. method:: TarFile.add(name, arcname=None, recursive=True, exclude=None, filter=None)
-
- Add the file *name* to the archive. *name* may be any type of file (directory,
- fifo, symbolic link, etc.). If given, *arcname* specifies an alternative name
- for the file in the archive. Directories are added recursively by default. This
- can be avoided by setting *recursive* to :const:`False`. If *exclude* is given,
- it must be a function that takes one filename argument and returns a boolean
- value. Depending on this value the respective file is either excluded
- (:const:`True`) or added (:const:`False`). If *filter* is specified it must
- be a function that takes a :class:`TarInfo` object argument and returns the
- changed :class:`TarInfo` object. If it instead returns :const:`None` the :class:`TarInfo`
- object will be excluded from the archive. See :ref:`tar-examples` for an
- example.
+.. method:: TarFile.add(name, arcname=None, recursive=True, exclude=None, *, filter=None)
+
+ Add the file *name* to the archive. *name* may be any type of file
+ (directory, fifo, symbolic link, etc.). If given, *arcname* specifies an
+ alternative name for the file in the archive. Directories are added
+ recursively by default. This can be avoided by setting *recursive* to
+ :const:`False`. If *exclude* is given, it must be a function that takes one
+ filename argument and returns a boolean value. Depending on this value the
+ respective file is either excluded (:const:`True`) or added
+ (:const:`False`). If *filter* is specified it must be a keyword argument. It
+ should be a function that takes a :class:`TarInfo` object argument and
+ returns the changed :class:`TarInfo` object. If it instead returns
+ :const:`None` the :class:`TarInfo` object will be excluded from the
+ archive. See :ref:`tar-examples` for an example.
.. versionchanged:: 3.2
Added the *filter* parameter.