Skip to content

Add Missing Type Annotations #27

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 1 commit into from
Sep 3, 2022
Merged
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
15 changes: 11 additions & 4 deletions adafruit_displayio_ssd1306.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@

import displayio

try:
from typing import Union
except ImportError:
pass

__version__ = "0.0.0+auto.0"
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_DisplayIO_SSD1306.git"

Expand Down Expand Up @@ -62,7 +67,9 @@ class SSD1306(displayio.Display):
(0, 90, 180, 270)
"""

def __init__(self, bus, **kwargs):
def __init__(
self, bus: Union[displayio.Fourwire, displayio.I2CDisplay], **kwargs
) -> None:
# Patch the init sequence for 32 pixel high displays.
init_sequence = bytearray(_INIT_SEQUENCE)
height = kwargs["height"]
Expand All @@ -87,7 +94,7 @@ def __init__(self, bus, **kwargs):
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)

Expand All @@ -97,7 +104,7 @@ def is_awake(self):
"""
return self._is_awake

def sleep(self):
def sleep(self) -> None:
"""
Put display into sleep mode.

Expand All @@ -108,7 +115,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
"""
Expand Down