diff --git a/archinstall/lib/disk/disk_menu.py b/archinstall/lib/disk/disk_menu.py index 1e255aa610..9e91e3ce0b 100644 --- a/archinstall/lib/disk/disk_menu.py +++ b/archinstall/lib/disk/disk_menu.py @@ -2,7 +2,6 @@ from archinstall.tui import MenuItem, MenuItemGroup -from ..disk import DeviceModification from ..interactions import select_disk_config from ..interactions.disk_conf import select_lvm_config from ..menu import AbstractSubMenu @@ -101,8 +100,7 @@ def _prev_disk_layouts(self, item: MenuItem) -> str | None: msg += str(_('Mountpoint')) + ': ' + str(disk_layout_conf.mountpoint) return msg - device_mods: list[DeviceModification] = \ - list(filter(lambda x: len(x.partitions) > 0, disk_layout_conf.device_modifications)) + device_mods = [d for d in disk_layout_conf.device_modifications if d.partitions] if device_mods: output_partition = '{}: {}\n'.format(str(_('Configuration')), disk_layout_conf.config_type.display_msg()) @@ -116,9 +114,7 @@ def _prev_disk_layouts(self, item: MenuItem) -> str | None: output_partition += partition_table + '\n' # create btrfs table - btrfs_partitions = list( - filter(lambda p: len(p.btrfs_subvols) > 0, mod.partitions) - ) + btrfs_partitions = [p for p in mod.partitions if p.btrfs_subvols] for partition in btrfs_partitions: output_btrfs += FormattedOutput.as_table(partition.btrfs_subvols) + '\n' diff --git a/archinstall/lib/disk/encryption_menu.py b/archinstall/lib/disk/encryption_menu.py index 3f8e99f3c9..1d62935ef8 100644 --- a/archinstall/lib/disk/encryption_menu.py +++ b/archinstall/lib/disk/encryption_menu.py @@ -284,10 +284,10 @@ def select_partitions_to_encrypt( # do not allow encrypting the boot partition for mod in modification: - partitions += list(filter(lambda x: x.mountpoint != Path('/boot'), mod.partitions)) + partitions += [p for p in mod.partitions if p.mountpoint != Path('/boot')] # do not allow encrypting existing partitions that are not marked as wipe - avail_partitions = list(filter(lambda x: not x.exists(), partitions)) + avail_partitions = [p for p in partitions if not p.exists()] if avail_partitions: group, header = MenuHelper.create_table(data=avail_partitions) diff --git a/archinstall/lib/disk/filesystem.py b/archinstall/lib/disk/filesystem.py index 9f906e589c..874c41ae53 100644 --- a/archinstall/lib/disk/filesystem.py +++ b/archinstall/lib/disk/filesystem.py @@ -49,7 +49,7 @@ def perform_filesystem_operations(self, show_countdown: bool = True) -> None: debug('Disk layout configuration is set to pre-mount, not performing any operations') return - device_mods = list(filter(lambda x: len(x.partitions) > 0, self._disk_config.device_modifications)) + device_mods = [d for d in self._disk_config.device_modifications if d.partitions] if not device_mods: debug('No modifications required') diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index f8ea21141c..064a1a355d 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -242,7 +242,7 @@ def _mount_partition_layout(self, luks_handlers: dict[Any, Luks2]) -> None: break for mod in sorted_device_mods: - not_pv_part_mods = list(filter(lambda x: x not in pvs, mod.partitions)) + not_pv_part_mods = [p for p in mod.partitions if p not in pvs] # partitions have to mounted in the right order on btrfs the mountpoint will # be empty as the actual subvolumes are getting mounted instead so we'll use diff --git a/archinstall/lib/interactions/disk_conf.py b/archinstall/lib/interactions/disk_conf.py index d48b419a3b..1847f30de8 100644 --- a/archinstall/lib/interactions/disk_conf.py +++ b/archinstall/lib/interactions/disk_conf.py @@ -462,7 +462,7 @@ def suggest_multi_disk_layout( filesystem_type = select_main_filesystem_format(advanced_options) # find proper disk for /home - possible_devices = list(filter(lambda x: x.device_info.total_size >= min_home_partition_size, devices)) + possible_devices = [d for d in devices if d.device_info.total_size >= min_home_partition_size] home_device = max(possible_devices, key=lambda d: d.device_info.total_size) if possible_devices else None # find proper device for /root diff --git a/archinstall/lib/profile/profiles_handler.py b/archinstall/lib/profile/profiles_handler.py index 2b0bc3c2fe..f5bbde17aa 100644 --- a/archinstall/lib/profile/profiles_handler.py +++ b/archinstall/lib/profile/profiles_handler.py @@ -164,21 +164,20 @@ def get_profile_by_name(self, name: str) -> Profile | None: return next(filter(lambda x: x.name == name, self.profiles), None) # type: ignore def get_top_level_profiles(self) -> list[Profile]: - return list(filter(lambda x: x.is_top_level_profile(), self.profiles)) + return [p for p in self.profiles if p.is_top_level_profile()] def get_server_profiles(self) -> list[Profile]: - return list(filter(lambda x: x.is_server_type_profile(), self.profiles)) + return [p for p in self.profiles if p.is_server_type_profile()] def get_desktop_profiles(self) -> list[Profile]: - return list(filter(lambda x: x.is_desktop_type_profile(), self.profiles)) + return [p for p in self.profiles if p.is_desktop_type_profile()] def get_custom_profiles(self) -> list[Profile]: - return list(filter(lambda x: x.is_custom_type_profile(), self.profiles)) + return [p for p in self.profiles if p.is_custom_type_profile()] def get_mac_addr_profiles(self) -> list[Profile]: - tailored = list(filter(lambda x: x.is_tailored(), self.profiles)) - match_mac_addr_profiles = list(filter(lambda x: x.name in self._local_mac_addresses, tailored)) - return match_mac_addr_profiles + tailored = [p for p in self.profiles if p.is_tailored()] + return [t for t in tailored if t.name in self._local_mac_addresses] def install_greeter(self, install_session: 'Installer', greeter: GreeterType) -> None: packages = [] @@ -296,7 +295,7 @@ def _verify_unique_profile_names(self, profiles: list[Profile]) -> None: that the provided list contains only default_profiles with unique names """ counter = Counter([p.name for p in profiles]) - duplicates = list(filter(lambda x: x[1] != 1, counter.items())) + duplicates = [x for x in counter.items() if x[1] != 1] if len(duplicates) > 0: err = str(_('Profiles must have unique name, but profile definitions with duplicate name found: {}')).format(duplicates[0][0]) diff --git a/archinstall/scripts/minimal.py b/archinstall/scripts/minimal.py index 3395b7b0c7..e287f78045 100644 --- a/archinstall/scripts/minimal.py +++ b/archinstall/scripts/minimal.py @@ -74,7 +74,7 @@ def parse_disk_encryption() -> None: # encrypt all partitions except the /boot for mod in modification: - partitions += list(filter(lambda x: x.mountpoint != Path('/boot'), mod.partitions)) + partitions += [p for p in mod.partitions if p.mountpoint != Path('/boot')] archinstall.arguments['disk_encryption'] = disk.DiskEncryption( encryption_type=disk.EncryptionType.Luks, diff --git a/examples/minimal_installation.py b/examples/minimal_installation.py index eeec2dc37e..f532206e8c 100644 --- a/examples/minimal_installation.py +++ b/examples/minimal_installation.py @@ -74,7 +74,7 @@ def parse_disk_encryption() -> None: # encrypt all partitions except the /boot for mod in modification: - partitions += list(filter(lambda x: x.mountpoint != Path('/boot'), mod.partitions)) + partitions += [p for p in mod.partitions if p.mountpoint != Path('/boot')] archinstall.arguments['disk_encryption'] = disk.DiskEncryption( encryption_type=disk.EncryptionType.Luks,