Skip to content

Commit b1402f7

Browse files
[lcd_simulated] use f-string instead of +
1 parent ccd726c commit b1402f7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

library/lcd/lcd_simulated.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ def do_GET(self):
3838
self.send_response(200)
3939
self.send_header("Content-type", "text/html")
4040
self.end_headers()
41-
self.wfile.write(bytes("<img src=\"" + SCREENSHOT_FILE + "\" id=\"myImage\" />", "utf-8"))
41+
self.wfile.write(bytes(f"<img src=\"{SCREENSHOT_FILE}\" id=\"myImage\" />", "utf-8"))
4242
self.wfile.write(bytes("<script>", "utf-8"))
4343
self.wfile.write(bytes("setInterval(function() {", "utf-8"))
4444
self.wfile.write(bytes(" var myImageElement = document.getElementById('myImage');", "utf-8"))
45-
self.wfile.write(bytes(" myImageElement.src = '" + SCREENSHOT_FILE + "?rand=' + Math.random();", "utf-8"))
45+
self.wfile.write(bytes(f" myImageElement.src = '{SCREENSHOT_FILE}?rand=' + Math.random();", "utf-8"))
4646
self.wfile.write(bytes("}, 250);", "utf-8"))
4747
self.wfile.write(bytes("</script>", "utf-8"))
4848
elif self.path.startswith("/" + SCREENSHOT_FILE):
@@ -67,7 +67,7 @@ def __init__(self, com_port: str = "AUTO", display_width: int = 320, display_hei
6767

6868
try:
6969
self.webServer = HTTPServer(("localhost", WEBSERVER_PORT), SimulatedLcdWebServer)
70-
logger.debug("To see your simulated screen, open http://%s:%d in a browser" % ("localhost", WEBSERVER_PORT))
70+
logger.debug(f"To see your simulated screen, open http://localhost:{WEBSERVER_PORT} in a browser")
7171
threading.Thread(target=self.webServer.serve_forever).start()
7272
except OSError:
7373
logger.error("Error starting webserver! An instance might already be running on port %d." % WEBSERVER_PORT)

0 commit comments

Comments
 (0)