Skip to content

Commit b9c53a0

Browse files
authored
Merge pull request #27 from tcfranks/main
Add Missing Type Annotations
2 parents 9815f4d + 5a9c388 commit b9c53a0

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

adafruit_displayio_ssd1306.py

+11-4
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@
3131

3232
import displayio
3333

34+
try:
35+
from typing import Union
36+
except ImportError:
37+
pass
38+
3439
__version__ = "0.0.0+auto.0"
3540
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_DisplayIO_SSD1306.git"
3641

@@ -62,7 +67,9 @@ class SSD1306(displayio.Display):
6267
(0, 90, 180, 270)
6368
"""
6469

65-
def __init__(self, bus, **kwargs):
70+
def __init__(
71+
self, bus: Union[displayio.Fourwire, displayio.I2CDisplay], **kwargs
72+
) -> None:
6673
# Patch the init sequence for 32 pixel high displays.
6774
init_sequence = bytearray(_INIT_SEQUENCE)
6875
height = kwargs["height"]
@@ -87,7 +94,7 @@ def __init__(self, bus, **kwargs):
8794
self._is_awake = True # Display starts in active state (_INIT_SEQUENCE)
8895

8996
@property
90-
def is_awake(self):
97+
def is_awake(self) -> bool:
9198
"""
9299
The power state of the display. (read-only)
93100
@@ -97,7 +104,7 @@ def is_awake(self):
97104
"""
98105
return self._is_awake
99106

100-
def sleep(self):
107+
def sleep(self) -> None:
101108
"""
102109
Put display into sleep mode.
103110
@@ -108,7 +115,7 @@ def sleep(self):
108115
self.bus.send(0xAE, b"") # 0xAE = display off, sleep mode
109116
self._is_awake = False
110117

111-
def wake(self):
118+
def wake(self) -> None:
112119
"""
113120
Wake display from sleep mode
114121
"""

0 commit comments

Comments
 (0)