From 9ad24bb92d7e2c5c13e435fa95c1bc9eef31baf2 Mon Sep 17 00:00:00 2001 From: Thomas Franks Date: Sat, 3 Sep 2022 14:05:06 -0400 Subject: [PATCH 1/3] Add Missing Type Annotations --- adafruit_displayio_sh1107.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/adafruit_displayio_sh1107.py b/adafruit_displayio_sh1107.py index 5bce133..82ee44e 100644 --- a/adafruit_displayio_sh1107.py +++ b/adafruit_displayio_sh1107.py @@ -141,11 +141,11 @@ class SH1107(displayio.Display): def __init__( self, - bus, - display_offset=DISPLAY_OFFSET_ADAFRUIT_FEATHERWING_OLED_4650, - rotation=0, + bus: displayio.I2CDisplay, + display_offset: int = DISPLAY_OFFSET_ADAFRUIT_FEATHERWING_OLED_4650, + rotation: int = 0, **kwargs - ): + ) -> None: rotation = (rotation + _ROTATION_OFFSET) % 360 if rotation in (0, 180): multiplex = kwargs["width"] - 1 @@ -174,7 +174,7 @@ def __init__( self._is_awake = True # Display starts in active state (_INIT_SEQUENCE) @property - def is_awake(self): + def is_awake(self) -> bool: """ The power state of the display. (read-only) @@ -184,7 +184,7 @@ def is_awake(self): """ return self._is_awake - def sleep(self): + def sleep(self) -> None: """ Put display into sleep mode. The display uses < 5uA in sleep mode @@ -199,7 +199,7 @@ def sleep(self): self.bus.send(0xAE, b"") # 0xAE = display off, sleep mode self._is_awake = False - def wake(self): + def wake(self) -> None: """ Wake display from sleep mode """ From 03652720053def7f32e976bf993300fe26fc429b Mon Sep 17 00:00:00 2001 From: Thomas Franks Date: Sat, 3 Sep 2022 16:49:41 -0400 Subject: [PATCH 2/3] Add Missing Type Annotations --- adafruit_displayio_sh1107.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/adafruit_displayio_sh1107.py b/adafruit_displayio_sh1107.py index 82ee44e..f7e71b8 100644 --- a/adafruit_displayio_sh1107.py +++ b/adafruit_displayio_sh1107.py @@ -30,6 +30,11 @@ import displayio from micropython import const +try: + from typing import Union +except ImportError: + pass + __version__ = "0.0.0+auto.0" __repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_DisplayIO_SH1107.git" @@ -141,7 +146,7 @@ class SH1107(displayio.Display): def __init__( self, - bus: displayio.I2CDisplay, + bus: Union[displayio.I2CDisplay, displayio.Fourwire], display_offset: int = DISPLAY_OFFSET_ADAFRUIT_FEATHERWING_OLED_4650, rotation: int = 0, **kwargs From 785a0a2ed58b7aeceefe0479b0308297b93b2837 Mon Sep 17 00:00:00 2001 From: Thomas Franks Date: Sat, 3 Sep 2022 21:34:44 -0400 Subject: [PATCH 3/3] Add Missing Type Annotations --- adafruit_displayio_sh1107.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adafruit_displayio_sh1107.py b/adafruit_displayio_sh1107.py index f7e71b8..a119bc9 100644 --- a/adafruit_displayio_sh1107.py +++ b/adafruit_displayio_sh1107.py @@ -146,7 +146,7 @@ class SH1107(displayio.Display): def __init__( self, - bus: Union[displayio.I2CDisplay, displayio.Fourwire], + bus: Union[displayio.I2CDisplay, displayio.FourWire], display_offset: int = DISPLAY_OFFSET_ADAFRUIT_FEATHERWING_OLED_4650, rotation: int = 0, **kwargs