Skip to content

Commit

Permalink
Sort and format remaining imports (archlinux#2877)
Browse files Browse the repository at this point in the history
This commit also enables isort rules in the Ruff config.
  • Loading branch information
correctmost authored Nov 19, 2024
1 parent 955b2cf commit 3255744
Show file tree
Hide file tree
Showing 38 changed files with 157 additions and 208 deletions.
2 changes: 1 addition & 1 deletion archinstall/default_profiles/applications/pipewire.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
1 change: 1 addition & 0 deletions archinstall/lib/boot.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
16 changes: 6 additions & 10 deletions archinstall/lib/configuration.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
17 changes: 8 additions & 9 deletions archinstall/lib/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
40 changes: 21 additions & 19 deletions archinstall/lib/global_menu.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion archinstall/lib/hardware.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
15 changes: 7 additions & 8 deletions archinstall/lib/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
31 changes: 17 additions & 14 deletions archinstall/lib/interactions/__init__.py
Original file line number Diff line number Diff line change
@@ -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
14 changes: 5 additions & 9 deletions archinstall/lib/interactions/disk_conf.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
9 changes: 3 additions & 6 deletions archinstall/lib/interactions/general_conf.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
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
from ..output import warn
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
Expand Down
14 changes: 5 additions & 9 deletions archinstall/lib/interactions/manage_users_conf.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
12 changes: 4 additions & 8 deletions archinstall/lib/interactions/network_menu.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
12 changes: 4 additions & 8 deletions archinstall/lib/interactions/system_conf.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions archinstall/lib/locale/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
11 changes: 4 additions & 7 deletions archinstall/lib/locale/locale_menu.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 3 additions & 3 deletions archinstall/lib/luks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
Loading

0 comments on commit 3255744

Please sign in to comment.