Skip to content

Commit

Permalink
Update documentation and contributors
Browse files Browse the repository at this point in the history
  • Loading branch information
nepiskopos authored May 11, 2024
1 parent fddc379 commit ba1478c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
18 changes: 17 additions & 1 deletion docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ SevenZipFile Object
py7zr looks for files and directories as same as specified in element
of 'targets'.

When the method get a ``str`` object or another object other than collection
When the method gets a ``str`` object or another object other than collection
such as LIST or SET, it will raise :exc:`TypeError`.

Once extract() called, the ``SevenZipFile`` object become exhausted,
Expand All @@ -199,6 +199,20 @@ SevenZipFile Object
'somedir/somefile' then pass a list: ['somedirectory', 'somedir/somefile']
as a target argument.


.. py:method:: SevenZipFile.extract(path=None, targets=None, recursive=True)
'recursive' is a BOOLEAN which if set True, helps with simplifying subcontents
extraction.

Instead of specifying all files / directories under a parent
directory by passing a list of 'targets', specifying only the parent directory
and setting 'recursive' to True forces an automatic extraction of all
subdirectories and subcontents recursively.

If 'recursive' is not set, it defaults to False, so the extraction proceeds as
if the parameter did not exist.

Please see 'tests/test_basic.py: test_py7zr_extract_and_getnames()' for
example code.

Expand All @@ -210,6 +224,8 @@ SevenZipFile Object
targets = [f if filter_pattern.match(f) for f in allfiles]
with SevenZipFile('archive.7z', 'r') as zip:
zip.extract(targets=targets)
with SevenZipFile('archive.7z', 'r') as zip:
zip.extract(targets=targets, recursive=True)
.. py:method:: SevenZipFile.readall()
Expand Down
1 change: 1 addition & 0 deletions docs/authors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Contributors, listed alphabetically, are:
* Kyle Altendorf -- Fix multithreading problem (#82)
* Martin Larralde -- Fix writef method (#397)
* Megan Leet -- Fix infinite loop when extraction (#354)
* Nikolaos Episkopos -- Add recursive subdirectories extraction (#585)
* @padremayi -- Fix crash on wrong crationtime in archive (#275)
* @royopa -- Fix typo (#108)
* Sergei -- Update report_update() (#558)
Expand Down

0 comments on commit ba1478c

Please sign in to comment.