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 # dede
""" """
def __init__( def __init__(self, print_queue, app, configuration_file):
self,
print_queue,
app,
configuration_file
):
self.print_queue = print_queue self.print_queue = print_queue
self.app = app self.app = app
self.configuration_file = configuration_file self.configuration_file = configuration_file
@@ -68,7 +63,9 @@ class Raspberry:
self.app.logger.warning( self.app.logger.warning(
"Couldn't get sufficient hardware information from /proc/cpuinfo" "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 return False
except IOError: except IOError:
self.app.logger.error("Unable to open `/proc/cpuinfo`.") self.app.logger.error("Unable to open `/proc/cpuinfo`.")
@@ -95,13 +92,16 @@ class Raspberry:
self.indicator_countdown(iters=3) self.indicator_countdown(iters=3)
self.button = Button( self.button = Button(
self.configuration_file["rpi"]["button_gpio_port_number"], 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.button.when_pressed = self.on_button_pressed
self.app.logger.debug("Activated button") self.app.logger.debug("Activated button")
# The "flash" is a relay-controlled device ( light bulb for example ) # 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.flash_toggle()
self.app.logger.debug("Activated flash") self.app.logger.debug("Activated flash")
@@ -215,9 +215,9 @@ class Raspberry:
y = image.height - logo.height - margin y = image.height - logo.height - margin
else: else:
raise ValueError( raise ValueError(
"Invalid position." + "Invalid position."
"Choose from 'bottom_right', 'top_left', " + + "Choose from 'bottom_right', 'top_left', "
" 'top_right', or 'bottom_left'." + " 'top_right', or 'bottom_left'."
) )
# Composite the logo onto the image # 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)) image.save(os.path.join(self.app.config["UPLOAD_FOLDER"], filename))
except OSError as e: except OSError as e:
self.app.logger.error("Could not save file %s", 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( self.app.logger.debug(
"File saved to " "File saved to "
@@ -113,9 +115,7 @@ class Web:
) )
return True return True
self.app.logger.error( self.app.logger.error("Could not save file because the filename is forbidden")
"Could not save file because the filename is forbidden"
)
raise RuntimeError("This file type is forbidden.") raise RuntimeError("This file type is forbidden.")
def get_queue_state(self): def get_queue_state(self):