/
core.py
30 lines (20 loc) · 887 Bytes
/
core.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import sys
from argparse import ArgumentParser
from typing import List
from chroma_feedback import helper, logger, wording
from chroma_feedback.typing import Consumer, ProducerReport
from .light import filter_lights, get_lights, process_lights
ARGS = None
def support() -> bool:
return helper.is_linux() is True or helper.is_mac() is True or helper.is_windows() is True
def init(program : ArgumentParser) -> None:
global ARGS
if not ARGS:
program.add_argument('--compulab-fit-statusb-light-serial', action = 'append')
ARGS = helper.get_first(program.parse_known_args())
def run(producer_report : List[ProducerReport]) -> List[Consumer]:
light = filter_lights(get_lights(), ARGS.compulab_fit_statusb_light_serial)
if not light:
logger.error(wording.get('device_not_found') + wording.get('exclamation_mark'))
sys.exit()
return process_lights(light, producer_report)