Skip to content

Commit a32d693

Browse files
dlwrncgpsheaderlend-aasland
authored
gh-102190: Add additional zipfile pwd= arg docstrings (gh-102195)
This just documents the parameter that already exists. --------- Co-authored-by: Gregory P. Smith <[email protected]> Co-authored-by: Erlend E. Aasland <[email protected]>
1 parent 2624453 commit a32d693

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
@@ -1585,7 +1585,8 @@ def comment(self, comment):
15851585
self._didModify = True
15861586

15871587
def read(self, name, pwd=None):
1588-
"""Return file bytes for name."""
1588+
"""Return file bytes for name. 'pwd' is the password to decrypt
1589+
encrypted files."""
15891590
with self.open(name, "r", pwd) as fp:
15901591
return fp.read()
15911592

@@ -1737,7 +1738,8 @@ def extract(self, member, path=None, pwd=None):
17371738
"""Extract a member from the archive to the current working directory,
17381739
using its full name. Its file information is extracted as accurately
17391740
as possible. `member' may be a filename or a ZipInfo object. You can
1740-
specify a different directory using `path'.
1741+
specify a different directory using `path'. You can specify the
1742+
password to decrypt the file using 'pwd'.
17411743
"""
17421744
if path is None:
17431745
path = os.getcwd()
@@ -1750,7 +1752,8 @@ def extractall(self, path=None, members=None, pwd=None):
17501752
"""Extract all members from the archive to the current working
17511753
directory. `path' specifies a different directory to extract to.
17521754
`members' is optional and must be a subset of the list returned
1753-
by namelist().
1755+
by namelist(). You can specify the password to decrypt all files
1756+
using 'pwd'.
17541757
"""
17551758
if members is None:
17561759
members = self.namelist()

0 commit comments

Comments
 (0)