Skip to content

Use staticmethod for Bootloader.get_default - #4690

Merged
svartkanin merged 1 commit into
archlinux:masterfrom
codefiles:bootloader-get-default
Aug 3, 2026
Merged

Use staticmethod for Bootloader.get_default#4690
svartkanin merged 1 commit into
archlinux:masterfrom
codefiles:bootloader-get-default

Conversation

@codefiles

Copy link
Copy Markdown
Contributor

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
   |

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
   |
```
@codefiles
codefiles requested a review from Torxed as a code owner August 2, 2026 12:31
@svartkanin
svartkanin merged commit c7da3cd into archlinux:master Aug 3, 2026
11 checks passed
@codefiles
codefiles deleted the bootloader-get-default branch August 3, 2026 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants