Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Clarify the arguments to register_unpack_format's +function* argument
  • Loading branch information
encukou committed Mar 27, 2023
commit 7867fc3116082fb00024b3de9f1d359ee2dd9b47
16 changes: 8 additions & 8 deletions Doc/library/shutil.rst
Original file line number Diff line number Diff line change
Expand Up @@ -686,14 +686,14 @@ provided. They rely on the :mod:`zipfile` and :mod:`tarfile` modules.
``.zip`` for Zip files.

*function* is the callable that will be used to unpack archives. The
callable will receive the path of the archive, followed by the directory
the archive must be extracted to.

If *filter* is used with ``unpack_archive``, it will be passed to *function*
as an additional named argument.

When provided, *extra_args* is a sequence of ``(name, value)`` tuples that
will be passed as keywords arguments to the callable.
callable will receive:

- the path of the archive, as a positional argument;
- the directory the archive must be extracted to, as a positional argument;
- possibly a *filter* keyword argument, if it was given to
:func:`unpack_archive`;
- additional keyword arguments, specified by *extra_args* as a sequence
of ``(name, value)`` tuples.

*description* can be provided to describe the format, and will be returned
by the :func:`get_unpack_formats` function.
Expand Down