-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
adding __contains__ stub to displayio.Group #7949
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it actually work? It isn't clear to me how it works.
It does work to eliminate that error from mypy. I'm not entirely sure of the 'how' beyond that mypy is looking at your installed libraries for known types when it runs to try to enforce it's rules. I saw your message on the issue as well. Iter does feel more appropriate for this instance, although I think Group may support both. I'll double check whether it does support |
Yup. But I don't think it supports contains. :-) I was talking about how it was implemented in CP. mypy is just a knock on effect. |
Latest commit adds As far as I can tell it supports both
Output:
Tested on:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
resolves: #7948
I noticed that mypy raises this error while testing some of the suggested fixes discussed during the weeds section of the meeting inside of this PR: adafruit/Adafruit_CircuitPython_DisplayIO_Layout#85
This topic of the
in
operator didn't come up, but I noticed mypy outputting errors about it while working on that.I tested the change successfully by building stubs and installing with
pip install .
and then running mypy on that PR branch again. Confirmed that it no longer outputs the error.