Commit f24aa37d authored by Antonio Caceres's avatar Antonio Caceres
Browse files

Add NoReturn and None support.

parent 1e48c54e
No related merge requests found
Showing with 8 additions and 5 deletions
+8 -5
......@@ -2,6 +2,7 @@ import time
from src import morse_code
from .abstract import LEDController, TouchSensor, ProximitySensor
from support.mytyping import NoReturn
# Constants (Keep same or tests will break)
THRESHOLD: int = 75
......@@ -17,7 +18,7 @@ GREEN : tuple[int, int, int] = (0, 255, 0)
# - 0.034 sec unit time (35 words per minute)
def set_color(elapsed_t: float, px: LEDController):
def set_color(elapsed_t: float, px: LEDController) -> None:
"""
Lights the LEDs on the trinkey depending on the length of input.
......@@ -42,7 +43,7 @@ def add_mark(elapsed_t: float) -> str:
...
def run_morse_engine(apds: ProximitySensor, pixels: LEDController, touch: TouchSensor):
def run_morse_engine(apds: ProximitySensor, pixels: LEDController, touch: TouchSensor) -> NoReturn:
"""
Runs Morse code translation based on proximity input.
......
import time
from .pulse import pulse
from .abstract import LEDController, ProximitySensor
from support.mytyping import NoReturn
THRESHOLD: int = 75
......@@ -20,7 +21,7 @@ def prox_pulse(px: LEDController, color: tuple[int, int, int], prox: int) -> Non
...
def run_prox_pulse(apds: ProximitySensor, pixels: LEDController) -> None:
def run_prox_pulse(apds: ProximitySensor, pixels: LEDController) -> NoReturn:
"""
Runs proximity-based pulsing demo.
......
import time
from .abstract import LEDController
from support.mytyping import NoReturn
THRESHOLD: int = 75
BLUE: tuple[int, int, int] = (0, 0, 255)
TIME: int = 1
def pulse(px: LEDController, color: tuple[int, int, int], duration: float):
def pulse(px: LEDController, color: tuple[int, int, int], duration: float) -> None:
"""
Fills pixels with a color for a duration, then turns them off.
......@@ -19,7 +20,7 @@ def pulse(px: LEDController, color: tuple[int, int, int], duration: float):
...
def run_simple_pulse(pixels: LEDController):
def run_simple_pulse(pixels: LEDController) -> NoReturn:
"""
Runs a simple pulse demo.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment