Skip to content

Value of type "stat_result" should be indexable #2751

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
Steap opened this issue Jan 19, 2019 · 1 comment
Closed

Value of type "stat_result" should be indexable #2751

Steap opened this issue Jan 19, 2019 · 1 comment
Labels
stubs: false positive Type checkers report false errors

Comments

@Steap
Copy link
Contributor

Steap commented Jan 19, 2019

Hello,

The following code snippet works perfectly:

import stat
import os

os.stat('/tmp')[stat.ST_MODE]

But mypy returns an error:

$ mypy bug.py 
bug.py:4: error: Value of type "stat_result" is not indexable

I believe that stat_result should be indexable.

@srittau srittau added stubs: false positive Type checkers report false errors size-small labels Jan 19, 2019
@srittau
Copy link
Collaborator

srittau commented Jan 19, 2019

class stat_result is missing the __getitem__() method to implements this behaviour. Pull requests welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stubs: false positive Type checkers report false errors
Projects
None yet
Development

No branches or pull requests

2 participants