Fix bad attribute name

master
LEdoian 3 years ago
parent 416431efca
commit 9af7956a8f

@ -21,11 +21,11 @@ class LED:
@property @property
def state(self) -> LedState: def state(self) -> LedState:
with open(self.path/'color') as f: with open(self.dir/'color') as f:
r, g, b = [int(x) for x in r.read().strip().split()] r, g, b = [int(x) for x in r.read().strip().split()]
with open(self.path/'brightness') as f: with open(self.dir/'brightness') as f:
brightness = int(f.read.strip()) brightness = int(f.read.strip())
with open(self.path/'autonomous') as f: with open(self.dir/'autonomous') as f:
autonomous = bool(f.read.strip()) autonomous = bool(f.read.strip())
return LedState(r=r, g=g, b=b, brightness=brightness, autonomous=autonomous) return LedState(r=r, g=g, b=b, brightness=brightness, autonomous=autonomous)
@ -40,11 +40,11 @@ class LED:
setattr(state, attr, old_value) setattr(state, attr, old_value)
# Set it # Set it
with open(self.path/'color', 'w') as f: with open(self.dir/'color', 'w') as f:
f.write(f'{state.r} {state.g} {state.b}\n') f.write(f'{state.r} {state.g} {state.b}\n')
with open(self.path/'brightness', 'w') as f: with open(self.dir/'brightness', 'w') as f:
f.write(str(state.brightness)+'\n') f.write(str(state.brightness)+'\n')
with open(self.path/'autonomous', 'w') as f: with open(self.dir/'autonomous', 'w') as f:
f.write(str(int(state.autonomous))+'\n') f.write(str(int(state.autonomous))+'\n')
def unalias(s): def unalias(s):

Loading…
Cancel
Save