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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,8 @@ stubs:
@mkdir circuitpython-stubs
@$(PYTHON) tools/extract_pyi.py shared-bindings/ $(STUBDIR)
@$(PYTHON) tools/extract_pyi.py extmod/ulab/code/ $(STUBDIR)/ulab
@$(PYTHON) tools/extract_pyi.py ports/atmel-samd/bindings $(STUBDIR)
@$(PYTHON) tools/extract_pyi.py ports/espressif/bindings $(STUBDIR)
@$(PYTHON) tools/extract_pyi.py ports/raspberrypi/bindings $(STUBDIR)
@for d in ports/*/bindings; do \
$(PYTHON) tools/extract_pyi.py "$$d" $(STUBDIR); done
@sed -e "s,__version__,`python -msetuptools_scm`," < setup.py-stubs > circuitpython-stubs/setup.py
@cp README.rst-stubs circuitpython-stubs/README.rst
@cp MANIFEST.in-stubs circuitpython-stubs/MANIFEST.in
Expand Down
2 changes: 1 addition & 1 deletion ports/zephyr-cp/bindings/zephyr_serial/UART.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

//| class UART:
//| """A bidirectional serial protocol. Already initialized for Zephyr defined
//| busses in `board`.
//| busses in :py:mod:`board`.
//|
//| .. raw:: html
//|
Expand Down
17 changes: 17 additions & 0 deletions shared-bindings/displayio/__init__.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,23 @@
//| """
//|

//| AnyDisplayBus = fourwire.FourWire | i2cdisplaybus.I2CDisplayBus | is31fl3741.IS31FL3741
//| """Type-checking shorthand for any kind of display bus. Not actually defined in CircuitPython."""
//|
//| AnyFramebuffer = (
//| rgbmatrix.RGBMatrix
//| | is31fl3741.IS31FL3741_FrameBuffer
//| | sharpdisplay.SharpMemoryFramebuffer
//| | videocore.Framebuffer
//| | picodvi.Framebuffer
//| | aurora_epaper.AuroraMemoryFramebuffer
//| )
//| """Type-checking shorthand for any kind of framebuffer. Not actually defined in CircuitPython."""
//|
//| AnyDisplay = (
//| busdisplay.BusDisplay | epaperdisplay.EPaperDisplay | framebufferio.FramebufferDisplay
//| )
//| """Type-checking shorthand for any kind of display. Not actually defined in CircuitPython."""
//| CIRCUITPYTHON_TERMINAL: Group
//| """The `displayio.Group` that is the displayed serial terminal (REPL)."""
//|
Expand Down
4 changes: 2 additions & 2 deletions shared-bindings/supervisor/Runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,12 +208,12 @@ MP_PROPERTY_GETSET(supervisor_runtime_rgb_status_brightness_obj,
(mp_obj_t)&supervisor_runtime_set_rgb_status_brightness_obj);

#if CIRCUITPY_DISPLAYIO
//| display: Any
//| display: displayio.AnyDisplay | None
//| """The primary configured displayio display, if any.
//|
//| If the board has a display that is hard coded, or that was explicitly set
//| in boot.py or code.py (including a previous run of code.py), it is
//| available here until it is released with ``displayio.releasee_displays()``.
//| available here until it is released with ``displayio.release_displays()``.
//|
//| The display can be of any supported display type, such as `busdisplay.BusDisplay`.
//|
Expand Down