Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
cs1-24fa
project03
Commits
f24aa37d
Commit
f24aa37d
authored
6 months ago
by
Antonio Caceres
Browse files
Options
Download
Email Patches
Plain Diff
Add NoReturn and None support.
parent
1e48c54e
master
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/morse_engine.py
+3
-2
src/morse_engine.py
src/prox_pulse.py
+2
-1
src/prox_pulse.py
src/pulse.py
+3
-2
src/pulse.py
with
8 additions
and
5 deletions
+8
-5
src/morse_engine.py
View file @
f24aa37d
...
...
@@ -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.
...
...
This diff is collapsed.
Click to expand it.
src/prox_pulse.py
View file @
f24aa37d
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
)
->
Non
e
:
def
run_prox_pulse
(
apds
:
ProximitySensor
,
pixels
:
LEDController
)
->
No
Retur
n
:
"""
Runs proximity-based pulsing demo.
...
...
This diff is collapsed.
Click to expand it.
src/pulse.py
View file @
f24aa37d
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.
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help