-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add typing shorthand for display-related types #10109
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
Conversation
.. and use it to give a better type hint for supervisor.runtime.display.
shared-bindings/displayio/__init__.c
Outdated
//| AnyDisplayBus: fourwire.FourWire | i2cdisplaybus.I2cDisplayBus | ||
//| """Type-checking shorthand for any kind of display bus. Not actually defined in CircuitPython.""" | ||
//| | ||
//| AnyFramebuffer: ( |
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.
I'm pretty sure this should be
//| AnyFramebuffer: ( | |
//| AnyFramebuffer = ( |
As in... AnyFramebuffer
is any of these types, not an instance of them
On a quick check in a blank file
foo: int | float
bar: foo # Variable not allowed in type expression (by pylance extension on VSCode)
foo = int | float
bar: foo # nothing reported
PS: Same thing applies below
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! This is a mistake I commonly make.
It turns out the |
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.
LGTM
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.
Thank you!
.. and use it to give a better type hint for supervisor.runtime.display.