Skip to content

Commit 0b23bc3

Browse files
miss-islingtondlwrncgpsheaderlend-aasland
authored
[3.12] gh-102190: Add additional zipfile pwd= arg docstrings (gh-102195) (GH-117408)
gh-102190: Add additional zipfile `pwd=` arg docstrings (gh-102195) This just documents the parameter that already exists. --------- (cherry picked from commit a32d693) Co-authored-by: Deborah <[email protected]> Co-authored-by: Gregory P. Smith <[email protected]> Co-authored-by: Erlend E. Aasland <[email protected]>
1 parent b912d2b commit 0b23bc3

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Lib/zipfile/__init__.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1562,7 +1562,8 @@ def comment(self, comment):
15621562
self._didModify = True
15631563

15641564
def read(self, name, pwd=None):
1565-
"""Return file bytes for name."""
1565+
"""Return file bytes for name. 'pwd' is the password to decrypt
1566+
encrypted files."""
15661567
with self.open(name, "r", pwd) as fp:
15671568
return fp.read()
15681569

@@ -1714,7 +1715,8 @@ def extract(self, member, path=None, pwd=None):
17141715
"""Extract a member from the archive to the current working directory,
17151716
using its full name. Its file information is extracted as accurately
17161717
as possible. `member' may be a filename or a ZipInfo object. You can
1717-
specify a different directory using `path'.
1718+
specify a different directory using `path'. You can specify the
1719+
password to decrypt the file using 'pwd'.
17181720
"""
17191721
if path is None:
17201722
path = os.getcwd()
@@ -1727,7 +1729,8 @@ def extractall(self, path=None, members=None, pwd=None):
17271729
"""Extract all members from the archive to the current working
17281730
directory. `path' specifies a different directory to extract to.
17291731
`members' is optional and must be a subset of the list returned
1730-
by namelist().
1732+
by namelist(). You can specify the password to decrypt all files
1733+
using 'pwd'.
17311734
"""
17321735
if members is None:
17331736
members = self.namelist()

0 commit comments

Comments
 (0)