Use precise type hints for most DeferredTranslation references (#2929)
The remaining "_: Any" instances will require accompanying code changes.
This commit is contained in:
parent
46e4e28294
commit
8d807c08ee
|
|
@ -36,7 +36,9 @@ from .lib.translationhandler import DeferredTranslation, Language, TranslationHa
|
|||
from .tui import Tui
|
||||
|
||||
if TYPE_CHECKING:
|
||||
_: Any
|
||||
from collections.abc import Callable
|
||||
|
||||
_: Callable[[str], DeferredTranslation]
|
||||
|
||||
|
||||
__version__ = "3.0.1"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
from typing import TYPE_CHECKING, Any
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from archinstall.default_profiles.profile import GreeterType, Profile, ProfileType, SelectResult
|
||||
from archinstall.lib.output import info
|
||||
|
|
@ -6,8 +6,12 @@ from archinstall.lib.profile.profiles_handler import profile_handler
|
|||
from archinstall.tui import FrameProperties, MenuItem, MenuItemGroup, PreviewStyle, ResultType, SelectMenu
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from collections.abc import Callable
|
||||
|
||||
from archinstall.lib.installer import Installer
|
||||
_: Any
|
||||
from archinstall.lib.translationhandler import DeferredTranslation
|
||||
|
||||
_: Callable[[str], DeferredTranslation]
|
||||
|
||||
|
||||
class DesktopProfile(Profile):
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
from typing import TYPE_CHECKING, Any
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from archinstall.default_profiles.desktops import SeatAccess
|
||||
from archinstall.default_profiles.profile import GreeterType, ProfileType, SelectResult
|
||||
|
|
@ -6,8 +6,12 @@ from archinstall.default_profiles.xorg import XorgProfile
|
|||
from archinstall.tui import Alignment, FrameProperties, MenuItem, MenuItemGroup, ResultType, SelectMenu
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from collections.abc import Callable
|
||||
|
||||
from archinstall.lib.installer import Installer
|
||||
_: Any
|
||||
from archinstall.lib.translationhandler import DeferredTranslation
|
||||
|
||||
_: Callable[[str], DeferredTranslation]
|
||||
|
||||
|
||||
class HyprlandProfile(XorgProfile):
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
from typing import TYPE_CHECKING, Any
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from archinstall.default_profiles.desktops import SeatAccess
|
||||
from archinstall.default_profiles.profile import GreeterType, ProfileType, SelectResult
|
||||
|
|
@ -6,8 +6,12 @@ from archinstall.default_profiles.xorg import XorgProfile
|
|||
from archinstall.tui import Alignment, FrameProperties, MenuItem, MenuItemGroup, ResultType, SelectMenu
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from collections.abc import Callable
|
||||
|
||||
from archinstall.lib.installer import Installer
|
||||
_: Any
|
||||
from archinstall.lib.translationhandler import DeferredTranslation
|
||||
|
||||
_: Callable[[str], DeferredTranslation]
|
||||
|
||||
|
||||
class SwayProfile(XorgProfile):
|
||||
|
|
|
|||
|
|
@ -1,9 +1,13 @@
|
|||
from typing import TYPE_CHECKING, Any
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from archinstall.default_profiles.profile import Profile, ProfileType
|
||||
|
||||
if TYPE_CHECKING:
|
||||
_: Any
|
||||
from collections.abc import Callable
|
||||
|
||||
from archinstall.lib.translationhandler import DeferredTranslation
|
||||
|
||||
_: Callable[[str], DeferredTranslation]
|
||||
|
||||
|
||||
class MinimalProfile(Profile):
|
||||
|
|
|
|||
|
|
@ -7,8 +7,13 @@ from typing import TYPE_CHECKING, Any
|
|||
from ..lib.storage import storage
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from collections.abc import Callable
|
||||
|
||||
from archinstall.lib.translationhandler import DeferredTranslation
|
||||
|
||||
from ..lib.installer import Installer
|
||||
_: Any
|
||||
|
||||
_: Callable[[str], DeferredTranslation]
|
||||
|
||||
|
||||
class ProfileType(Enum):
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
from typing import TYPE_CHECKING, Any
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from archinstall.default_profiles.profile import Profile, ProfileType, SelectResult
|
||||
from archinstall.lib.output import info
|
||||
|
|
@ -6,8 +6,12 @@ from archinstall.lib.profile.profiles_handler import profile_handler
|
|||
from archinstall.tui import FrameProperties, MenuItem, MenuItemGroup, PreviewStyle, ResultType, SelectMenu
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from collections.abc import Callable
|
||||
|
||||
from archinstall.lib.installer import Installer
|
||||
_: Any
|
||||
from archinstall.lib.translationhandler import DeferredTranslation
|
||||
|
||||
_: Callable[[str], DeferredTranslation]
|
||||
|
||||
|
||||
class ServerProfile(Profile):
|
||||
|
|
|
|||
|
|
@ -1,9 +1,13 @@
|
|||
from typing import TYPE_CHECKING, Any
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from archinstall.default_profiles.profile import Profile, ProfileType
|
||||
|
||||
if TYPE_CHECKING:
|
||||
_: Any
|
||||
from collections.abc import Callable
|
||||
|
||||
from archinstall.lib.translationhandler import DeferredTranslation
|
||||
|
||||
_: Callable[[str], DeferredTranslation]
|
||||
|
||||
|
||||
class XorgProfile(Profile):
|
||||
|
|
|
|||
|
|
@ -13,7 +13,11 @@ from .storage import storage
|
|||
from .utils.util import prompt_dir
|
||||
|
||||
if TYPE_CHECKING:
|
||||
_: Any
|
||||
from collections.abc import Callable
|
||||
|
||||
from archinstall.lib.translationhandler import DeferredTranslation
|
||||
|
||||
_: Callable[[str], DeferredTranslation]
|
||||
|
||||
|
||||
class ConfigurationOutput:
|
||||
|
|
|
|||
|
|
@ -17,7 +17,11 @@ from ..output import debug
|
|||
from ..storage import storage
|
||||
|
||||
if TYPE_CHECKING:
|
||||
_: Any
|
||||
from collections.abc import Callable
|
||||
|
||||
from archinstall.lib.translationhandler import DeferredTranslation
|
||||
|
||||
_: Callable[[str], DeferredTranslation]
|
||||
|
||||
|
||||
class DiskLayoutType(Enum):
|
||||
|
|
|
|||
|
|
@ -11,7 +11,11 @@ from . import DiskLayoutConfiguration, DiskLayoutType
|
|||
from .device_model import LvmConfiguration
|
||||
|
||||
if TYPE_CHECKING:
|
||||
_: Any
|
||||
from collections.abc import Callable
|
||||
|
||||
from archinstall.lib.translationhandler import DeferredTranslation
|
||||
|
||||
_: Callable[[str], DeferredTranslation]
|
||||
|
||||
|
||||
class DiskLayoutConfigurationMenu(AbstractSubMenu):
|
||||
|
|
|
|||
|
|
@ -12,7 +12,11 @@ from . import LvmConfiguration, LvmVolume
|
|||
from .fido import Fido2, Fido2Device
|
||||
|
||||
if TYPE_CHECKING:
|
||||
_: Any
|
||||
from collections.abc import Callable
|
||||
|
||||
from archinstall.lib.translationhandler import DeferredTranslation
|
||||
|
||||
_: Callable[[str], DeferredTranslation]
|
||||
|
||||
|
||||
class DiskEncryptionMenu(AbstractSubMenu):
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ from __future__ import annotations
|
|||
|
||||
import time
|
||||
from pathlib import Path
|
||||
from typing import TYPE_CHECKING, Any
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from archinstall.tui import Tui
|
||||
|
||||
|
|
@ -28,7 +28,11 @@ from .device_model import (
|
|||
)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
_: Any
|
||||
from collections.abc import Callable
|
||||
|
||||
from archinstall.lib.translationhandler import DeferredTranslation
|
||||
|
||||
_: Callable[[str], DeferredTranslation]
|
||||
|
||||
|
||||
class FilesystemHandler:
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ from __future__ import annotations
|
|||
import re
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
from typing import TYPE_CHECKING, Any
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from archinstall.tui import Alignment, EditMenu, FrameProperties, MenuItem, MenuItemGroup, Orientation, ResultType, SelectMenu
|
||||
|
||||
|
|
@ -27,7 +27,11 @@ from .device_model import (
|
|||
from .subvolume_menu import SubvolumeMenu
|
||||
|
||||
if TYPE_CHECKING:
|
||||
_: Any
|
||||
from collections.abc import Callable
|
||||
|
||||
from archinstall.lib.translationhandler import DeferredTranslation
|
||||
|
||||
_: Callable[[str], DeferredTranslation]
|
||||
|
||||
|
||||
@dataclass
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
from pathlib import Path
|
||||
from typing import TYPE_CHECKING, Any
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from archinstall.tui import Alignment, EditMenu, ResultType
|
||||
|
||||
|
|
@ -8,7 +8,11 @@ from ..utils.util import prompt_dir
|
|||
from .device_model import SubvolumeModification
|
||||
|
||||
if TYPE_CHECKING:
|
||||
_: Any
|
||||
from collections.abc import Callable
|
||||
|
||||
from archinstall.lib.translationhandler import DeferredTranslation
|
||||
|
||||
_: Callable[[str], DeferredTranslation]
|
||||
|
||||
|
||||
class SubvolumeMenu(ListManager):
|
||||
|
|
|
|||
|
|
@ -36,7 +36,11 @@ from .translationhandler import Language, TranslationHandler
|
|||
from .utils.util import format_cols, get_password
|
||||
|
||||
if TYPE_CHECKING:
|
||||
_: Any
|
||||
from collections.abc import Callable
|
||||
|
||||
from archinstall.lib.translationhandler import DeferredTranslation
|
||||
|
||||
_: Callable[[str], DeferredTranslation]
|
||||
|
||||
|
||||
class GlobalMenu(AbstractMenu):
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import os
|
|||
from enum import Enum
|
||||
from functools import cached_property
|
||||
from pathlib import Path
|
||||
from typing import TYPE_CHECKING, Any
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from .exceptions import SysCallError
|
||||
from .general import SysCommand
|
||||
|
|
@ -10,7 +10,11 @@ from .networking import enrich_iface_types, list_interfaces
|
|||
from .output import debug
|
||||
|
||||
if TYPE_CHECKING:
|
||||
_: Any
|
||||
from collections.abc import Callable
|
||||
|
||||
from archinstall.lib.translationhandler import DeferredTranslation
|
||||
|
||||
_: Callable[[str], DeferredTranslation]
|
||||
|
||||
|
||||
class CpuVendor(Enum):
|
||||
|
|
|
|||
|
|
@ -14,7 +14,11 @@ from ..storage import storage
|
|||
from ..utils.util import prompt_dir
|
||||
|
||||
if TYPE_CHECKING:
|
||||
_: Any
|
||||
from collections.abc import Callable
|
||||
|
||||
from archinstall.lib.translationhandler import DeferredTranslation
|
||||
|
||||
_: Callable[[str], DeferredTranslation]
|
||||
|
||||
|
||||
def select_devices(preset: list[disk.BDevice] | None = []) -> list[disk.BDevice]:
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import pathlib
|
||||
from typing import TYPE_CHECKING, Any
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from archinstall.tui import Alignment, EditMenu, FrameProperties, MenuItem, MenuItemGroup, Orientation, ResultType, SelectMenu, Tui
|
||||
|
||||
|
|
@ -13,7 +13,11 @@ from ..storage import storage
|
|||
from ..translationhandler import Language
|
||||
|
||||
if TYPE_CHECKING:
|
||||
_: Any
|
||||
from collections.abc import Callable
|
||||
|
||||
from archinstall.lib.translationhandler import DeferredTranslation
|
||||
|
||||
_: Callable[[str], DeferredTranslation]
|
||||
|
||||
|
||||
def ask_ntp(preset: bool = True) -> bool:
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
from typing import TYPE_CHECKING, Any
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from archinstall.tui import Alignment, EditMenu, MenuItem, MenuItemGroup, Orientation, ResultType, SelectMenu
|
||||
|
||||
|
|
@ -11,7 +11,11 @@ from ..models.users import User
|
|||
from ..utils.util import get_password
|
||||
|
||||
if TYPE_CHECKING:
|
||||
_: Any
|
||||
from collections.abc import Callable
|
||||
|
||||
from archinstall.lib.translationhandler import DeferredTranslation
|
||||
|
||||
_: Callable[[str], DeferredTranslation]
|
||||
|
||||
|
||||
class UserList(ListManager):
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import ipaddress
|
||||
from typing import TYPE_CHECKING, Any
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from archinstall.tui import Alignment, EditMenu, FrameProperties, MenuItem, MenuItemGroup, ResultType, SelectMenu
|
||||
|
||||
|
|
@ -10,7 +10,11 @@ from ..models.network_configuration import NetworkConfiguration, Nic, NicType
|
|||
from ..networking import list_interfaces
|
||||
|
||||
if TYPE_CHECKING:
|
||||
_: Any
|
||||
from collections.abc import Callable
|
||||
|
||||
from archinstall.lib.translationhandler import DeferredTranslation
|
||||
|
||||
_: Callable[[str], DeferredTranslation]
|
||||
|
||||
|
||||
class ManualNetworkConfig(ListManager):
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING, Any
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from archinstall.tui import Alignment, FrameProperties, FrameStyle, MenuItem, MenuItemGroup, Orientation, PreviewStyle, ResultType, SelectMenu
|
||||
|
||||
|
|
@ -8,7 +8,11 @@ from ..hardware import GfxDriver, SysInfo
|
|||
from ..models.bootloader import Bootloader
|
||||
|
||||
if TYPE_CHECKING:
|
||||
_: Any
|
||||
from collections.abc import Callable
|
||||
|
||||
from archinstall.lib.translationhandler import DeferredTranslation
|
||||
|
||||
_: Callable[[str], DeferredTranslation]
|
||||
|
||||
|
||||
def select_kernel(preset: list[str] = []) -> list[str]:
|
||||
|
|
|
|||
|
|
@ -7,7 +7,11 @@ from ..menu import AbstractSubMenu
|
|||
from .utils import get_kb_layout, list_keyboard_languages, list_locales, set_kb_layout
|
||||
|
||||
if TYPE_CHECKING:
|
||||
_: Any
|
||||
from collections.abc import Callable
|
||||
|
||||
from archinstall.lib.translationhandler import DeferredTranslation
|
||||
|
||||
_: Callable[[str], DeferredTranslation]
|
||||
|
||||
|
||||
@dataclass
|
||||
|
|
|
|||
|
|
@ -8,7 +8,9 @@ from archinstall.tui import Chars, FrameProperties, FrameStyle, MenuItem, MenuIt
|
|||
from ..output import error, unicode_ljust
|
||||
|
||||
if TYPE_CHECKING:
|
||||
_: Any
|
||||
from archinstall.lib.translationhandler import DeferredTranslation
|
||||
|
||||
_: Callable[[str], DeferredTranslation]
|
||||
|
||||
|
||||
class Selector:
|
||||
|
|
|
|||
|
|
@ -6,7 +6,11 @@ from archinstall.tui import Alignment, MenuItem, MenuItemGroup, ResultType, Sele
|
|||
from ..output import FormattedOutput
|
||||
|
||||
if TYPE_CHECKING:
|
||||
_: Any
|
||||
from collections.abc import Callable
|
||||
|
||||
from archinstall.lib.translationhandler import DeferredTranslation
|
||||
|
||||
_: Callable[[str], DeferredTranslation]
|
||||
|
||||
|
||||
class ListManager:
|
||||
|
|
|
|||
|
|
@ -15,7 +15,11 @@ from .output import FormattedOutput, debug
|
|||
from .storage import storage
|
||||
|
||||
if TYPE_CHECKING:
|
||||
_: Any
|
||||
from collections.abc import Callable
|
||||
|
||||
from archinstall.lib.translationhandler import DeferredTranslation
|
||||
|
||||
_: Callable[[str], DeferredTranslation]
|
||||
|
||||
|
||||
class SignCheck(Enum):
|
||||
|
|
|
|||
|
|
@ -7,7 +7,11 @@ from typing import TYPE_CHECKING, Any
|
|||
from ..profile import ProfileConfiguration
|
||||
|
||||
if TYPE_CHECKING:
|
||||
_: Any
|
||||
from collections.abc import Callable
|
||||
|
||||
from archinstall.lib.translationhandler import DeferredTranslation
|
||||
|
||||
_: Callable[[str], DeferredTranslation]
|
||||
|
||||
|
||||
class NicType(Enum):
|
||||
|
|
|
|||
|
|
@ -3,7 +3,11 @@ from enum import Enum
|
|||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
if TYPE_CHECKING:
|
||||
_: Any
|
||||
from collections.abc import Callable
|
||||
|
||||
from archinstall.lib.translationhandler import DeferredTranslation
|
||||
|
||||
_: Callable[[str], DeferredTranslation]
|
||||
|
||||
|
||||
class PasswordStrength(Enum):
|
||||
|
|
|
|||
|
|
@ -11,7 +11,11 @@ from ..menu import AbstractSubMenu
|
|||
from .profile_model import ProfileConfiguration
|
||||
|
||||
if TYPE_CHECKING:
|
||||
_: Any
|
||||
from collections.abc import Callable
|
||||
|
||||
from archinstall.lib.translationhandler import DeferredTranslation
|
||||
|
||||
_: Callable[[str], DeferredTranslation]
|
||||
|
||||
|
||||
class ProfileMenu(AbstractSubMenu):
|
||||
|
|
|
|||
|
|
@ -18,8 +18,13 @@ from ..storage import storage
|
|||
from .profile_model import ProfileConfiguration
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from collections.abc import Callable
|
||||
|
||||
from archinstall.lib.translationhandler import DeferredTranslation
|
||||
|
||||
from ..installer import Installer
|
||||
_: Any
|
||||
|
||||
_: Callable[[str], DeferredTranslation]
|
||||
|
||||
|
||||
class ProfileHandler:
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
from pathlib import Path
|
||||
from typing import TYPE_CHECKING, Any
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from archinstall.tui import Alignment, EditMenu
|
||||
|
||||
|
|
@ -7,7 +7,11 @@ from ..general import secret
|
|||
from ..output import FormattedOutput
|
||||
|
||||
if TYPE_CHECKING:
|
||||
_: Any
|
||||
from collections.abc import Callable
|
||||
|
||||
from archinstall.lib.translationhandler import DeferredTranslation
|
||||
|
||||
_: Callable[[str], DeferredTranslation]
|
||||
|
||||
|
||||
def get_password(
|
||||
|
|
|
|||
|
|
@ -14,7 +14,11 @@ from archinstall.lib.profile.profiles_handler import profile_handler
|
|||
from archinstall.tui import Alignment, FrameProperties, MenuItem, MenuItemGroup, ResultType, SelectMenu, Tui
|
||||
|
||||
if TYPE_CHECKING:
|
||||
_: Any
|
||||
from collections.abc import Callable
|
||||
|
||||
from archinstall.lib.translationhandler import DeferredTranslation
|
||||
|
||||
_: Callable[[str], DeferredTranslation]
|
||||
|
||||
|
||||
class ExecutionMode(Enum):
|
||||
|
|
|
|||
|
|
@ -34,7 +34,9 @@ from .types import (
|
|||
)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
_: Any
|
||||
from archinstall.lib.translationhandler import DeferredTranslation
|
||||
|
||||
_: Callable[[str], DeferredTranslation]
|
||||
|
||||
|
||||
class AbstractCurses(metaclass=ABCMeta):
|
||||
|
|
|
|||
|
|
@ -7,7 +7,9 @@ from typing import TYPE_CHECKING, Any, ClassVar
|
|||
from ..lib.output import unicode_ljust
|
||||
|
||||
if TYPE_CHECKING:
|
||||
_: Any
|
||||
from archinstall.lib.translationhandler import DeferredTranslation
|
||||
|
||||
_: Callable[[str], DeferredTranslation]
|
||||
|
||||
|
||||
@dataclass
|
||||
|
|
|
|||
|
|
@ -86,12 +86,12 @@ warn_unused_configs = true
|
|||
warn_unused_ignores = true
|
||||
|
||||
[[tool.mypy.overrides]]
|
||||
module = "archinstall.default_profiles.applications.*"
|
||||
module = "archinstall.default_profiles.*"
|
||||
disallow_any_explicit = true
|
||||
|
||||
[[tool.mypy.overrides]]
|
||||
module = "archinstall.default_profiles.servers.*"
|
||||
disallow_any_explicit = true
|
||||
module = "archinstall.default_profiles.profile"
|
||||
disallow_any_explicit = false
|
||||
|
||||
[[tool.mypy.overrides]]
|
||||
module = "archinstall.examples.*"
|
||||
|
|
|
|||
Loading…
Reference in New Issue