From e37e7ff781073059a3999791d0f0c328d36ec524 Mon Sep 17 00:00:00 2001 From: codefiles <11915375+codefiles@users.noreply.github.com> Date: Sun, 2 Aug 2026 08:24:44 -0400 Subject: [PATCH] Use staticmethod for Bootloader.get_default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Addresses the following: pyright ``` archinstall/lib/models/bootloader.py:42:11 - error: Type "Literal[Bootloader.NO_BOOTLOADER]" is not assignable to return type "Self@Bootloader"   Type "Literal[Bootloader.NO_BOOTLOADER]" is not assignable to type "Self@Bootloader" (reportReturnType) archinstall/lib/models/bootloader.py:44:11 - error: Type "Literal[Bootloader.Systemd]" is not assignable to return type "Self@Bootloader"   Type "Literal[Bootloader.Systemd]" is not assignable to type "Self@Bootloader" (reportReturnType) archinstall/lib/models/bootloader.py:46:11 - error: Type "Literal[Bootloader.Grub]" is not assignable to return type "Self@Bootloader"   Type "Literal[Bootloader.Grub]" is not assignable to type "Self@Bootloader" (reportReturnType) ``` pyrefly ``` ERROR Returned type `Literal[Bootloader.NO_BOOTLOADER]` is not assignable to declared return type `Self@Bootloader` [bad-return] --> archinstall/lib/models/bootloader.py:42:11 | 40 | def get_default(cls, uefi: bool, skip_boot: bool = False) -> Self: | ---- declared return type 41 | if skip_boot: 42 | return cls.NO_BOOTLOADER | ^^^^^^^^^^^^^^^^^ | ERROR Returned type `Literal[Bootloader.Systemd]` is not assignable to declared return type `Self@Bootloader` [bad-return] --> archinstall/lib/models/bootloader.py:44:11 | 40 | def get_default(cls, uefi: bool, skip_boot: bool = False) -> Self: | ---- declared return type 41 | if skip_boot: 42 | return cls.NO_BOOTLOADER 43 | elif uefi: 44 | return cls.Systemd | ^^^^^^^^^^^ | ERROR Returned type `Literal[Bootloader.Grub]` is not assignable to declared return type `Self@Bootloader` [bad-return] --> archinstall/lib/models/bootloader.py:46:11 | 40 | def get_default(cls, uefi: bool, skip_boot: bool = False) -> Self: | ---- declared return type 41 | if skip_boot: 42 | return cls.NO_BOOTLOADER 43 | elif uefi: 44 | return cls.Systemd 45 | else: 46 | return cls.Grub | ^^^^^^^^ | ``` ty ``` error[invalid-return-type]: Return type does not match returned value --> archinstall/lib/models/bootloader.py:40:63 | 40 | def get_default(cls, uefi: bool, skip_boot: bool = False) -> Self: | ---- Expected `Self@get_default` because of return type 41 | if skip_boot: 42 | return cls.NO_BOOTLOADER | ^^^^^^^^^^^^^^^^^ expected `Self@get_default`, found `Literal[Bootloader.NO_BOOTLOADER]` | error[invalid-return-type]: Return type does not match returned value --> archinstall/lib/models/bootloader.py:40:63 | 40 | def get_default(cls, uefi: bool, skip_boot: bool = False) -> Self: | ---- Expected `Self@get_default` because of return type 41 | if skip_boot: 42 | return cls.NO_BOOTLOADER 43 | elif uefi: 44 | return cls.Systemd | ^^^^^^^^^^^ expected `Self@get_default`, found `Literal[Bootloader.Systemd]` | error[invalid-return-type]: Return type does not match returned value --> archinstall/lib/models/bootloader.py:46:11 | 46 | return cls.Grub | ^^^^^^^^ expected `Self@get_default`, found `Literal[Bootloader.Grub]` | ::: archinstall/lib/models/bootloader.py:40:63 | 40 | def get_default(cls, uefi: bool, skip_boot: bool = False) -> Self: | ---- Expected `Self@get_default` because of return type | ``` --- archinstall/lib/models/bootloader.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/archinstall/lib/models/bootloader.py b/archinstall/lib/models/bootloader.py index 040b6746c7..a4900e5bb6 100644 --- a/archinstall/lib/models/bootloader.py +++ b/archinstall/lib/models/bootloader.py @@ -36,14 +36,14 @@ def is_uefi_only(self) -> bool: def json(self) -> str: return self.value - @classmethod - def get_default(cls, uefi: bool, skip_boot: bool = False) -> Self: + @staticmethod + def get_default(uefi: bool, skip_boot: bool = False) -> Bootloader: if skip_boot: - return cls.NO_BOOTLOADER + return Bootloader.NO_BOOTLOADER elif uefi: - return cls.Systemd + return Bootloader.Systemd else: - return cls.Grub + return Bootloader.Grub @classmethod def from_arg(cls, bootloader: str, skip_boot: bool) -> Self: