]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-102190: Add additional zipfile `pwd=` arg docstrings (gh-102195)
authorDeborah <32307299+dlwrnc@users.noreply.github.com>
Sun, 31 Mar 2024 20:11:48 +0000 (22:11 +0200)
committerGitHub <noreply@github.com>
Sun, 31 Mar 2024 20:11:48 +0000 (20:11 +0000)
This just documents the parameter that already exists.

---------

Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Lib/zipfile/__init__.py

index b330ece4b276ad7ee63224023956cc1c9b8cbca7..e4603b559f5962defabc0bf5fe680d398fe42d97 100644 (file)
@@ -1585,7 +1585,8 @@ class ZipFile:
         self._didModify = True
 
     def read(self, name, pwd=None):
-        """Return file bytes for name."""
+        """Return file bytes for name. 'pwd' is the password to decrypt
+        encrypted files."""
         with self.open(name, "r", pwd) as fp:
             return fp.read()
 
@@ -1737,7 +1738,8 @@ class ZipFile:
         """Extract a member from the archive to the current working directory,
            using its full name. Its file information is extracted as accurately
            as possible. `member' may be a filename or a ZipInfo object. You can
-           specify a different directory using `path'.
+           specify a different directory using `path'. You can specify the
+           password to decrypt the file using 'pwd'.
         """
         if path is None:
             path = os.getcwd()
@@ -1750,7 +1752,8 @@ class ZipFile:
         """Extract all members from the archive to the current working
            directory. `path' specifies a different directory to extract to.
            `members' is optional and must be a subset of the list returned
-           by namelist().
+           by namelist(). You can specify the password to decrypt all files
+           using 'pwd'.
         """
         if members is None:
             members = self.namelist()