`ZipFile.open()` return type
Open
Nobody has claimed this yet.
topic: io
- Dominant language
- Python
- Stars
- 5.1k
- Forks
- 2.1k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 82
Description
ZipFile.open() returns an instance of ZipExtFile if mode='r' and an instance of _ZipWriteFile if mode='w', but in typeshed its return type is IO[bytes].
Is this on purpose? Would it be possible instead to have an overload for each case?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read stdlib/zipfile/init.pyi at the cited return annotation and compare it with the linked CPython ZipFile.open(), ZipExtFile, and _ZipWriteFile definitions. Done means the typeshed annotation distinguishes the read and write modes with appropriate overloads, if the comparison supports that change.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100