Skip to content
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

filter argument to Tarfile.extractall not recognized #10514

Closed
jaraco opened this issue Jul 28, 2023 · 2 comments
Closed

filter argument to Tarfile.extractall not recognized #10514

jaraco opened this issue Jul 28, 2023 · 2 comments

Comments

@jaraco
Copy link
Member

jaraco commented Jul 28, 2023

The argument exists in Python 3.8 and is documented, yet mypy raises an error.

 draft @ cat ext.py
import tarfile

tf = tarfile.open('foo.tar.gz')
tf.extractall(filter='abc')

 draft @ mypy ext.py
ext.py:4: error: Unexpected keyword argument "filter" for "extractall" of "TarFile"  [call-arg]
Found 1 error in 1 file (checked 1 source file)
@AlexWaygood
Copy link
Member

AlexWaygood commented Jul 28, 2023

Yes, this is just because the mypy 1.5 release is quite delayed. You can see that mypy's vendored copy of typeshed's stubs includes the filter parameter for Tarfile.extractall on the mypy master branch: https://github.com/python/mypy/blob/a8467c43fb6423cc3f7f330f361e6b5af0bf284f/mypy/typeshed/stdlib/tarfile.pyi#L294-L302

And the parameter also exists on the release-1.5 branch: https://github.com/python/mypy/blob/2ff7c0de571d434a9a1f82fa183d32fa32999b40/mypy/typeshed/stdlib/tarfile.pyi#L295-L301

But not on the 1.4.1 tag (1.4.1 is the latest mypy version): https://github.com/python/mypy/blob/3534bacc4c0d3c4b1983a533e2a36cce43f2ec9d/mypy/typeshed/stdlib/tarfile.pyi#L278-L280

For now, you'll just have to type: ignore it, but you'll be able to remove the type: ignore once mypy 1.5 is released, with a more up-to-date vendored copy of typeshed's stubs.

@AlexWaygood AlexWaygood closed this as not planned Won't fix, can't repro, duplicate, stale Jul 28, 2023
@AlexWaygood
Copy link
Member

python/mypy#15588 is the tracking issue for mypy v1.5. None of us at typeshed really have any power to make the release come any faster :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants