]> Repositories - hackapet/Adafruit_Blinka_Displayio.git/commitdiff
Switch to circuitpython_typing, remove _typing
authortekktrik <tekktrik@gmail.com>
Sat, 12 Mar 2022 23:57:07 +0000 (18:57 -0500)
committertekktrik <tekktrik@gmail.com>
Sat, 12 Mar 2022 23:57:07 +0000 (18:57 -0500)
_typing.py [deleted file]
displayio/_display.py
displayio/_displaycore.py
displayio/_epaperdisplay.py
displayio/_fourwire.py
displayio/_i2cdisplay.py
displayio/_palette.py
paralleldisplay.py
requirements.txt
setup.py

diff --git a/_typing.py b/_typing.py
deleted file mode 100644 (file)
index 85cb393..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams
-#
-# SPDX-License-Identifier: MIT
-
-"""
-`_typing`
-================================================================================
-
-Type aliases for Blinka
-
-**Software and Dependencies:**
-
-* Adafruit Blinka:
-  https://github.com/adafruit/Adafruit_Blinka/releases
-
-* Author(s): Melissa LeBlanc-Williams
-
-"""
-
-from typing import Union
-
-__version__ = "0.0.0-auto.0"
-__repo__ = "https://github.com/adafruit/Adafruit_Blinka_Displayio.git"
-
-
-WriteableBuffer = Union[
-    bytearray,
-    memoryview,
-    # array.array,
-    # ulab.numpy.ndarray,
-    # rgbmatrix.RGBMatrix
-]
-
-ReadableBuffer = Union[
-    bytes,
-    WriteableBuffer,
-]
index 80387224811e04f4ba15edfa0282055506a2ad63..88900871b6f28f73f80a337c66b9b5d6edf834dc 100644 (file)
@@ -26,7 +26,7 @@ import digitalio
 from PIL import Image
 import numpy
 import microcontroller
 from PIL import Image
 import numpy
 import microcontroller
-import _typing
+import circuitpython_typing
 from ._displaycore import _DisplayCore
 from ._displaybus import _DisplayBus
 from ._colorconverter import ColorConverter
 from ._displaycore import _DisplayCore
 from ._displaybus import _DisplayBus
 from ._colorconverter import ColorConverter
@@ -60,7 +60,7 @@ class Display:
     def __init__(
         self,
         display_bus: _DisplayBus,
     def __init__(
         self,
         display_bus: _DisplayBus,
-        init_sequence: _typing.ReadableBuffer,
+        init_sequence: circuitpython_typing.ReadableBuffer,
         *,
         width: int,
         height: int,
         *,
         width: int,
         height: int,
@@ -367,8 +367,8 @@ class Display:
         return struct.pack(self._bounds_encoding, x, y)  # pylint: disable=no-member
 
     def fill_row(
         return struct.pack(self._bounds_encoding, x, y)  # pylint: disable=no-member
 
     def fill_row(
-        self, y: int, buffer: _typing.WriteableBuffer
-    ) -> _typing.WriteableBuffer:
+        self, y: int, buffer: circuitpython_typing.WriteableBuffer
+    ) -> circuitpython_typing.WriteableBuffer:
         """Extract the pixels from a single row"""
         for x in range(0, self._width):
             _rgb_565 = self._colorconverter.convert(self._buffer.getpixel((x, y)))
         """Extract the pixels from a single row"""
         for x in range(0, self._width):
             _rgb_565 = self._colorconverter.convert(self._buffer.getpixel((x, y)))
index a68f6663c5a93a5e41ebd25197eedd6f9115e7ab..afb92c8eccedf3a5d5190ea05fd6c7c95419d622 100644 (file)
@@ -23,7 +23,7 @@ __repo__ = "https://github.com/adafruit/Adafruit_Blinka_Displayio.git"
 
 
 from typing import Union
 
 
 from typing import Union
-import _typing
+import circuitpython_typing
 from paralleldisplay import ParallelBus
 from ._fourwire import FourWire
 from ._group import Group
 from paralleldisplay import ParallelBus
 from ._fourwire import FourWire
 from ._group import Group
@@ -227,7 +227,10 @@ class _DisplayCore:
             self._current_group._in_group = False
 
     def fill_area(
             self._current_group._in_group = False
 
     def fill_area(
-        self, area: Area, mask: _typing.WriteableBuffer, buffer: _typing.WriteableBuffer
+        self,
+        area: Area,
+        mask: circuitpython_typing.WriteableBuffer,
+        buffer: circuitpython_typing.WriteableBuffer,
     ) -> bool:
         # pylint: disable=protected-access
         """Call the current group's fill area function"""
     ) -> bool:
         # pylint: disable=protected-access
         """Call the current group's fill area function"""
@@ -261,7 +264,10 @@ class _DisplayCore:
         return True
 
     def send(
         return True
 
     def send(
-        self, data_type: int, chip_select: int, data: _typing.ReadableBuffer
+        self,
+        data_type: int,
+        chip_select: int,
+        data: circuitpython_typing.ReadableBuffer,
     ) -> None:
         """
         Send the data to the current bus
     ) -> None:
         """
         Send the data to the current bus
index 29f8a54d840e9f1d7d08dfb991abe82be3616905..7e17fa96ae523ea09b85574fb4d41c8c2ab7851f 100644 (file)
@@ -19,7 +19,7 @@ displayio for Blinka
 
 from typing import Optional
 import microcontroller
 
 from typing import Optional
 import microcontroller
-import _typing
+import circuitpython_typing
 from ._group import Group
 from ._displaybus import _DisplayBus
 
 from ._group import Group
 from ._displaybus import _DisplayBus
 
@@ -42,8 +42,8 @@ class EPaperDisplay:
     def __init__(
         self,
         display_bus: _DisplayBus,
     def __init__(
         self,
         display_bus: _DisplayBus,
-        start_sequence: _typing.ReadableBuffer,
-        stop_sequence: _typing.ReadableBuffer,
+        start_sequence: circuitpython_typing.ReadableBuffer,
+        stop_sequence: circuitpython_typing.ReadableBuffer,
         *,
         width: int,
         height: int,
         *,
         width: int,
         height: int,
@@ -84,8 +84,10 @@ class EPaperDisplay:
 
         :param display_bus: The bus that the display is connected to
         :type _DisplayBus: displayio.FourWire or displayio.ParallelBus
 
         :param display_bus: The bus that the display is connected to
         :type _DisplayBus: displayio.FourWire or displayio.ParallelBus
-        :param ~_typing.ReadableBuffer start_sequence: Byte-packed initialization sequence.
-        :param ~_typing.ReadableBuffer stop_sequence: Byte-packed initialization sequence.
+        :param ~circuitpython_typing.ReadableBuffer start_sequence: Byte-packed
+            initialization sequence.
+        :param ~circuitpython_typing.ReadableBuffer stop_sequence: Byte-packed
+            initialization sequence.
         :param int width: Width in pixels
         :param int height: Height in pixels
         :param int ram_width: RAM width in pixels
         :param int width: Width in pixels
         :param int height: Height in pixels
         :param int ram_width: RAM width in pixels
index 0aae5dad212a0239c5f26ae68414a05f13463b33..3d5fa7e99ff4f40f1e93f16dc2cfb888761336a1 100644 (file)
@@ -22,7 +22,7 @@ from typing import Optional
 import digitalio
 import busio
 import microcontroller
 import digitalio
 import busio
 import microcontroller
-import _typing
+import circuitpython_typing
 from ._constants import (
     CHIP_SELECT_TOGGLE_EVERY_BYTE,
     CHIP_SELECT_UNTOUCHED,
 from ._constants import (
     CHIP_SELECT_TOGGLE_EVERY_BYTE,
     CHIP_SELECT_UNTOUCHED,
@@ -93,7 +93,11 @@ class FourWire:
             time.sleep(0.001)
 
     def send(
             time.sleep(0.001)
 
     def send(
-        self, command, data: _typing.ReadableBuffer, *, toggle_every_byte: bool = False
+        self,
+        command,
+        data: circuitpython_typing.ReadableBuffer,
+        *,
+        toggle_every_byte: bool = False,
     ) -> None:
         """
         Sends the given command value followed by the full set of data. Display state,
     ) -> None:
         """
         Sends the given command value followed by the full set of data. Display state,
@@ -112,7 +116,12 @@ class FourWire:
         self._send(DISPLAY_DATA, chip_select, data)
         self._end_transaction()
 
         self._send(DISPLAY_DATA, chip_select, data)
         self._end_transaction()
 
-    def _send(self, data_type: int, chip_select: int, data: _typing.ReadableBuffer):
+    def _send(
+        self,
+        data_type: int,
+        chip_select: int,
+        data: circuitpython_typing.ReadableBuffer,
+    ):
         self._dc.value = data_type == DISPLAY_DATA
         if chip_select == CHIP_SELECT_TOGGLE_EVERY_BYTE:
             for byte in data:
         self._dc.value = data_type == DISPLAY_DATA
         if chip_select == CHIP_SELECT_TOGGLE_EVERY_BYTE:
             for byte in data:
index 421fd105c7d3024df692cd688b6d4deddc05e886..958ce1d97433d12391806aef701d56892f536acb 100644 (file)
@@ -23,7 +23,7 @@ displayio for Blinka
 import time
 import busio
 import digitalio
 import time
 import busio
 import digitalio
-import _typing
+import circuitpython_typing
 from ._constants import CHIP_SELECT_UNTOUCHED, DISPLAY_COMMAND
 
 __version__ = "0.0.0-auto.0"
 from ._constants import CHIP_SELECT_UNTOUCHED, DISPLAY_COMMAND
 
 __version__ = "0.0.0-auto.0"
@@ -76,7 +76,7 @@ class I2CDisplay:
         while not self._i2c.try_lock():
             pass
 
         while not self._i2c.try_lock():
             pass
 
-    def send(self, command: int, data: _typing.ReadableBuffer) -> None:
+    def send(self, command: int, data: circuitpython_typing.ReadableBuffer) -> None:
         """
         Sends the given command value followed by the full set of data. Display state,
         such as vertical scroll, set via ``send`` may or may not be reset once the code is
         """
         Sends the given command value followed by the full set of data. Display state,
         such as vertical scroll, set via ``send`` may or may not be reset once the code is
@@ -86,7 +86,12 @@ class I2CDisplay:
         self._send(DISPLAY_COMMAND, CHIP_SELECT_UNTOUCHED, bytes([command] + data))
         self._end_transaction()
 
         self._send(DISPLAY_COMMAND, CHIP_SELECT_UNTOUCHED, bytes([command] + data))
         self._end_transaction()
 
-    def _send(self, data_type: int, chip_select: int, data: _typing.ReadableBuffer):
+    def _send(
+        self,
+        data_type: int,
+        chip_select: int,
+        data: circuitpython_typing.ReadableBuffer,
+    ):
         # pylint: disable=unused-argument
         if data_type == DISPLAY_COMMAND:
             n = len(data)
         # pylint: disable=unused-argument
         if data_type == DISPLAY_COMMAND:
             n = len(data)
index 8579bcb14cc182c8feabf061d75b1601da047b53..c008c8755e50f8794252ebb7a625fa3e0ae8b862 100644 (file)
@@ -18,7 +18,7 @@ displayio for Blinka
 """
 
 from typing import Optional, Union, Tuple
 """
 
 from typing import Optional, Union, Tuple
-import _typing
+import circuitpython_typing
 
 __version__ = "0.0.0-auto.0"
 __repo__ = "https://github.com/adafruit/Adafruit_Blinka_displayio.git"
 
 __version__ = "0.0.0-auto.0"
 __repo__ = "https://github.com/adafruit/Adafruit_Blinka_displayio.git"
@@ -73,7 +73,7 @@ class Palette:
     def __setitem__(
         self,
         index: int,
     def __setitem__(
         self,
         index: int,
-        value: Union[int, _typing.ReadableBuffer, Tuple[int, int, int]],
+        value: Union[int, circuitpython_typing.ReadableBuffer, Tuple[int, int, int]],
     ) -> None:
         """Sets the pixel color at the given index. The index should be
         an integer in the range 0 to color_count-1.
     ) -> None:
         """Sets the pixel color at the given index. The index should be
         an integer in the range 0 to color_count-1.
index b666121126aa977e57ae0e35b0c188077c48c668..0627418233bc2b21527175aed809d93958b3e09c 100644 (file)
@@ -18,7 +18,7 @@ paralleldisplay for Blinka
 """
 
 import microcontroller
 """
 
 import microcontroller
-import _typing
+import circuitpython_typing
 
 __version__ = "0.0.0-auto.0"
 __repo__ = "https://github.com/adafruit/Adafruit_Blinka_displayio.git"
 
 __version__ = "0.0.0-auto.0"
 __repo__ = "https://github.com/adafruit/Adafruit_Blinka_displayio.git"
@@ -61,7 +61,7 @@ class ParallelBus:
         """
         raise NotImplementedError("ParallelBus reset has not been implemented yet")
 
         """
         raise NotImplementedError("ParallelBus reset has not been implemented yet")
 
-    def send(self, command: int, data: _typing.ReadableBuffer) -> None:
+    def send(self, command: int, data: circuitpython_typing.ReadableBuffer) -> None:
         """Sends the given command value followed by the full set of data. Display state,
         such as vertical scroll, set via ``send`` may or may not be reset once the code is
         done.
         """Sends the given command value followed by the full set of data. Display state,
         such as vertical scroll, set via ``send`` may or may not be reset once the code is
         done.
index 10356cbe0bec80eada7351248dbe2a5f1907224c..054614e09d9f5d9aa13b007d07322888df0685ff 100644 (file)
@@ -2,6 +2,7 @@
 #
 # SPDX-License-Identifier: Unlicense
 
 #
 # SPDX-License-Identifier: Unlicense
 
-Adafruit-Blinka
+Adafruit-Blinka>=7.0.0
+adafruit-circuitpython-typing
 pillow
 numpy
 pillow
 numpy
index 64f2711459dca0bc4df98389a93962aded6eba64..2d4a2333378c9ca32650c5e24f4165386aabfa51 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -34,7 +34,8 @@ setup(
     author="Adafruit Industries",
     author_email="circuitpython@adafruit.com",
     install_requires=[
     author="Adafruit Industries",
     author_email="circuitpython@adafruit.com",
     install_requires=[
-        "Adafruit-Blinka",
+        "Adafruit-Blinka>=7.0.0",
+        "adafruit-circuitpython-typing",
         "pillow",
         "numpy",
     ],
         "pillow",
         "numpy",
     ],
@@ -54,6 +55,6 @@ setup(
     keywords="adafruit blinka circuitpython micropython displayio lcd tft display pitft",
     # You can just specify the packages manually here if your project is
     # simple. Or you can use find_packages().
     keywords="adafruit blinka circuitpython micropython displayio lcd tft display pitft",
     # You can just specify the packages manually here if your project is
     # simple. Or you can use find_packages().
-    py_modules=["fontio", "terminalio", "paralleldisplay", "_typing"],
+    py_modules=["fontio", "terminalio", "paralleldisplay"],
     packages=["displayio"],
 )
     packages=["displayio"],
 )