From 3255744278ee651e25692518b2ca1b8f0a4895cf Mon Sep 17 00:00:00 2001 From: correctmost <134317971+correctmost@users.noreply.github.com> Date: Mon, 18 Nov 2024 19:18:47 -0500 Subject: [PATCH] Sort and format remaining imports (#2877) This commit also enables isort rules in the Ruff config. --- .../default_profiles/applications/pipewire.py | 2 +- archinstall/lib/boot.py | 1 + archinstall/lib/configuration.py | 16 +++----- archinstall/lib/general.py | 17 ++++---- archinstall/lib/global_menu.py | 40 ++++++++++--------- archinstall/lib/hardware.py | 2 +- archinstall/lib/installer.py | 15 ++++--- archinstall/lib/interactions/__init__.py | 31 +++++++------- archinstall/lib/interactions/disk_conf.py | 14 +++---- archinstall/lib/interactions/general_conf.py | 9 ++--- .../lib/interactions/manage_users_conf.py | 14 +++---- archinstall/lib/interactions/network_menu.py | 12 ++---- archinstall/lib/interactions/system_conf.py | 12 ++---- archinstall/lib/locale/__init__.py | 4 +- archinstall/lib/locale/locale_menu.py | 11 ++--- archinstall/lib/luks.py | 6 +-- archinstall/lib/menu/abstract_menu.py | 14 +++---- archinstall/lib/menu/list_manager.py | 10 ++--- archinstall/lib/menu/menu_helper.py | 5 +-- archinstall/lib/mirrors.py | 17 +++----- archinstall/lib/models/__init__.py | 10 ++--- archinstall/lib/models/audio_configuration.py | 4 +- archinstall/lib/models/mirrors.py | 5 ++- .../lib/models/network_configuration.py | 2 +- archinstall/lib/models/users.py | 2 +- archinstall/lib/networking.py | 11 +++-- archinstall/lib/output.py | 5 +-- archinstall/lib/packages/__init__.py | 5 +-- archinstall/lib/packages/packages.py | 2 +- archinstall/lib/pacman/__init__.py | 14 +++---- archinstall/lib/profile/__init__.py | 2 +- archinstall/lib/profile/profile_menu.py | 16 +++----- archinstall/lib/profile/profile_model.py | 3 +- archinstall/lib/profile/profiles_handler.py | 11 +++-- archinstall/lib/storage.py | 3 +- archinstall/lib/translationhandler.py | 7 ++-- archinstall/lib/utils/util.py | 10 ++--- pyproject.toml | 1 + 38 files changed, 157 insertions(+), 208 deletions(-) diff --git a/archinstall/default_profiles/applications/pipewire.py b/archinstall/default_profiles/applications/pipewire.py index 4c731e6db5..8ec168a618 100644 --- a/archinstall/default_profiles/applications/pipewire.py +++ b/archinstall/default_profiles/applications/pipewire.py @@ -2,10 +2,10 @@ import archinstall from archinstall.default_profiles.profile import Profile, ProfileType -from archinstall.lib.models import User if TYPE_CHECKING: from archinstall.lib.installer import Installer + from archinstall.lib.models import User _: Any diff --git a/archinstall/lib/boot.py b/archinstall/lib/boot.py index b0817726ed..c60f412db5 100644 --- a/archinstall/lib/boot.py +++ b/archinstall/lib/boot.py @@ -1,5 +1,6 @@ import time from collections.abc import Iterator + from .exceptions import SysCallError from .general import SysCommand, SysCommandWorker, locate_binary from .installer import Installer diff --git a/archinstall/lib/configuration.py b/archinstall/lib/configuration.py index b6bcdfbc70..4c9bed2eb0 100644 --- a/archinstall/lib/configuration.py +++ b/archinstall/lib/configuration.py @@ -1,21 +1,17 @@ -import os import json -import stat +import os import readline +import stat from pathlib import Path -from typing import Any, TYPE_CHECKING +from typing import TYPE_CHECKING, Any + +from archinstall.tui import Alignment, FrameProperties, MenuItem, MenuItemGroup, Orientation, PreviewStyle, ResultType, SelectMenu, Tui -from .storage import storage from .general import JSON, UNSAFE_JSON from .output import debug, warn +from .storage import storage from .utils.util import prompt_dir -from archinstall.tui import ( - MenuItemGroup, MenuItem, SelectMenu, - FrameProperties, Alignment, ResultType, - PreviewStyle, Orientation, Tui -) - if TYPE_CHECKING: _: Any diff --git a/archinstall/lib/general.py b/archinstall/lib/general.py index 80ca839282..d79b2d27b0 100644 --- a/archinstall/lib/general.py +++ b/archinstall/lib/general.py @@ -2,30 +2,29 @@ import json import os +import pathlib +import re import secrets import shlex -import subprocess import stat import string +import subprocess import sys import time -import re -import urllib.parse -from urllib.request import Request, urlopen import urllib.error -import pathlib +import urllib.parse from collections.abc import Callable, Iterator -from datetime import datetime, date +from datetime import date, datetime from enum import Enum -from typing import Any, TYPE_CHECKING -from select import epoll, EPOLLIN, EPOLLHUP +from select import EPOLLHUP, EPOLLIN, epoll from shutil import which +from typing import TYPE_CHECKING, Any +from urllib.request import Request, urlopen from .exceptions import RequirementError, SysCallError from .output import debug, error, info from .storage import storage - if TYPE_CHECKING: from .installer import Installer diff --git a/archinstall/lib/global_menu.py b/archinstall/lib/global_menu.py index e047dcbb27..b4fa8a6822 100644 --- a/archinstall/lib/global_menu.py +++ b/archinstall/lib/global_menu.py @@ -1,37 +1,39 @@ from __future__ import annotations -from typing import Any, TYPE_CHECKING +from typing import TYPE_CHECKING, Any + +from archinstall.tui import MenuItem, MenuItemGroup from . import disk +from .configuration import save_config from .general import secret from .hardware import SysInfo +from .interactions import ( + add_number_of_parallel_downloads, + ask_additional_packages_to_install, + ask_for_a_timezone, + ask_for_additional_users, + ask_for_audio_selection, + ask_for_bootloader, + ask_for_swap, + ask_for_uki, + ask_hostname, + ask_ntp, + ask_to_configure_network, + select_additional_repositories, + select_kernel, +) from .locale.locale_menu import LocaleConfiguration, LocaleMenu from .menu import AbstractMenu from .mirrors import MirrorConfiguration, MirrorMenu from .models import NetworkConfiguration, NicType -from .models.bootloader import Bootloader from .models.audio_configuration import AudioConfiguration +from .models.bootloader import Bootloader from .models.users import User from .output import FormattedOutput from .profile.profile_menu import ProfileConfiguration -from .interactions import ask_for_additional_users -from .interactions import ( - ask_for_audio_selection, ask_for_swap, - ask_for_bootloader, ask_for_uki, ask_hostname, - add_number_of_parallel_downloads, select_kernel, - ask_additional_packages_to_install, select_additional_repositories, - ask_for_a_timezone, ask_ntp, ask_to_configure_network -) -from .utils.util import get_password -from .utils.util import format_cols -from .configuration import save_config - -from archinstall.tui import ( - MenuItemGroup, MenuItem -) - - from .translationhandler import Language, TranslationHandler +from .utils.util import format_cols, get_password if TYPE_CHECKING: _: Any diff --git a/archinstall/lib/hardware.py b/archinstall/lib/hardware.py index e3fc7a77bb..7249f2d71c 100644 --- a/archinstall/lib/hardware.py +++ b/archinstall/lib/hardware.py @@ -6,7 +6,7 @@ from .exceptions import SysCallError from .general import SysCommand -from .networking import list_interfaces, enrich_iface_types +from .networking import enrich_iface_types, list_interfaces from .output import debug if TYPE_CHECKING: diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 71372fdc6d..5e7f99c118 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -8,25 +8,24 @@ from collections.abc import Callable from pathlib import Path from types import TracebackType -from typing import Any, TYPE_CHECKING +from typing import TYPE_CHECKING, Any -from . import disk -from .exceptions import DiskError, ServiceException, RequirementError, HardwareIncompatibilityError, SysCallError +from archinstall.tui.curses_menu import Tui + +from . import disk, pacman +from .exceptions import DiskError, HardwareIncompatibilityError, RequirementError, ServiceException, SysCallError from .general import SysCommand from .hardware import SysInfo -from .locale import LocaleConfiguration -from .locale import verify_keyboard_layout, verify_x11_keyboard_layout +from .locale import LocaleConfiguration, verify_keyboard_layout, verify_x11_keyboard_layout from .luks import Luks2 from .mirrors import MirrorConfiguration from .models.bootloader import Bootloader from .models.network_configuration import Nic from .models.users import User -from .output import log, error, info, warn, debug -from . import pacman +from .output import debug, error, info, log, warn from .pacman import Pacman from .plugins import plugins from .storage import storage -from archinstall.tui.curses_menu import Tui if TYPE_CHECKING: _: Any diff --git a/archinstall/lib/interactions/__init__.py b/archinstall/lib/interactions/__init__.py index 40438e7b7d..bd269d8cba 100644 --- a/archinstall/lib/interactions/__init__.py +++ b/archinstall/lib/interactions/__init__.py @@ -1,18 +1,21 @@ -from .manage_users_conf import UserList, ask_for_additional_users -from .network_menu import ManualNetworkConfig, ask_to_configure_network - from .disk_conf import ( - select_devices, select_disk_config, get_default_partition_layout, - select_main_filesystem_format, suggest_single_disk_layout, - suggest_multi_disk_layout + get_default_partition_layout, + select_devices, + select_disk_config, + select_main_filesystem_format, + suggest_multi_disk_layout, + suggest_single_disk_layout, ) - from .general_conf import ( - ask_ntp, ask_hostname, ask_for_a_timezone, ask_for_audio_selection, - select_archinstall_language, ask_additional_packages_to_install, - add_number_of_parallel_downloads, select_additional_repositories -) - -from .system_conf import ( - select_kernel, ask_for_bootloader, ask_for_uki, select_driver, ask_for_swap + add_number_of_parallel_downloads, + ask_additional_packages_to_install, + ask_for_a_timezone, + ask_for_audio_selection, + ask_hostname, + ask_ntp, + select_additional_repositories, + select_archinstall_language, ) +from .manage_users_conf import UserList, ask_for_additional_users +from .network_menu import ManualNetworkConfig, ask_to_configure_network +from .system_conf import ask_for_bootloader, ask_for_swap, ask_for_uki, select_driver, select_kernel diff --git a/archinstall/lib/interactions/disk_conf.py b/archinstall/lib/interactions/disk_conf.py index dbac27736d..46dd2ddef2 100644 --- a/archinstall/lib/interactions/disk_conf.py +++ b/archinstall/lib/interactions/disk_conf.py @@ -1,21 +1,17 @@ from __future__ import annotations from pathlib import Path -from typing import Any, TYPE_CHECKING +from typing import TYPE_CHECKING, Any + +from archinstall.lib.menu.menu_helper import MenuHelper +from archinstall.tui import Alignment, FrameProperties, MenuItem, MenuItemGroup, Orientation, ResultType, SelectMenu from .. import disk from ..disk.device_model import BtrfsMountOption from ..hardware import SysInfo from ..output import FormattedOutput, debug -from ..utils.util import prompt_dir from ..storage import storage - -from archinstall.lib.menu.menu_helper import MenuHelper -from archinstall.tui import ( - MenuItemGroup, MenuItem, SelectMenu, - FrameProperties, Alignment, ResultType, - Orientation -) +from ..utils.util import prompt_dir if TYPE_CHECKING: _: Any diff --git a/archinstall/lib/interactions/general_conf.py b/archinstall/lib/interactions/general_conf.py index ca08dbb0bd..1264bc7cb3 100644 --- a/archinstall/lib/interactions/general_conf.py +++ b/archinstall/lib/interactions/general_conf.py @@ -1,7 +1,9 @@ from __future__ import annotations import pathlib -from typing import Any, TYPE_CHECKING +from typing import TYPE_CHECKING, Any + +from archinstall.tui import Alignment, EditMenu, FrameProperties, MenuItem, MenuItemGroup, Orientation, ResultType, SelectMenu, Tui from ..locale import list_timezones from ..models.audio_configuration import Audio, AudioConfiguration @@ -9,11 +11,6 @@ from ..packages.packages import validate_package_list from ..storage import storage from ..translationhandler import Language -from archinstall.tui import ( - MenuItemGroup, MenuItem, SelectMenu, - FrameProperties, Alignment, ResultType, - EditMenu, Orientation, Tui -) if TYPE_CHECKING: _: Any diff --git a/archinstall/lib/interactions/manage_users_conf.py b/archinstall/lib/interactions/manage_users_conf.py index a0905305b2..c93e8c58e3 100644 --- a/archinstall/lib/interactions/manage_users_conf.py +++ b/archinstall/lib/interactions/manage_users_conf.py @@ -1,18 +1,14 @@ from __future__ import annotations import re -from typing import Any, TYPE_CHECKING +from typing import TYPE_CHECKING, Any -from ..utils.util import get_password +from archinstall.tui import Alignment, EditMenu, MenuItem, MenuItemGroup, Orientation, ResultType, SelectMenu + +from ..general import secret from ..menu import ListManager from ..models.users import User -from ..general import secret - -from archinstall.tui import ( - MenuItemGroup, MenuItem, SelectMenu, - Alignment, EditMenu, Orientation, - ResultType -) +from ..utils.util import get_password if TYPE_CHECKING: _: Any diff --git a/archinstall/lib/interactions/network_menu.py b/archinstall/lib/interactions/network_menu.py index ba54360600..0c8528e776 100644 --- a/archinstall/lib/interactions/network_menu.py +++ b/archinstall/lib/interactions/network_menu.py @@ -1,17 +1,13 @@ from __future__ import annotations import ipaddress -from typing import Any, TYPE_CHECKING +from typing import TYPE_CHECKING, Any -from ..models.network_configuration import NetworkConfiguration, NicType, Nic +from archinstall.tui import Alignment, EditMenu, FrameProperties, MenuItem, MenuItemGroup, ResultType, SelectMenu -from ..networking import list_interfaces from ..menu import ListManager -from archinstall.tui import ( - MenuItemGroup, MenuItem, SelectMenu, - FrameProperties, Alignment, ResultType, - EditMenu -) +from ..models.network_configuration import NetworkConfiguration, Nic, NicType +from ..networking import list_interfaces if TYPE_CHECKING: _: Any diff --git a/archinstall/lib/interactions/system_conf.py b/archinstall/lib/interactions/system_conf.py index 9e016cce3e..f6be36fd57 100644 --- a/archinstall/lib/interactions/system_conf.py +++ b/archinstall/lib/interactions/system_conf.py @@ -1,15 +1,11 @@ from __future__ import annotations -from typing import Any, TYPE_CHECKING +from typing import TYPE_CHECKING, Any -from ..hardware import SysInfo, GfxDriver -from ..models.bootloader import Bootloader +from archinstall.tui import Alignment, FrameProperties, FrameStyle, MenuItem, MenuItemGroup, Orientation, PreviewStyle, ResultType, SelectMenu -from archinstall.tui import ( - MenuItemGroup, MenuItem, SelectMenu, - FrameProperties, FrameStyle, Alignment, - ResultType, Orientation, PreviewStyle -) +from ..hardware import GfxDriver, SysInfo +from ..models.bootloader import Bootloader if TYPE_CHECKING: _: Any diff --git a/archinstall/lib/locale/__init__.py b/archinstall/lib/locale/__init__.py index 90f1aeccd7..47e3d22fd8 100644 --- a/archinstall/lib/locale/__init__.py +++ b/archinstall/lib/locale/__init__.py @@ -2,9 +2,9 @@ from .utils import ( list_keyboard_languages, list_locales, + list_timezones, list_x11_keyboard_languages, + set_kb_layout, verify_keyboard_layout, verify_x11_keyboard_layout, - list_timezones, - set_kb_layout ) diff --git a/archinstall/lib/locale/locale_menu.py b/archinstall/lib/locale/locale_menu.py index 5a52a6d393..ede1d79306 100644 --- a/archinstall/lib/locale/locale_menu.py +++ b/archinstall/lib/locale/locale_menu.py @@ -1,13 +1,10 @@ from dataclasses import dataclass -from typing import Any, TYPE_CHECKING +from typing import TYPE_CHECKING, Any -from .utils import list_keyboard_languages, list_locales, set_kb_layout, get_kb_layout -from ..menu import AbstractSubMenu +from archinstall.tui import Alignment, FrameProperties, MenuItem, MenuItemGroup, ResultType, SelectMenu -from archinstall.tui import ( - MenuItemGroup, MenuItem, SelectMenu, - FrameProperties, Alignment, ResultType -) +from ..menu import AbstractSubMenu +from .utils import get_kb_layout, list_keyboard_languages, list_locales, set_kb_layout if TYPE_CHECKING: _: Any diff --git a/archinstall/lib/luks.py b/archinstall/lib/luks.py index 81794d260a..8d2b558bae 100644 --- a/archinstall/lib/luks.py +++ b/archinstall/lib/luks.py @@ -6,9 +6,9 @@ from pathlib import Path from . import disk -from .general import SysCommand, generate_password, SysCommandWorker -from .output import info, debug -from .exceptions import SysCallError, DiskError +from .exceptions import DiskError, SysCallError +from .general import SysCommand, SysCommandWorker, generate_password +from .output import debug, info from .storage import storage diff --git a/archinstall/lib/menu/abstract_menu.py b/archinstall/lib/menu/abstract_menu.py index f44cecccce..49c4cbc0cf 100644 --- a/archinstall/lib/menu/abstract_menu.py +++ b/archinstall/lib/menu/abstract_menu.py @@ -1,15 +1,11 @@ from __future__ import annotations from collections.abc import Callable -from typing import Any, TYPE_CHECKING - -from ..output import error -from ..output import unicode_ljust -from archinstall.tui import ( - MenuItemGroup, MenuItem, SelectMenu, - PreviewStyle, FrameProperties, FrameStyle, - ResultType, Chars, Tui -) +from typing import TYPE_CHECKING, Any + +from archinstall.tui import Chars, FrameProperties, FrameStyle, MenuItem, MenuItemGroup, PreviewStyle, ResultType, SelectMenu, Tui + +from ..output import error, unicode_ljust if TYPE_CHECKING: _: Any diff --git a/archinstall/lib/menu/list_manager.py b/archinstall/lib/menu/list_manager.py index a1bf543e88..2addb5e68a 100644 --- a/archinstall/lib/menu/list_manager.py +++ b/archinstall/lib/menu/list_manager.py @@ -1,11 +1,9 @@ import copy -from typing import Any, TYPE_CHECKING -from ..output import FormattedOutput +from typing import TYPE_CHECKING, Any + +from archinstall.tui import Alignment, MenuItem, MenuItemGroup, ResultType, SelectMenu -from archinstall.tui import ( - MenuItemGroup, MenuItem, SelectMenu, - Alignment, ResultType -) +from ..output import FormattedOutput if TYPE_CHECKING: _: Any diff --git a/archinstall/lib/menu/menu_helper.py b/archinstall/lib/menu/menu_helper.py index e30d0b8912..6015977670 100644 --- a/archinstall/lib/menu/menu_helper.py +++ b/archinstall/lib/menu/menu_helper.py @@ -1,10 +1,7 @@ from typing import Any from archinstall.lib.output import FormattedOutput - -from archinstall.tui import ( - MenuItemGroup, MenuItem -) +from archinstall.tui import MenuItem, MenuItemGroup class MenuHelper: diff --git a/archinstall/lib/mirrors.py b/archinstall/lib/mirrors.py index ef7e7ff410..42f65cbd5f 100644 --- a/archinstall/lib/mirrors.py +++ b/archinstall/lib/mirrors.py @@ -1,23 +1,18 @@ -import time import json +import time import urllib.parse -from pathlib import Path from dataclasses import dataclass, field from enum import Enum -from typing import Any, TYPE_CHECKING +from pathlib import Path +from typing import TYPE_CHECKING, Any + +from archinstall.tui import Alignment, EditMenu, FrameProperties, MenuItem, MenuItemGroup, ResultType, SelectMenu from .menu import AbstractSubMenu, ListManager +from .models.mirrors import MirrorStatusEntryV3, MirrorStatusListV3 from .networking import fetch_data_from_url from .output import FormattedOutput, debug from .storage import storage -from .models.mirrors import MirrorStatusListV3, MirrorStatusEntryV3 - -from archinstall.tui import ( - MenuItemGroup, MenuItem, SelectMenu, - FrameProperties, Alignment, ResultType, - EditMenu -) - if TYPE_CHECKING: _: Any diff --git a/archinstall/lib/models/__init__.py b/archinstall/lib/models/__init__.py index a1c90e48bc..4763a9833a 100644 --- a/archinstall/lib/models/__init__.py +++ b/archinstall/lib/models/__init__.py @@ -1,9 +1,5 @@ -from .network_configuration import ( - NetworkConfiguration, - NicType, - Nic -) +from .audio_configuration import Audio, AudioConfiguration from .bootloader import Bootloader -from .gen import VersionDef, PackageSearchResult, PackageSearch, LocalPackage +from .gen import LocalPackage, PackageSearch, PackageSearchResult, VersionDef +from .network_configuration import NetworkConfiguration, Nic, NicType from .users import PasswordStrength, User -from .audio_configuration import Audio, AudioConfiguration diff --git a/archinstall/lib/models/audio_configuration.py b/archinstall/lib/models/audio_configuration.py index d47f23ed1c..bad4788cb5 100644 --- a/archinstall/lib/models/audio_configuration.py +++ b/archinstall/lib/models/audio_configuration.py @@ -1,10 +1,10 @@ from dataclasses import dataclass from enum import Enum -from typing import Any, TYPE_CHECKING +from typing import TYPE_CHECKING, Any +from ...default_profiles.applications.pipewire import PipewireProfile from ..hardware import SysInfo from ..output import info -from ...default_profiles.applications.pipewire import PipewireProfile if TYPE_CHECKING: _: Any diff --git a/archinstall/lib/models/mirrors.py b/archinstall/lib/models/mirrors.py index 09850a8170..f21e32df17 100644 --- a/archinstall/lib/models/mirrors.py +++ b/archinstall/lib/models/mirrors.py @@ -1,11 +1,12 @@ -from pydantic import BaseModel, field_validator, model_validator import datetime import http.client import urllib.error import urllib.parse import urllib.request -from ..networking import ping, DownloadTimer +from pydantic import BaseModel, field_validator, model_validator + +from ..networking import DownloadTimer, ping from ..output import debug diff --git a/archinstall/lib/models/network_configuration.py b/archinstall/lib/models/network_configuration.py index 6fe8fd9c1f..41487eb74b 100644 --- a/archinstall/lib/models/network_configuration.py +++ b/archinstall/lib/models/network_configuration.py @@ -2,7 +2,7 @@ from dataclasses import dataclass, field from enum import Enum -from typing import Any, TYPE_CHECKING +from typing import TYPE_CHECKING, Any from ..profile import ProfileConfiguration diff --git a/archinstall/lib/models/users.py b/archinstall/lib/models/users.py index b74f815069..e9020fc6c0 100644 --- a/archinstall/lib/models/users.py +++ b/archinstall/lib/models/users.py @@ -1,6 +1,6 @@ from dataclasses import dataclass -from typing import Any, TYPE_CHECKING from enum import Enum +from typing import TYPE_CHECKING, Any if TYPE_CHECKING: _: Any diff --git a/archinstall/lib/networking.py b/archinstall/lib/networking.py index 43e76cf79f..78795de42f 100644 --- a/archinstall/lib/networking.py +++ b/archinstall/lib/networking.py @@ -1,21 +1,20 @@ import os +import random +import select +import signal import socket import ssl import struct import time -import select -import signal -import random from types import FrameType from typing import Any from urllib.error import URLError from urllib.parse import urlencode from urllib.request import urlopen -from .exceptions import SysCallError, DownloadTimeout -from .output import error, info +from .exceptions import DownloadTimeout, SysCallError +from .output import debug, error, info from .pacman import Pacman -from .output import debug class DownloadTimer: diff --git a/archinstall/lib/output.py b/archinstall/lib/output.py index f281cabf5a..1b5f67e3a6 100644 --- a/archinstall/lib/output.py +++ b/archinstall/lib/output.py @@ -3,11 +3,10 @@ import sys import unicodedata from collections.abc import Callable +from dataclasses import asdict, is_dataclass from enum import Enum - from pathlib import Path -from typing import Any, TYPE_CHECKING -from dataclasses import asdict, is_dataclass +from typing import TYPE_CHECKING, Any from .storage import storage diff --git a/archinstall/lib/packages/__init__.py b/archinstall/lib/packages/__init__.py index e2aab57751..4d5dbf49c9 100644 --- a/archinstall/lib/packages/__init__.py +++ b/archinstall/lib/packages/__init__.py @@ -1,4 +1 @@ -from .packages import ( - group_search, package_search, find_package, - find_packages, validate_package_list, installed_package -) +from .packages import find_package, find_packages, group_search, installed_package, package_search, validate_package_list diff --git a/archinstall/lib/packages/packages.py b/archinstall/lib/packages/packages.py index bd50f82819..52c0e3f6c4 100644 --- a/archinstall/lib/packages/packages.py +++ b/archinstall/lib/packages/packages.py @@ -7,7 +7,7 @@ from urllib.request import urlopen from ..exceptions import PackageError, SysCallError -from ..models.gen import PackageSearch, PackageSearchResult, LocalPackage +from ..models.gen import LocalPackage, PackageSearch, PackageSearchResult from ..pacman import Pacman BASE_URL_PKG_SEARCH = 'https://archlinux.org/packages/search/json/' diff --git a/archinstall/lib/pacman/__init__.py b/archinstall/lib/pacman/__init__.py index 4d84e2cfd9..025b7a3925 100644 --- a/archinstall/lib/pacman/__init__.py +++ b/archinstall/lib/pacman/__init__.py @@ -1,16 +1,16 @@ -from pathlib import Path -import time import re +import time from collections.abc import Callable -from typing import TYPE_CHECKING, Any +from pathlib import Path from shutil import copy2 +from typing import TYPE_CHECKING, Any -from ..general import SysCommand -from ..output import warn, error, info -from .repo import Repo -from .config import Config from ..exceptions import RequirementError +from ..general import SysCommand +from ..output import error, info, warn from ..plugins import plugins +from .config import Config +from .repo import Repo if TYPE_CHECKING: _: Any diff --git a/archinstall/lib/profile/__init__.py b/archinstall/lib/profile/__init__.py index 6e74b0d802..2558856e58 100644 --- a/archinstall/lib/profile/__init__.py +++ b/archinstall/lib/profile/__init__.py @@ -1,3 +1,3 @@ from .profile_menu import ProfileMenu, select_greeter, select_profile -from .profiles_handler import profile_handler from .profile_model import ProfileConfiguration +from .profiles_handler import profile_handler diff --git a/archinstall/lib/profile/profile_menu.py b/archinstall/lib/profile/profile_menu.py index 4b04145696..b83c04e319 100644 --- a/archinstall/lib/profile/profile_menu.py +++ b/archinstall/lib/profile/profile_menu.py @@ -2,17 +2,13 @@ from typing import TYPE_CHECKING, Any -from archinstall.default_profiles.profile import Profile, GreeterType -from .profile_model import ProfileConfiguration -from ..menu import AbstractSubMenu -from ..interactions.system_conf import select_driver -from ..hardware import GfxDriver +from archinstall.default_profiles.profile import GreeterType, Profile +from archinstall.tui import Alignment, FrameProperties, MenuItem, MenuItemGroup, Orientation, ResultType, SelectMenu -from archinstall.tui import ( - MenuItemGroup, MenuItem, SelectMenu, - FrameProperties, Alignment, ResultType, - Orientation -) +from ..hardware import GfxDriver +from ..interactions.system_conf import select_driver +from ..menu import AbstractSubMenu +from .profile_model import ProfileConfiguration if TYPE_CHECKING: _: Any diff --git a/archinstall/lib/profile/profile_model.py b/archinstall/lib/profile/profile_model.py index 606ef091c5..1689cabe52 100644 --- a/archinstall/lib/profile/profile_model.py +++ b/archinstall/lib/profile/profile_model.py @@ -3,8 +3,9 @@ from dataclasses import dataclass from typing import TYPE_CHECKING, Any +from archinstall.default_profiles.profile import GreeterType, Profile + from ..hardware import GfxDriver -from archinstall.default_profiles.profile import Profile, GreeterType if TYPE_CHECKING: _: Any diff --git a/archinstall/lib/profile/profiles_handler.py b/archinstall/lib/profile/profiles_handler.py index 3cf8a7e8bf..88cd96cece 100644 --- a/archinstall/lib/profile/profiles_handler.py +++ b/archinstall/lib/profile/profiles_handler.py @@ -1,8 +1,8 @@ from __future__ import annotations import importlib.util -import sys import inspect +import sys from collections import Counter from functools import cached_property from pathlib import Path @@ -10,13 +10,12 @@ from types import ModuleType from typing import TYPE_CHECKING, Any -from ...default_profiles.profile import Profile, GreeterType -from .profile_model import ProfileConfiguration +from ...default_profiles.profile import GreeterType, Profile from ..hardware import GfxDriver -from ..networking import list_interfaces, fetch_data_from_url -from ..output import error, debug, info +from ..networking import fetch_data_from_url, list_interfaces +from ..output import debug, error, info from ..storage import storage - +from .profile_model import ProfileConfiguration if TYPE_CHECKING: from ..installer import Installer diff --git a/archinstall/lib/storage.py b/archinstall/lib/storage.py index 43bf3d33c5..10e716ad76 100644 --- a/archinstall/lib/storage.py +++ b/archinstall/lib/storage.py @@ -5,9 +5,8 @@ # (4. Added the ~/.config directory as an additional option for future reasons) # # And Keeping this in dict ensures that variables are shared across imports. -from typing import Any from pathlib import Path - +from typing import Any storage: dict[str, Any] = { 'PROFILE': Path(__file__).parent.parent.joinpath('default_profiles'), diff --git a/archinstall/lib/translationhandler.py b/archinstall/lib/translationhandler.py index 4b480b6481..d6cb08534e 100644 --- a/archinstall/lib/translationhandler.py +++ b/archinstall/lib/translationhandler.py @@ -1,14 +1,13 @@ from __future__ import annotations +import gettext import json import os -import gettext from dataclasses import dataclass - from pathlib import Path -from typing import Any, TYPE_CHECKING +from typing import TYPE_CHECKING, Any -from .output import error, debug +from .output import debug, error if TYPE_CHECKING: _: Any diff --git a/archinstall/lib/utils/util.py b/archinstall/lib/utils/util.py index dc75b5f35d..200754907e 100644 --- a/archinstall/lib/utils/util.py +++ b/archinstall/lib/utils/util.py @@ -1,12 +1,10 @@ from pathlib import Path -from typing import Any, TYPE_CHECKING +from typing import TYPE_CHECKING, Any -from ..output import FormattedOutput -from ..general import secret +from archinstall.tui import Alignment, EditMenu -from archinstall.tui import ( - Alignment, EditMenu -) +from ..general import secret +from ..output import FormattedOutput if TYPE_CHECKING: _: Any diff --git a/pyproject.toml b/pyproject.toml index c74a649938..102b3588ea 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -176,6 +176,7 @@ select = [ "FA", # flake8-future-annotations "FLY", # flynt "G", # flake8-logging-format + "I", # isort "ICN", # flake8-import-conventions "ISC", # flake8-implicit-str-concat "LOG", # flake8-logging