-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlight.py
More file actions
49 lines (39 loc) · 1006 Bytes
/
light.py
File metadata and controls
49 lines (39 loc) · 1006 Bytes
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
from abc import ABC,abstractmethod
import time
import re
import server
class Light:
def __init__(self, name):
self.name = name
super().__init__()
@abstractmethod
def stop(self):
pass
@abstractmethod
def start(self, *args):
pass
@property
def disabled(self):
return self._disabled
@property
def isRunning(self):
return self._running
def getName(self):
return self.name
def human_name(self):
name = re.sub('(?!^)([A-Z][a-z]+)', r' \1', self.name).split()
name = " ".join(name)
name = name[0].upper() + name[1:]
return name
def getColorsFromArg(self, amt, *args):
colors = []
for arg in args:
print("ARGUMENT:")
print(arg)
if arg is not None:
colors.append(arg)
if len(colors) >= amt:
break
if len(colors) < amt:
return None
return colors