8000 gh-102190: Add additional zipfile pwd docstrings by dlwrnc · Pull Request #102194 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-102190: Add additional zipfile pwd docstrings #102194

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
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
Next Next commit
gh-102190: Add additional zipfile pwd docstrings
  • Loading branch information
Deborah Lawrence authored and Deborah Lawrence committed Feb 23, 2023
commit 66683f6db4ccd537cbc17a119dbdffc34dcac049
10 changes: 7 additions & 3 deletions Lib/zipfile/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1518,7 +1518,9 @@ def comment(self, comment):
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()

Expand Down Expand Up @@ -1665,7 +1667,8 @@ def extract(self, member, path=None, pwd=None):
"""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()
Expand All @@ -1678,7 +1681,8 @@ def extractall(self, path=None, members=None, pwd=None):
"""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()
Expand Down
0