Apply formatting

This commit is contained in:
n07070
2026-11-13 02:46:05 +01:00
parent bfbee7dacb
commit df070ebd72
2 changed files with 16 additions and 16 deletions

View File

@@ -27,12 +27,7 @@ class Raspberry:
# dede
"""
def __init__(
self,
print_queue,
app,
configuration_file
):
def __init__(self, print_queue, app, configuration_file):
self.print_queue = print_queue
self.app = app
self.configuration_file = configuration_file
@@ -68,7 +63,9 @@ class Raspberry:
self.app.logger.warning(
"Couldn't get sufficient hardware information from /proc/cpuinfo"
)
self.app.logger.warning("Unable to determine if we are on a Raspberry Pi.")
self.app.logger.warning(
"Unable to determine if we are on a Raspberry Pi."
)
return False
except IOError:
self.app.logger.error("Unable to open `/proc/cpuinfo`.")
@@ -95,13 +92,16 @@ class Raspberry:
self.indicator_countdown(iters=3)
self.button = Button(
self.configuration_file["rpi"]["button_gpio_port_number"],
pull_up=True, bounce_time=0.1
pull_up=True,
bounce_time=0.1,
)
self.button.when_pressed = self.on_button_pressed
self.app.logger.debug("Activated button")
# The "flash" is a relay-controlled device ( light bulb for example )
self.flash = DigitalOutputDevice(self.configuration_file["rpi"]["flash_gpio_port_number"])
self.flash = DigitalOutputDevice(
self.configuration_file["rpi"]["flash_gpio_port_number"]
)
self.flash_toggle()
self.app.logger.debug("Activated flash")
@@ -215,9 +215,9 @@ class Raspberry:
y = image.height - logo.height - margin
else:
raise ValueError(
"Invalid position." +
"Choose from 'bottom_right', 'top_left', " +
" 'top_right', or 'bottom_left'."
"Invalid position."
+ "Choose from 'bottom_right', 'top_left', "
+ " 'top_right', or 'bottom_left'."
)
# Composite the logo onto the image

View File

@@ -105,7 +105,9 @@ class Web:
image.save(os.path.join(self.app.config["UPLOAD_FOLDER"], filename))
except OSError as e:
self.app.logger.error("Could not save file %s", e)
raise RuntimeError("An OS error occured while uploading this file : " + str(e)) from e
raise RuntimeError(
"An OS error occured while uploading this file : " + str(e)
) from e
self.app.logger.debug(
"File saved to "
@@ -113,9 +115,7 @@ class Web:
)
return True
self.app.logger.error(
"Could not save file because the filename is forbidden"
)
self.app.logger.error("Could not save file because the filename is forbidden")
raise RuntimeError("This file type is forbidden.")
def get_queue_state(self):