Skip to content

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

Merged
merged 5 commits into from
Mar 3, 2025

Conversation

jepler
Copy link

@jepler jepler commented Mar 2, 2025

.. and use it to give a better type hint for supervisor.runtime.display.

jepler added 2 commits March 2, 2025 15:56
.. and use it to give a better type hint for supervisor.runtime.display.
@jepler jepler requested a review from dhalbert March 2, 2025 21:59
//| AnyDisplayBus: fourwire.FourWire | i2cdisplaybus.I2cDisplayBus
//| """Type-checking shorthand for any kind of display bus. Not actually defined in CircuitPython."""
//|
//| AnyFramebuffer: (
Copy link

@elpekenin elpekenin Mar 2, 2025

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

Suggested change
//| 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

Copy link
Author

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.

@jepler jepler requested a review from elpekenin March 2, 2025 22:38
@jepler
Copy link
Author

jepler commented Mar 2, 2025

It turns out the broadcom and zephyr port bindings weren't being shown in the docs, so I added them.

Copy link

@elpekenin elpekenin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@tannewt tannewt merged commit 4795e54 into adafruit:main Mar 3, 2025
607 checks passed
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

Successfully merging this pull request may close these issues.

3 participants