Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions archinstall/default_profiles/desktops/plasma.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ def packages(self) -> list[str]:
if flavor_str is not None:
flavor = PlasmaFlavor(flavor_str)
return flavor.packages()
else:
return PlasmaFlavor.Meta.packages() # use plasma-meta as the recommended default

return PlasmaFlavor.Meta.packages() # use plasma-meta as the recommended default

@property
@override
Expand Down
4 changes: 2 additions & 2 deletions archinstall/default_profiles/desktops/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,5 @@ async def select_seat_access(profile_name: str, default: str | None) -> SeatAcce

if result.type_ == ResultType.Selection:
return result.get_value()
else:
raise ValueError('Unexpected result type from seat access selection')

raise ValueError('Unexpected result type from seat access selection')
9 changes: 5 additions & 4 deletions archinstall/default_profiles/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,11 @@ def is_custom_type_profile(self) -> bool:
def is_graphic_driver_supported(self) -> bool:
if not self.current_selection:
return self._support_gfx_driver
else:
if any(p._support_gfx_driver for p in self.current_selection):
return True
return False

if any(p._support_gfx_driver for p in self.current_selection):
return True

return False

def is_greeter_supported(self) -> bool:
return self._support_greeter
Expand Down
8 changes: 2 additions & 6 deletions archinstall/lib/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,9 +461,7 @@ def as_summary(self) -> str:
if summary:
cfg[config_type.text()] = summary

simple_summary = as_key_value_pair(cfg, ignore_empty=True)

return simple_summary
return as_key_value_pair(cfg, ignore_empty=True)


class ArchConfigHandler:
Expand Down Expand Up @@ -701,9 +699,7 @@ def _parse_config(self) -> dict[str, Any]:
if json_data is not None:
config.update(json_data)

config = self._cleanup_config(config)

return config
return self._cleanup_config(config)

def _process_creds_data(self, creds_data: str) -> dict[str, Any] | None:
if creds_data.startswith('$'): # encrypted data
Expand Down
6 changes: 2 additions & 4 deletions archinstall/lib/authentication/authentication_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ def _define_menu_options(self) -> list[MenuItem]:

async def _create_user_account(self, preset: list[User] | None = None) -> list[User]:
preset = [] if preset is None else preset
users = await select_users(preset=preset)
return users
return await select_users(preset=preset)

def _prev_users(self, item: MenuItem) -> str | None:
users: list[User] | None = item.value
Expand Down Expand Up @@ -100,8 +99,7 @@ def _prev_u2f_login(self, item: MenuItem) -> str | None:


async def select_root_password() -> Password | None:
password = await get_password(header=tr('Enter root password'), allow_skip=True)
return password
return await get_password(header=tr('Enter root password'), allow_skip=True)


async def select_u2f_login(preset: U2FLoginConfiguration | None) -> U2FLoginConfiguration | None:
Expand Down
4 changes: 2 additions & 2 deletions archinstall/lib/bootloader/bootloader_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ def _prev_uki(self, item: MenuItem) -> str | None:
uki_text = f'{tr("Unified kernel images")}'
if item.value:
return f'{uki_text}: {tr("Enabled")}'
else:
return f'{uki_text}: {tr("Disabled")}'

return f'{uki_text}: {tr("Disabled")}'

def _prev_removable(self, item: MenuItem) -> str | None:
if item.value:
Expand Down
11 changes: 6 additions & 5 deletions archinstall/lib/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,13 +259,14 @@ def __iter__(self, *args: list[Any], **kwargs: dict[str, Any]) -> Iterator[bytes
def __getitem__(self, key: slice) -> bytes:
if not self.session:
raise KeyError('SysCommand() does not have an active session.')
elif type(key) is slice:

if type(key) is slice:
start = key.start or 0
end = key.stop or len(self.session._trace_log)

return self.session._trace_log[start:end]
else:
raise ValueError("SysCommand() doesn't have key & value pairs, only slices, SysCommand('ls')[:10] as an example.")

raise ValueError("SysCommand() doesn't have key & value pairs, only slices, SysCommand('ls')[:10] as an example.")

@override
def __repr__(self, *args: list[Any], **kwargs: dict[str, Any]) -> str:
Expand Down Expand Up @@ -321,8 +322,8 @@ def output(self, remove_cr: bool = True) -> bytes:
def exit_code(self) -> int | None:
if self.session:
return self.session.exit_code
else:
return None

return None

@property
def trace_log(self) -> bytes | None:
Expand Down
3 changes: 1 addition & 2 deletions archinstall/lib/crypt.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ def _search_login_defs(key: str) -> str | None:
continue

if line.startswith(key):
value = line.split(' ')[1]
return value
return line.split(' ')[1]

return None

Expand Down
21 changes: 11 additions & 10 deletions archinstall/lib/disk/default_layouts.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ async def get_default_partition_layout(
filesystem_type=filesystem_type,
)
return [device_modification]
else:
return await suggest_multi_disk_layout(
devices,
filesystem_type=filesystem_type,
)

return await suggest_multi_disk_layout(
devices,
filesystem_type=filesystem_type,
)


def _boot_partition(sector_size: SectorSize, using_gpt: bool) -> PartitionModification:
Expand Down Expand Up @@ -118,13 +118,14 @@ def process_root_partition_size(total_size: Size, sector_size: SectorSize) -> Si
if total_device_size.value > 500:
# maximum size
return Size(value=50, unit=Unit.GiB, sector_size=sector_size)
elif total_device_size.value < 320:

if total_device_size.value < 320:
# minimum size
return Size(value=32, unit=Unit.GiB, sector_size=sector_size)
else:
# 10% of total size
length = total_device_size.value // 10
return Size(value=length, unit=Unit.GiB, sector_size=sector_size)

# 10% of total size
length = total_device_size.value // 10
return Size(value=length, unit=Unit.GiB, sector_size=sector_size)


def get_default_btrfs_subvols() -> list[SubvolumeModification]:
Expand Down
2 changes: 1 addition & 1 deletion archinstall/lib/disk/device_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def _determine_fs_type(
if partition.fileSystem.type == FilesystemType.LINUX_SWAP.parted_value:
return FilesystemType.LINUX_SWAP
return FilesystemType(partition.fileSystem.type)
elif lsblk_info is not None:
if lsblk_info is not None:
return FilesystemType(lsblk_info.fstype) if lsblk_info.fstype else None
return None
except ValueError:
Expand Down
4 changes: 1 addition & 3 deletions archinstall/lib/disk/disk_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,7 @@ async def _select_disk_encryption(self, preset: DiskEncryption | None) -> DiskEn
if not DiskEncryption.validate_enc(modifications, lvm_config):
return None

disk_encryption = await DiskEncryptionMenu(modifications, lvm_config=lvm_config, preset=preset).show()

return disk_encryption
return await DiskEncryptionMenu(modifications, lvm_config=lvm_config, preset=preset).show()

async def _select_disk_layout_config(self, preset: DiskLayoutConfiguration | None) -> DiskLayoutConfiguration | None:
disk_config = await select_disk_config(preset)
Expand Down
10 changes: 3 additions & 7 deletions archinstall/lib/disk/encryption_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,13 +271,11 @@ async def select_encryption_type(

async def select_encrypted_password() -> Password | None:
header = tr('Enter disk encryption password (leave blank for no encryption)') + '\n'
password = await get_password(
return await get_password(
header=header,
allow_skip=True,
)

return password


async def select_hsm(preset: Fido2Device | None = None) -> Fido2Device | None:
header = tr('Select a FIDO2 device to use for HSM') + '\n'
Expand Down Expand Up @@ -337,8 +335,7 @@ async def select_partitions_to_encrypt(
case ResultType.Skip:
return preset
case ResultType.Selection:
partitions = result.get_values()
return partitions
return result.get_values()

return []

Expand Down Expand Up @@ -366,8 +363,7 @@ async def select_lvm_vols_to_encrypt(
case ResultType.Skip:
return preset
case ResultType.Selection:
volumes = result.get_values()
return volumes
return result.get_values()

return []

Expand Down
8 changes: 4 additions & 4 deletions archinstall/lib/disk/luks.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ def _password_bytes(self) -> bytes:

if isinstance(self.password, bytes):
return self.password
else:
return bytes(self.password.plaintext, 'UTF-8')

return bytes(self.password.plaintext, 'UTF-8')

def _get_passphrase_args(
self,
Expand Down Expand Up @@ -195,8 +195,8 @@ def create_keyfile(self, target_path: Path, override: bool = False) -> None:
if not override:
info(f'Key file {key_file} already exists, keeping existing')
return
else:
info(f'Key file {key_file} already exists, overriding')

info(f'Key file {key_file} already exists, overriding')

key_file.parent.mkdir(parents=True, exist_ok=True)

Expand Down
8 changes: 5 additions & 3 deletions archinstall/lib/disk/partitioning_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def selected_action_display(self, selection: DiskSegment) -> str:
if isinstance(selection.segment, PartitionModification):
if selection.segment.status == ModificationStatus.CREATE:
return tr('Partition - New')
elif selection.segment.is_delete() and selection.segment.dev_path:
if selection.segment.is_delete() and selection.segment.dev_path:
title = tr('Partition') + '\n\n'
title += 'status: delete\n'
title += f'device: {selection.segment.dev_path}\n'
Expand Down Expand Up @@ -394,7 +394,8 @@ async def _prompt_formatting(self, partition: PartitionModification) -> None:
if partition.is_modify():
partition.status = ModificationStatus.EXIST
return
elif partition.exists():

if partition.exists():
partition.status = ModificationStatus.MODIFY

# If we mark a partition for formatting, but the format is CRYPTO LUKS, there's no point in formatting it really
Expand Down Expand Up @@ -461,7 +462,8 @@ def _validate_value(

if size.format_highest() == max_size.format_highest():
return max_size
elif size > max_size or size < self._buffer:

if size > max_size or size < self._buffer:
return None

return size
Expand Down
30 changes: 9 additions & 21 deletions archinstall/lib/global_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def __init__(
super().__init__(self._item_group, config=arch_config, title=title)

def _get_menu_options(self) -> list[MenuItem]:
menu_options = [
return [
MenuItem(
text=tr('Archinstall language'),
action=self._select_archinstall_language,
Expand Down Expand Up @@ -191,8 +191,6 @@ def _get_menu_options(self) -> list[MenuItem]:
),
]

return menu_options

async def _safe_config(self) -> None:
# data: dict[str, Any] = {}
# for item in self._item_group.items:
Expand Down Expand Up @@ -264,12 +262,10 @@ def _prev_archinstall_language(self, item: MenuItem) -> str | None:
return f'{tr("Language")}: {lang.display_name}'

async def _select_applications(self, preset: ApplicationConfiguration | None) -> ApplicationConfiguration | None:
app_config = await ApplicationMenu(preset).show()
return app_config
return await ApplicationMenu(preset).show()

async def _select_authentication(self, preset: AuthenticationConfiguration | None) -> AuthenticationConfiguration | None:
auth_config = await AuthenticationMenu(preset).show()
return auth_config
return await AuthenticationMenu(preset).show()

def _update_lang_text(self) -> None:
"""
Expand All @@ -285,8 +281,7 @@ def _update_lang_text(self) -> None:
tui.translate_bindings()

async def _locale_selection(self, preset: LocaleConfiguration) -> LocaleConfiguration | None:
locale_config = await LocaleMenu(preset).show()
return locale_config
return await LocaleMenu(preset).show()

def _prev_locale(self, item: MenuItem) -> str | None:
if not item.value:
Expand All @@ -308,8 +303,7 @@ def _prev_network_config(self, item: MenuItem) -> str | None:

def _prev_additional_pkgs(self, item: MenuItem) -> str | None:
if item.value:
output = '\n'.join(sorted(item.value))
return output
return '\n'.join(sorted(item.value))
return None

def _prev_authentication(self, item: MenuItem) -> str | None:
Expand Down Expand Up @@ -560,8 +554,7 @@ async def _select_disk_config(
self,
preset: DiskLayoutConfiguration | None = None,
) -> DiskLayoutConfiguration | None:
disk_config = await DiskLayoutConfigurationMenu(preset).show()
return disk_config
return await DiskLayoutConfigurationMenu(preset).show()

async def _select_bootloader_config(
self,
Expand All @@ -570,15 +563,12 @@ async def _select_bootloader_config(
if preset is None:
preset = BootloaderConfiguration.get_default(self._uefi, self._skip_boot)

bootloader_config = await BootloaderMenu(preset, self._uefi, self._skip_boot).show()

return bootloader_config
return await BootloaderMenu(preset, self._uefi, self._skip_boot).show()

async def _select_profile(self, current_profile: ProfileConfiguration | None) -> ProfileConfiguration | None:
from archinstall.lib.profile.profile_menu import ProfileMenu

profile_config = await ProfileMenu(preset=current_profile).show()
return profile_config
return await ProfileMenu(preset=current_profile).show()

async def _select_additional_packages(self, preset: list[str]) -> list[str]:
config: MirrorConfiguration | None = self._item_group.find_by_key('mirror_config').value
Expand All @@ -587,13 +577,11 @@ async def _select_additional_packages(self, preset: list[str]) -> list[str]:
if config:
repositories = set(config.optional_repositories)

packages = await select_additional_packages(
return await select_additional_packages(
preset,
repositories=repositories,
)

return packages

async def _mirror_configuration(self, preset: MirrorConfiguration | None = None) -> MirrorConfiguration | None:
if self._mirror_list_handler is None:
self._mirror_list_handler = MirrorListHandler()
Expand Down
Loading
Loading