FIX bytes/str blah
This commit is contained in:
parent
b654700ccf
commit
68e6805bd9
1 changed files with 14 additions and 10 deletions
|
@ -17,15 +17,15 @@ you can just run your favourite inotify-like tool (entr, watchman, you name it)
|
|||
time you need it.
|
||||
"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
import logging
|
||||
import time
|
||||
import os
|
||||
import signal
|
||||
import sys
|
||||
import time
|
||||
from argparse import ArgumentParser
|
||||
from multiprocessing import Pipe, Process
|
||||
from pathlib import Path
|
||||
from subprocess import Popen, check_output, CalledProcessError
|
||||
from multiprocessing import Process, Pipe
|
||||
from subprocess import CalledProcessError, Popen, check_output
|
||||
|
||||
|
||||
def rotate(lst: list, n: int) -> list:
|
||||
|
@ -61,7 +61,7 @@ class LightManager:
|
|||
self.stop_pipe_r, self.stop_pipe_w = Pipe(False)
|
||||
|
||||
def set_light(self, on: bool):
|
||||
self.log.debug('set %s', on)
|
||||
self.log.debug("set %s", on)
|
||||
env = os.environ.copy()
|
||||
env["DEVICE_NUMBER"] = str(self.device_number)
|
||||
|
||||
|
@ -87,11 +87,13 @@ class LightManager:
|
|||
|
||||
def get_status(self) -> str:
|
||||
try:
|
||||
status = check_output([str(self.args.bin_state.resolve()), self.device_name])
|
||||
status = check_output(
|
||||
[str(self.args.bin_state.resolve()), self.device_name]
|
||||
)
|
||||
except CalledProcessError:
|
||||
status = 'off'
|
||||
status = "off"
|
||||
|
||||
status = status.lower().strip().decode('ascii', errors='ignore')
|
||||
status = status.lower().strip()
|
||||
if status not in self.waveforms:
|
||||
return "off"
|
||||
return status
|
||||
|
@ -134,7 +136,9 @@ def main():
|
|||
p.add_argument("--devices", type=parse_devices, default="1")
|
||||
p.add_argument("--bin-state", type=Path, default=(EXE_DIR / "get-status"))
|
||||
p.add_argument("--bin-set-light", type=Path, default=(EXE_DIR / "set-light"))
|
||||
p.add_argument("--disable-polling", dest='enable_polling', default=True, action='store_false')
|
||||
p.add_argument(
|
||||
"--disable-polling", dest="enable_polling", default=True, action="store_false"
|
||||
)
|
||||
p.add_argument(
|
||||
"--log-level",
|
||||
choices=["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"],
|
||||
|
|
Loading…
Reference in a new issue