From 4c7d551933aa4ad00c637f78a9903711c426b97d Mon Sep 17 00:00:00 2001 From: codefiles <11915375+codefiles@users.noreply.github.com> Date: Sat, 26 Sep 2026 12:06:21 -0400 Subject: [PATCH 1/5] Fix invalid-function-name --- archinstall/lib/boot.py | 4 ++-- archinstall/lib/disk/device_handler.py | 2 +- archinstall/lib/disk/luks.py | 2 +- archinstall/lib/installer.py | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/archinstall/lib/boot.py b/archinstall/lib/boot.py index d296eb0139..e82fc6fbb9 100644 --- a/archinstall/lib/boot.py +++ b/archinstall/lib/boot.py @@ -104,8 +104,8 @@ def is_alive(self) -> bool: return self.session.is_alive() - def SysCommand(self, cmd: list[str], *args: Any, **kwargs: Any) -> SysCommand: + def sys_command(self, cmd: list[str], *args: Any, **kwargs: Any) -> SysCommand: return SysCommand(['systemd-run', f'--machine={self.container_name}', '--pty', *cmd], *args, **kwargs) - def SysCommandWorker(self, cmd: list[str], *args: Any, **kwargs: Any) -> SysCommandWorker: + def sys_command_worker(self, cmd: list[str], *args: Any, **kwargs: Any) -> SysCommandWorker: return SysCommandWorker(['systemd-run', f'--machine={self.container_name}', '--pty', *cmd], *args, **kwargs) diff --git a/archinstall/lib/disk/device_handler.py b/archinstall/lib/disk/device_handler.py index afc9db6371..ff160a5dc9 100644 --- a/archinstall/lib/disk/device_handler.py +++ b/archinstall/lib/disk/device_handler.py @@ -629,7 +629,7 @@ def wipe_dev(self, block_device: BDevice) -> None: for partition in block_device.partition_infos: luks = Luks2(partition.path) - if luks.isLuks(): + if luks.is_luks(): luks.erase() self._wipe(partition.path) diff --git a/archinstall/lib/disk/luks.py b/archinstall/lib/disk/luks.py index 3a3679d0b2..8c3c1a4fb9 100644 --- a/archinstall/lib/disk/luks.py +++ b/archinstall/lib/disk/luks.py @@ -27,7 +27,7 @@ def mapper_dev(self) -> Path | None: return Path(f'/dev/mapper/{self.mapper_name}') return None - def isLuks(self) -> bool: + def is_luks(self) -> bool: try: SysCommand(f'cryptsetup isLuks {self.luks_dev_path}') return True diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 499f52ba1a..df22f768f5 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -2051,7 +2051,7 @@ def set_keyboard_language(self, language: str) -> bool: os.system('systemd-run --machine=archinstall --pty localectl set-keymap ""') # type: ignore[deprecated] try: - session.SysCommand(['localectl', 'set-keymap', language]) + session.sys_command(['localectl', 'set-keymap', language]) except SysCallError as err: raise ServiceException(f"Unable to set locale '{language}' for console: {err}") @@ -2074,10 +2074,10 @@ def set_x11_keyboard_language(self, language: str) -> bool: return False with Boot(self.target) as session: - session.SysCommand(['localectl', 'set-x11-keymap', '""']) + session.sys_command(['localectl', 'set-x11-keymap', '""']) try: - session.SysCommand(['localectl', 'set-x11-keymap', language]) + session.sys_command(['localectl', 'set-x11-keymap', language]) except SysCallError as err: raise ServiceException(f"Unable to set locale '{language}' for X11: {err}") else: From 283609dfb911bd8ffe05ffb7c7424e99a5039dd8 Mon Sep 17 00:00:00 2001 From: codefiles <11915375+codefiles@users.noreply.github.com> Date: Sat, 26 Sep 2026 12:07:08 -0400 Subject: [PATCH 2/5] Fix non-lowercase-variable-in-function --- archinstall/lib/user/user_menu.py | 6 +++--- archinstall/tui/components.py | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/archinstall/lib/user/user_menu.py b/archinstall/lib/user/user_menu.py index d3e6d88119..9efe26977d 100644 --- a/archinstall/lib/user/user_menu.py +++ b/archinstall/lib/user/user_menu.py @@ -65,17 +65,17 @@ def _check_for_correct_username(self, username: str | None) -> str | None: return tr('The username you entered is invalid') async def _add_user(self) -> User | None: - editResult = await Input( + edit_result = await Input( tr('Enter a username'), allow_skip=True, validator_callback=self._check_for_correct_username, ).show() - match editResult.type_: + match edit_result.type_: case ResultType.Skip: return None case ResultType.Selection: - username = editResult.get_value() + username = edit_result.get_value() case _: raise ValueError('Unhandled result type') diff --git a/archinstall/tui/components.py b/archinstall/tui/components.py index ada1f5c30b..f8a86e1b17 100644 --- a/archinstall/tui/components.py +++ b/archinstall/tui/components.py @@ -310,10 +310,10 @@ def compose(self) -> ComposeResult: with Vertical(classes='list-container'): yield option_list else: - Container = Horizontal if self._preview_location == 'right' else Vertical + container = Horizontal if self._preview_location == 'right' else Vertical rule_orientation: Literal['horizontal', 'vertical'] = 'vertical' if self._preview_location == 'right' else 'horizontal' - with Container(): + with container(): yield option_list yield Rule(orientation=rule_orientation) preview_label = Label('', id='preview_content', markup=False) @@ -541,10 +541,10 @@ def compose(self) -> ComposeResult: with Vertical(classes='list-container'): yield selection_list else: - Container = Horizontal if self._preview_location == 'right' else Vertical + container = Horizontal if self._preview_location == 'right' else Vertical rule_orientation: Literal['horizontal', 'vertical'] = 'vertical' if self._preview_location == 'right' else 'horizontal' - with Container(): + with container(): yield selection_list yield Rule(orientation=rule_orientation) preview_label = Label('', id='preview_content', markup=False) From 667a9dc462a9d42f60a2f5fb62cea8567dfac9a6 Mon Sep 17 00:00:00 2001 From: codefiles <11915375+codefiles@users.noreply.github.com> Date: Sat, 26 Sep 2026 12:08:41 -0400 Subject: [PATCH 3/5] Ignore a mixed-case-variable-in-class-scope error --- archinstall/lib/models/device.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archinstall/lib/models/device.py b/archinstall/lib/models/device.py index 577c6dedad..626fee5f47 100644 --- a/archinstall/lib/models/device.py +++ b/archinstall/lib/models/device.py @@ -264,7 +264,7 @@ class Units(Enum): class Unit(Enum): B = 1 # byte - kB = 1000**1 # kilobyte + kB = 1000**1 # kilobyte # noqa: N815 MB = 1000**2 # megabyte GB = 1000**3 # gigabyte TB = 1000**4 # terabyte From 7b49702b3d61ecf5eb98dde67282cce33fe73419 Mon Sep 17 00:00:00 2001 From: codefiles <11915375+codefiles@users.noreply.github.com> Date: Sat, 26 Sep 2026 12:09:51 -0400 Subject: [PATCH 4/5] Fix error-suffix-on-exception-name --- archinstall/lib/disk/device_handler.py | 4 ++-- archinstall/lib/exceptions.py | 8 ++++---- archinstall/lib/general/general_menu.py | 4 ++-- archinstall/lib/installer.py | 16 +++++++++++----- archinstall/lib/locale/utils.py | 4 ++-- archinstall/lib/networking.py | 8 ++++---- 6 files changed, 25 insertions(+), 19 deletions(-) diff --git a/archinstall/lib/disk/device_handler.py b/archinstall/lib/disk/device_handler.py index ff160a5dc9..35202909e8 100644 --- a/archinstall/lib/disk/device_handler.py +++ b/archinstall/lib/disk/device_handler.py @@ -16,7 +16,7 @@ udev_sync, umount, ) -from archinstall.lib.exceptions import DiskError, SysCallError, UnknownFilesystemFormat +from archinstall.lib.exceptions import DiskError, SysCallError, UnknownFilesystemFormatError from archinstall.lib.hardware import SysInfo from archinstall.lib.log import debug, error, info, log from archinstall.lib.models.device import ( @@ -259,7 +259,7 @@ def format( case FilesystemType.LINUX_SWAP: command = 'mkswap' case _: - raise UnknownFilesystemFormat(f'Filetype "{fs_type.value}" is not supported') + raise UnknownFilesystemFormatError(f'Filetype "{fs_type.value}" is not supported') if not command: command = f'mkfs.{mkfs_type}' diff --git a/archinstall/lib/exceptions.py b/archinstall/lib/exceptions.py index fb37ef25d9..b0aef8ef0a 100644 --- a/archinstall/lib/exceptions.py +++ b/archinstall/lib/exceptions.py @@ -6,7 +6,7 @@ class DiskError(Exception): pass -class UnknownFilesystemFormat(Exception): +class UnknownFilesystemFormatError(Exception): pass @@ -22,7 +22,7 @@ class HardwareIncompatibilityError(Exception): pass -class ServiceException(Exception): +class ServiceExceptionError(Exception): pass @@ -30,11 +30,11 @@ class PackageError(Exception): pass -class Deprecated(Exception): +class DeprecatedError(Exception): pass -class DownloadTimeout(Exception): +class DownloadTimeoutError(Exception): """ Download timeout exception raised by DownloadTimer. """ diff --git a/archinstall/lib/general/general_menu.py b/archinstall/lib/general/general_menu.py index dcf7d8aab6..79b683eb3b 100644 --- a/archinstall/lib/general/general_menu.py +++ b/archinstall/lib/general/general_menu.py @@ -87,8 +87,8 @@ async def select_language(preset: str | None = None) -> str | None: from archinstall.lib.locale.locale_menu import select_kb_layout # We'll raise an exception in an upcoming version. - # from ..exceptions import Deprecated - # raise Deprecated("select_language() has been deprecated, use select_kb_layout() instead.") + # from ..exceptions import DeprecatedError + # raise DeprecatedError("select_language() has been deprecated, use select_kb_layout() instead.") # No need to translate this i feel, as it's a short lived message. warn('select_language() is deprecated, use select_kb_layout() instead. select_language() will be removed in a future version') diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index df22f768f5..fc3be4f76b 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -25,7 +25,13 @@ mount, swapon, ) -from archinstall.lib.exceptions import DiskError, HardwareIncompatibilityError, RequirementError, ServiceException, SysCallError +from archinstall.lib.exceptions import ( + DiskError, + HardwareIncompatibilityError, + RequirementError, + ServiceExceptionError, + SysCallError, +) from archinstall.lib.hardware import SysInfo from archinstall.lib.linux_path import LPath from archinstall.lib.locale.utils import verify_keyboard_layout, verify_x11_keyboard_layout @@ -713,7 +719,7 @@ def enable_service(self, services: str | list[str]) -> None: try: SysCommand(f'systemctl --root={self.target} enable {service}') except SysCallError as err: - raise ServiceException(f'Unable to start service {service}: {err}') + raise ServiceExceptionError(f'Unable to start service {service}: {err}') for plugin in plugins.values(): if hasattr(plugin, 'on_service'): @@ -729,7 +735,7 @@ def disable_service(self, services_disable: str | list[str]) -> None: try: SysCommand(f'systemctl --root={self.target} disable {service}') except SysCallError as err: - raise ServiceException(f'Unable to disable service {service}: {err}') + raise ServiceExceptionError(f'Unable to disable service {service}: {err}') def run_command(self, cmd: str, peek_output: bool = False) -> SysCommand: return SysCommand(f'arch-chroot -S {self.target} {cmd}', peek_output=peek_output) @@ -2053,7 +2059,7 @@ def set_keyboard_language(self, language: str) -> bool: try: session.sys_command(['localectl', 'set-keymap', language]) except SysCallError as err: - raise ServiceException(f"Unable to set locale '{language}' for console: {err}") + raise ServiceExceptionError(f"Unable to set locale '{language}' for console: {err}") info(f'Keyboard language for this installation is now set to: {language}') else: @@ -2079,7 +2085,7 @@ def set_x11_keyboard_language(self, language: str) -> bool: try: session.sys_command(['localectl', 'set-x11-keymap', language]) except SysCallError as err: - raise ServiceException(f"Unable to set locale '{language}' for X11: {err}") + raise ServiceExceptionError(f"Unable to set locale '{language}' for X11: {err}") else: info('X11-Keyboard language was not changed from default (no language specified)') diff --git a/archinstall/lib/locale/utils.py b/archinstall/lib/locale/utils.py index 31946028fa..b53f124521 100644 --- a/archinstall/lib/locale/utils.py +++ b/archinstall/lib/locale/utils.py @@ -2,7 +2,7 @@ from pathlib import Path from archinstall.lib.command import SysCommand -from archinstall.lib.exceptions import ServiceException, SysCallError +from archinstall.lib.exceptions import ServiceExceptionError, SysCallError from archinstall.lib.log import error from archinstall.lib.utils.util import running_from_iso @@ -103,7 +103,7 @@ def set_kb_layout(locale: str) -> bool: try: SysCommand(f'localectl set-keymap {locale}') except SysCallError as err: - raise ServiceException(f"Unable to set locale '{locale}' for console: {err}") + raise ServiceExceptionError(f"Unable to set locale '{locale}' for console: {err}") return True diff --git a/archinstall/lib/networking.py b/archinstall/lib/networking.py index 6ceae95a12..863c191caa 100644 --- a/archinstall/lib/networking.py +++ b/archinstall/lib/networking.py @@ -12,7 +12,7 @@ from urllib.parse import urlencode from urllib.request import urlopen -from archinstall.lib.exceptions import DownloadTimeout, SysCallError +from archinstall.lib.exceptions import DownloadTimeoutError, SysCallError from archinstall.lib.log import debug, error, info from archinstall.lib.pacman.pacman import Pacman @@ -28,7 +28,7 @@ def __init__(self, timeout: int = 5) -> None: """ Args: timeout: - The download timeout in seconds. The DownloadTimeout exception + The download timeout in seconds. The DownloadTimeoutError exception will be raised in the context after this many seconds. """ self.time: float | None = None @@ -39,9 +39,9 @@ def __init__(self, timeout: int = 5) -> None: def raise_timeout(self, _signl: int, _frame: FrameType | None) -> None: """ - Raise the DownloadTimeout exception. + Raise the DownloadTimeoutError exception. """ - raise DownloadTimeout(f'Download timed out after {self.timeout} second(s).') + raise DownloadTimeoutError(f'Download timed out after {self.timeout} second(s).') def __enter__(self) -> Self: if self.timeout > 0: From 6539916d99b6902d22524f1c0150cc1fa5c7da93 Mon Sep 17 00:00:00 2001 From: codefiles <11915375+codefiles@users.noreply.github.com> Date: Sat, 26 Sep 2026 12:10:46 -0400 Subject: [PATCH 5/5] Enable Ruff pep8-naming --- pyproject.toml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 995d4b368d..b6c246f473 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -201,6 +201,7 @@ select = [ "INT", # flake8-gettext "ISC", # flake8-implicit-str-concat "LOG", # flake8-logging + "N", # pep8-naming "PGH", # pygrep-hooks "PIE", # flake8-pie "PLC", # Pylint conventions @@ -233,6 +234,11 @@ ignore = [ "W191", # tab-indentation ] +[tool.ruff.lint.per-file-ignores] +"stubs/**/*.pyi" = [ + "N", # pep8-naming +] + [tool.ruff.lint.flake8-gettext] function-names = [ "tr",