moonraker: convert missed legacy strings to f-strings

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Arksine 2020-08-13 17:49:29 -04:00
parent e9cd86f468
commit 5b6d4371c8
3 changed files with 13 additions and 12 deletions

View File

@ -49,13 +49,14 @@ class Authorization:
else:
self.trusted_ips.append(tc)
t_clients = [str(ip) for ip in self.trusted_ips] + \
[str(rng) for rng in self.trusted_ranges]
t_clients = "\n".join(
[str(ip) for ip in self.trusted_ips] +
[str(rng) for rng in self.trusted_ranges])
logging.info(
"Authorization Configuration Loaded\n"
"Auth Enabled: %s\n"
"Trusted Clients:\n%s" %
(self.auth_enabled, "\n".join(t_clients)))
f"Authorization Configuration Loaded\n"
f"Auth Enabled: {self.auth_enabled}\n"
f"Trusted Clients:\n{t_clients}")
self.prune_handler = PeriodicCallback(
self._prune_conn_handler, PRUNE_CHECK_TIME)

View File

@ -73,8 +73,7 @@ class Server:
def start(self):
logging.info(
"Starting Moonraker on (%s, %d)" %
(self.host, self.port))
f"Starting Moonraker on ({self.host}, {self.port})")
self.moonraker_app.listen(self.host, self.port)
self.server_running = True
self.ioloop.spawn_callback(self._connect_klippy)
@ -272,7 +271,7 @@ class Server:
response = ServerError(response['message'], 400)
req.notify(response)
else:
logging.info("No request matching response: " + str(response))
logging.info(f"No request matching response: {response}")
def _set_klippy_ready(self):
logging.info("Klippy ready")
@ -343,8 +342,9 @@ class BaseRequest:
await self._event.wait(timeout=timeout)
except TimeoutError:
pending_time = time.time() - start_time
logging.info("Request '%s %s' pending: %.2f seconds" %
(self.method, self.path, pending_time))
logging.info(
f"Request '{self.method} {self.path}' pending:"
f"{pending_time:.2f} seconds")
self._event.clear()
continue
break

View File

@ -46,7 +46,7 @@ def get_software_version():
version = version.decode()
return version
else:
logging.debug("Error getting git version: %s", err)
logging.debug(f"Error getting git version: {err}")
except OSError:
logging.exception("Error runing git describe")