summaryrefslogtreecommitdiff
path: root/shared-bindings/_typing
diff options
context:
space:
mode:
authorTaku Fukada <naninunenor@gmail.com>2020-08-03 13:35:43 +0900
committerTaku Fukada <naninunenor@gmail.com>2020-08-07 01:01:28 +0900
commit56c898da80df57d0e83f4e8d1ee44f4351ce1d8c (patch)
tree06f32bb910bca32cd33e96c134b5a18f86f5c5e7 /shared-bindings/_typing
parent887eb3b6d9a3ef8c6300448492f1177a609feef6 (diff)
Modify some Python stubs
Diffstat (limited to 'shared-bindings/_typing')
-rw-r--r--shared-bindings/_typing/__init__.pyi54
1 files changed, 54 insertions, 0 deletions
diff --git a/shared-bindings/_typing/__init__.pyi b/shared-bindings/_typing/__init__.pyi
new file mode 100644
index 000000000..48e68a8d5
--- /dev/null
+++ b/shared-bindings/_typing/__init__.pyi
@@ -0,0 +1,54 @@
+"""Types for the C-level protocols"""
+
+from typing import Union
+
+import array
+import audiocore
+import audiomixer
+import audiomp3
+import rgbmatrix
+import ulab
+
+ReadableBuffer = Union[
+ bytes, bytearray, memoryview, array.array, ulab.array, rgbmatrix.RGBMatrix
+]
+"""Classes that implement the readable buffer protocol
+
+ - `bytes`
+ - `bytearray`
+ - `memoryview`
+ - `array.array`
+ - `ulab.array`
+ - `rgbmatrix.RGBMatrix`
+"""
+
+WriteableBuffer = Union[
+ bytearray, memoryview, array.array, ulab.array, rgbmatrix.RGBMatrix
+]
+"""Classes that implement the writeable buffer protocol
+
+ - `bytearray`
+ - `memoryview`
+ - `array.array`
+ - `ulab.array`
+ - `rgbmatrix.RGBMatrix`
+"""
+
+AudioSample = Union[
+ audiocore.WaveFile, audiocore.RawSample, audiomixer.Mixer, audiomp3.MP3Decoder
+]
+"""Classes that implement the audiosample protocol
+
+ - `audiocore.WaveFile`
+ - `audiocore.RawSample`
+ - `audiomixer.Mixer`
+ - `audiomp3.MP3Decoder`
+
+ You can play these back with `audioio.AudioOut`, `audiobusio.I2SOut` or `audiopwmio.PWMAudioOut`.
+"""
+
+FrameBuffer = Union[rgbmatrix.RGBMatrix]
+"""Classes that implement the framebuffer protocol
+
+ - `rgbmatrix.RGBMatrix`
+"""