simplyprint: fix linter errors

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2023-10-07 10:33:56 -04:00
parent a28c7c3f93
commit 0afbefc962
No known key found for this signature in database
GPG Key ID: 5A1EB336DFB4C71B
1 changed files with 6 additions and 7 deletions

View File

@ -222,8 +222,7 @@ class SimplyPrint(Subscribable):
timediff = curtime - self.last_err_log_time timediff = curtime - self.last_err_log_time
if timediff > CONNECTION_ERROR_LOG_TIME: if timediff > CONNECTION_ERROR_LOG_TIME:
self.last_err_log_time = curtime self.last_err_log_time = curtime
logging.exception( logging.exception("Failed to connect to SimplyPrint")
f"Failed to connect to SimplyPrint")
else: else:
logging.info("Connected to SimplyPrint Cloud") logging.info("Connected to SimplyPrint Cloud")
await self._read_messages() await self._read_messages()
@ -306,7 +305,7 @@ class SimplyPrint(Subscribable):
logging.debug(f"Invalid token received: {token}") logging.debug(f"Invalid token received: {token}")
token = None token = None
else: else:
logging.info(f"SimplyPrint Token Received") logging.info("SimplyPrint Token Received")
self.save_item("printer_token", token) self.save_item("printer_token", token)
self._set_ws_url() self._set_ws_url()
if "short_id" in data: if "short_id" in data:
@ -323,14 +322,14 @@ class SimplyPrint(Subscribable):
return return
printer_id = data.get("printer_id") printer_id = data.get("printer_id")
if printer_id is None: if printer_id is None:
logging.debug(f"Invalid printer id, received null (None) value") logging.debug("Invalid printer id, received null (None) value")
self.save_item("printer_id", str(printer_id)) self.save_item("printer_id", str(printer_id))
self._set_ws_url() self._set_ws_url()
self.save_item("temp_short_setup_id", None) self.save_item("temp_short_setup_id", None)
self.eventloop.create_task(self._remove_setup_announcement()) self.eventloop.create_task(self._remove_setup_announcement())
elif event == "demand": elif event == "demand":
if data is None: if data is None:
logging.debug(f"Invalid message, no data") logging.debug("Invalid message, no data")
return return
demand = data.pop("demand", "unknown") demand = data.pop("demand", "unknown")
self._process_demand(demand, data) self._process_demand(demand, data)
@ -369,7 +368,7 @@ class SimplyPrint(Subscribable):
elif demand == "file": elif demand == "file":
url: Optional[str] = args.get("url") url: Optional[str] = args.get("url")
if not isinstance(url, str): if not isinstance(url, str):
logging.debug(f"Invalid url in message") logging.debug("Invalid url in message")
return return
start = bool(args.get("auto_start", 0)) start = bool(args.get("auto_start", 0))
self.print_handler.download_file(url, start) self.print_handler.download_file(url, start)
@ -1399,7 +1398,7 @@ class WebcamStream:
self.simplyprint.send_sp("stream", {"base": img}) self.simplyprint.send_sp("stream", {"base": img})
except asyncio.CancelledError: except asyncio.CancelledError:
raise raise
except Exception as e: except Exception:
if not self.server.is_verbose_enabled(): if not self.server.is_verbose_enabled():
return return
logging.exception("SimplyPrint WebCam Stream Error") logging.exception("SimplyPrint WebCam Stream Error")