Skip to content

Commit dddedd9

Browse files
committed
Run pre-commit
1 parent 7d12b16 commit dddedd9

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

adafruit_shell.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
"labwc": "W3",
5555
}
5656

57+
5758
# pylint: disable=too-many-public-methods
5859
class Shell:
5960
"""
@@ -590,9 +591,9 @@ def is_minumum_version(self, version):
590591
if version.lower() not in RASPI_VERSIONS:
591592
raise ValueError("Invalid version")
592593
# Check that the current version is at least the specified version
593-
return RASPI_VERSIONS.index(self.get_raspbian_version()) >= RASPI_VERSIONS.index(
594-
version.lower()
595-
)
594+
return RASPI_VERSIONS.index(
595+
self.get_raspbian_version()
596+
) >= RASPI_VERSIONS.index(version.lower())
596597

597598
def prompt_reboot(self, default="y", **kwargs):
598599
"""Prompt the user for a reboot"""
@@ -622,8 +623,11 @@ def check_kernel_userspace_mismatch(self, attempt_fix=True, fix_with_x11=False):
622623
"Unable to compile driver because kernel space is 64-bit, but user space is 32-bit."
623624
)
624625
config = self.get_boot_config()
625-
if self.is_raspberry_pi_os() and attempt_fix and config and self.prompt(
626-
f"Add parameter to {config} to use 32-bit kernel?"
626+
if (
627+
self.is_raspberry_pi_os()
628+
and attempt_fix
629+
and config
630+
and self.prompt(f"Add parameter to {config} to use 32-bit kernel?")
627631
):
628632
# Set to use 32-bit kernel
629633
self.reconfig(config, "^.*arm_64bit.*$", "arm_64bit=0")
@@ -640,14 +644,16 @@ def set_window_manager(self, manager):
640644
if not self.is_minumum_version("bullseye"):
641645
return
642646

643-
if manager.lower() not in WINDOW_MANAGERS.keys():
647+
if manager.lower() not in WINDOW_MANAGERS:
644648
raise ValueError("Invalid window manager")
645649

646650
if manager.lower() == "labwc" and not self.exists("/usr/bin/labwc"):
647651
raise RuntimeError("labwc is not installed")
648652

649653
print(f"Using {manager} as the window manager")
650-
if not self.run_command("sudo raspi-config nonint do_wayland " + WINDOW_MANAGERS[manager.lower()]):
654+
if not self.run_command(
655+
"sudo raspi-config nonint do_wayland " + WINDOW_MANAGERS[manager.lower()]
656+
):
651657
raise RuntimeError("Unable to change window manager")
652658

653659
def get_boot_config(self):
@@ -657,7 +663,7 @@ def get_boot_config(self):
657663
# check if /boot/firmware/config.txt exists
658664
if self.exists("/boot/firmware/config.txt"):
659665
return "/boot/firmware/config.txt"
660-
elif self.exists("/boot/config.txt"):
666+
if self.exists("/boot/config.txt"):
661667
return "/boot/config.txt"
662668
return None
663669

0 commit comments

Comments
 (0)