diff --git a/anaconda.py b/anaconda.py index 821690d5a0c..e2330a7e5ad 100755 --- a/anaconda.py +++ b/anaconda.py @@ -23,11 +23,12 @@ # ...still messy (2013-07-12) # A lot less messy now. :) (2016-10-13) -import os import atexit +import os +import signal import sys import time -import signal + import pid from pyanaconda.modules.common.structures.rescue import RescueData @@ -198,23 +199,22 @@ def setup_environment(): from pyanaconda.core.constants import ADDON_PATHS sys.path.extend(ADDON_PATHS) + from pyanaconda import startup_utils + from pyanaconda.core import constants, path, util + from pyanaconda.core.i18n import _ + from pyanaconda.core.kernel import kernel_arguments # init threading before Gtk can do anything and before we start using threads from pyanaconda.core.threads import thread_manager - from pyanaconda.core.i18n import _ - from pyanaconda.core import util, constants, path - from pyanaconda import startup_utils # do this early so we can set flags before initializing logging from pyanaconda.flags import flags - from pyanaconda.core.kernel import kernel_arguments opts = parse_arguments(boot_cmdline=kernel_arguments) from pyanaconda.core.configuration.anaconda import conf conf.set_from_opts(opts) # Set up logging as early as possible. - from pyanaconda import anaconda_logging - from pyanaconda import anaconda_loggers + from pyanaconda import anaconda_loggers, anaconda_logging anaconda_logging.init(write_to_journal=conf.target.is_hardware) anaconda_logging.logger.setupVirtio(opts.virtiolog) @@ -273,13 +273,15 @@ def setup_environment(): opts.display_mode = constants.DisplayModes.TUI opts.noninteractive = True - from pyanaconda import gnome_remote_desktop - from pyanaconda import kickstart # we are past the --version and --help shortcut so we can import display & # startup_utils, which import Blivet, without slowing down anything critical - from pyanaconda import display - from pyanaconda import startup_utils - from pyanaconda import rescue + from pyanaconda import ( + display, + gnome_remote_desktop, + kickstart, + rescue, + startup_utils, + ) # Print the usual "startup note" that contains Anaconda version # and short usage & bug reporting instructions. @@ -398,8 +400,8 @@ def _earlyExceptionHandler(ty, value, traceback): # Pick up any changes from interactive-defaults.ks that would # otherwise be covered by the dracut KS parser. - from pyanaconda.modules.common.constants.services import STORAGE, RUNTIME from pyanaconda.modules.common.constants.objects import BOOTLOADER + from pyanaconda.modules.common.constants.services import RUNTIME, STORAGE bootloader_proxy = STORAGE.get_proxy(BOOTLOADER) runtime_proxy = RUNTIME.get_proxy() @@ -445,7 +447,11 @@ def _earlyExceptionHandler(ty, value, traceback): startup_utils.initialize_locale(opts, text_mode=anaconda.tui_mode) # Initialize the network now, in case the display needs it - from pyanaconda.network import initialize_network, wait_for_connecting_NM_thread, wait_for_connected_NM + from pyanaconda.network import ( + initialize_network, + wait_for_connected_NM, + wait_for_connecting_NM_thread, + ) initialize_network() # If required by user, wait for connection before starting the installation. @@ -476,8 +482,8 @@ def _earlyExceptionHandler(ty, value, traceback): startup_utils.set_storage_checker_minimal_ram_size(anaconda.display_mode) # Set the disk images. - from pyanaconda.modules.common.constants.objects import DISK_SELECTION from pyanaconda.argument_parsing import name_path_pairs + from pyanaconda.modules.common.constants.objects import DISK_SELECTION disk_select_proxy = STORAGE.get_proxy(DISK_SELECTION) disk_images = {} @@ -530,12 +536,15 @@ def _earlyExceptionHandler(ty, value, traceback): # else currently talks to the Subscription DBus module, # we only check if organization id & at least one activation # key are available - from pyanaconda.modules.common.util import is_module_available from pyanaconda.modules.common.constants.services import SUBSCRIPTION + from pyanaconda.modules.common.util import is_module_available if is_module_available(SUBSCRIPTION): - from pyanaconda.ui.lib.subscription import org_keys_sufficient, \ - register_and_subscribe, kickstart_error_handler + from pyanaconda.ui.lib.subscription import ( + kickstart_error_handler, + org_keys_sufficient, + register_and_subscribe, + ) if org_keys_sufficient(): thread_manager.add_thread( name=constants.THREAD_SUBSCRIPTION, @@ -560,6 +569,7 @@ def _earlyExceptionHandler(ty, value, traceback): # Create pre-install snapshots from pykickstart.constants import SNAPSHOT_WHEN_PRE_INSTALL + from pyanaconda.kickstart import check_kickstart_error from pyanaconda.modules.common.constants.objects import SNAPSHOT from pyanaconda.modules.common.task import sync_run_task diff --git a/docs/conf.py b/docs/conf.py index 1236534d8fb..68910c8ada1 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -11,7 +11,9 @@ # All configuration values have a default; values that are commented out # serve to show the default. -import sys, os, shutil +import os +import shutil +import sys # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the diff --git a/dracut/driver_updates.py b/dracut/driver_updates.py index 07ae2e2a05b..b4d57acee87 100755 --- a/dracut/driver_updates.py +++ b/dracut/driver_updates.py @@ -63,11 +63,11 @@ /run/install/dd_packages to the target system. """ +import fnmatch import logging -import sys import os import subprocess -import fnmatch +import sys # Import readline so raw_input gets readline features, like history, and # backspace working right. Do not import readline if not connected to a tty @@ -75,7 +75,6 @@ if os.isatty(0): import readline # pylint:disable=unused-import import shutil - from contextlib import contextmanager from logging.handlers import SysLogHandler diff --git a/pyanaconda/anaconda.py b/pyanaconda/anaconda.py index fa8ba56f9ab..ca15e9a6c4a 100644 --- a/pyanaconda/anaconda.py +++ b/pyanaconda/anaconda.py @@ -19,22 +19,27 @@ import os import sys -from tempfile import mkstemp import threading +from tempfile import mkstemp -from pyanaconda.core.constants import DisplayModes, PAYLOAD_TYPE_RPM_OSTREE, ADDON_PATHS, \ - PAYLOAD_TYPE_LIVE_IMAGE +from pyanaconda.anaconda_loggers import get_stdout_logger from pyanaconda.core import constants -from pyanaconda.core.startup.dbus_launcher import AnacondaDBusLauncher +from pyanaconda.core.constants import ( + ADDON_PATHS, + PAYLOAD_TYPE_LIVE_IMAGE, + PAYLOAD_TYPE_RPM_OSTREE, + DisplayModes, +) from pyanaconda.core.kernel import kernel_arguments from pyanaconda.core.path import open_with_perm +from pyanaconda.core.startup.dbus_launcher import AnacondaDBusLauncher from pyanaconda.modules.common.constants.services import PAYLOADS from pyanaconda.ui.lib.addons import collect_addon_ui_paths -from pyanaconda.anaconda_loggers import get_stdout_logger stdoutLog = get_stdout_logger() from pyanaconda.anaconda_loggers import get_module_logger + log = get_module_logger(__name__) @@ -163,11 +168,12 @@ def log_display_mode(self): constants.DISPLAY_MODE_NAME[self.display_mode]) def dumpState(self): - from meh import ExceptionInfo - from meh.dump import ReverseExceptionDump from inspect import stack as _stack from traceback import format_stack + from meh import ExceptionInfo + from meh.dump import ReverseExceptionDump + # Skip the frames for dumpState and the signal handler. stack = _stack()[2:] stack.reverse() diff --git a/pyanaconda/anaconda_loggers.py b/pyanaconda/anaconda_loggers.py index 33f6a9ae233..9e4a019352e 100644 --- a/pyanaconda/anaconda_loggers.py +++ b/pyanaconda/anaconda_loggers.py @@ -28,6 +28,7 @@ # than the constants module. import logging + from pyanaconda.core import constants diff --git a/pyanaconda/anaconda_logging.py b/pyanaconda/anaconda_logging.py index 98bd952b81c..5ac10ececf9 100644 --- a/pyanaconda/anaconda_logging.py +++ b/pyanaconda/anaconda_logging.py @@ -20,16 +20,22 @@ # import logging -from logging.handlers import SysLogHandler, SocketHandler -from systemd import journal import os import sys import warnings +from logging.handlers import SocketHandler, SysLogHandler + +from systemd import journal from pyanaconda.core import constants +from pyanaconda.core.glib import ( + LogLevelFlags, + LogWriterOutput, + log_set_handler, + log_set_writer_func, + log_writer_format_fields, +) from pyanaconda.core.path import set_mode -from pyanaconda.core.glib import log_set_handler, log_set_writer_func, log_writer_format_fields, \ - LogLevelFlags, LogWriterOutput ENTRY_FORMAT = "%(asctime)s,%(msecs)03d %(levelname)s %(name)s: %(message)s" STDOUT_FORMAT = "%(asctime)s %(message)s" @@ -45,6 +51,7 @@ ANACONDA_SYSLOG_IDENTIFIER = "anaconda" from threading import Lock + program_log_lock = Lock() diff --git a/pyanaconda/argument_parsing.py b/pyanaconda/argument_parsing.py index 53fe74a70b3..e24f0f1b999 100644 --- a/pyanaconda/argument_parsing.py +++ b/pyanaconda/argument_parsing.py @@ -19,21 +19,27 @@ DESCRIPTION = "Anaconda is the installation program used by Fedora, " \ "Red Hat Enterprise Linux and some other distributions." +import fcntl import itertools import os +import struct import sys -import fcntl import termios -import struct - -from argparse import ArgumentParser, ArgumentError, HelpFormatter, Namespace, Action, SUPPRESS +from argparse import ( + SUPPRESS, + Action, + ArgumentError, + ArgumentParser, + HelpFormatter, + Namespace, +) from blivet.arch import is_s390 +from pyanaconda.anaconda_loggers import get_module_logger +from pyanaconda.core.constants import VIRTIO_PORT, X_TIMEOUT, DisplayModes from pyanaconda.core.kernel import KernelArguments -from pyanaconda.core.constants import DisplayModes, X_TIMEOUT, VIRTIO_PORT -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) # Help text formatting constants @@ -512,6 +518,7 @@ def __call__(self, parser, namespace, values, _option_string=None): help=help_parser.help_text("virtiolog")) from pykickstart.constants import SELINUX_DISABLED, SELINUX_ENFORCING + from pyanaconda.core.constants import SELINUX_DEFAULT ap.add_argument("--noselinux", dest="selinux", action="store_const", const=SELINUX_DISABLED, default=SELINUX_DEFAULT, diff --git a/pyanaconda/core/async_utils.py b/pyanaconda/core/async_utils.py index 0082ea8089d..a9586962c4e 100644 --- a/pyanaconda/core/async_utils.py +++ b/pyanaconda/core/async_utils.py @@ -18,8 +18,9 @@ # from queue import Queue -from pyanaconda.core.threads import thread_manager + from pyanaconda.core.glib import idle_add +from pyanaconda.core.threads import thread_manager def run_in_loop(callback, *args, **kwargs): diff --git a/pyanaconda/core/configuration/anaconda.py b/pyanaconda/core/configuration/anaconda.py index 2a096376b2a..07941308f74 100644 --- a/pyanaconda/core/configuration/anaconda.py +++ b/pyanaconda/core/configuration/anaconda.py @@ -20,23 +20,33 @@ import os from pyanaconda.anaconda_loggers import get_module_logger +from pyanaconda.core.configuration.base import ( + Configuration, + ConfigurationError, + Section, +) from pyanaconda.core.configuration.bootloader import BootloaderSection, BootloaderType from pyanaconda.core.configuration.license import LicenseSection +from pyanaconda.core.configuration.localization import LocalizationSection from pyanaconda.core.configuration.network import NetworkSection from pyanaconda.core.configuration.payload import PayloadSection +from pyanaconda.core.configuration.profile import ProfileLoader from pyanaconda.core.configuration.security import SecuritySection from pyanaconda.core.configuration.storage import StorageSection from pyanaconda.core.configuration.storage_constraints import StorageConstraints -from pyanaconda.core.configuration.system import SystemType, SystemSection -from pyanaconda.core.configuration.target import TargetType, TargetSection -from pyanaconda.core.configuration.base import Section, Configuration, ConfigurationError -from pyanaconda.core.configuration.profile import ProfileLoader -from pyanaconda.core.configuration.ui import UserInterfaceSection +from pyanaconda.core.configuration.system import SystemSection, SystemType +from pyanaconda.core.configuration.target import TargetSection, TargetType from pyanaconda.core.configuration.timezone import TimezoneSection -from pyanaconda.core.configuration.localization import LocalizationSection -from pyanaconda.core.constants import ANACONDA_CONFIG_TMP, ANACONDA_CONFIG_DIR, \ - GEOLOC_PROVIDER_FEDORA_GEOIP, GEOLOC_PROVIDER_HOSTIP, GEOLOC_DEFAULT_PROVIDER, \ - GEOLOC_URL_FEDORA_GEOIP, GEOLOC_URL_HOSTIP +from pyanaconda.core.configuration.ui import UserInterfaceSection +from pyanaconda.core.constants import ( + ANACONDA_CONFIG_DIR, + ANACONDA_CONFIG_TMP, + GEOLOC_DEFAULT_PROVIDER, + GEOLOC_PROVIDER_FEDORA_GEOIP, + GEOLOC_PROVIDER_HOSTIP, + GEOLOC_URL_FEDORA_GEOIP, + GEOLOC_URL_HOSTIP, +) log = get_module_logger(__name__) diff --git a/pyanaconda/core/configuration/bootloader.py b/pyanaconda/core/configuration/bootloader.py index 18b956bbe47..4cb2d9ed160 100644 --- a/pyanaconda/core/configuration/bootloader.py +++ b/pyanaconda/core/configuration/bootloader.py @@ -18,6 +18,7 @@ # Author(s): Vendula Poncova # from enum import Enum + from pyanaconda.core.configuration.base import Section diff --git a/pyanaconda/core/configuration/payload.py b/pyanaconda/core/configuration/payload.py index d4643ba6419..a40d3cf7dd1 100644 --- a/pyanaconda/core/configuration/payload.py +++ b/pyanaconda/core/configuration/payload.py @@ -18,7 +18,7 @@ # Author(s): Vendula Poncova # from pyanaconda.core.configuration.base import Section -from pyanaconda.core.constants import SOURCE_TYPE_CLOSEST_MIRROR, SOURCE_TYPE_CDN +from pyanaconda.core.constants import SOURCE_TYPE_CDN, SOURCE_TYPE_CLOSEST_MIRROR class PayloadSection(Section): diff --git a/pyanaconda/core/configuration/profile.py b/pyanaconda/core/configuration/profile.py index 5968cbd2cc4..e760e8f0a9f 100644 --- a/pyanaconda/core/configuration/profile.py +++ b/pyanaconda/core/configuration/profile.py @@ -20,8 +20,12 @@ import os from pyanaconda.anaconda_loggers import get_module_logger -from pyanaconda.core.configuration.base import create_parser, read_config, get_option, \ - ConfigurationError +from pyanaconda.core.configuration.base import ( + ConfigurationError, + create_parser, + get_option, + read_config, +) log = get_module_logger(__name__) diff --git a/pyanaconda/core/configuration/storage.py b/pyanaconda/core/configuration/storage.py index d52468ada3e..05d801fbc39 100644 --- a/pyanaconda/core/configuration/storage.py +++ b/pyanaconda/core/configuration/storage.py @@ -20,9 +20,12 @@ from enum import Enum from blivet.size import Size - -from pykickstart.constants import AUTOPART_TYPE_PLAIN, AUTOPART_TYPE_BTRFS, AUTOPART_TYPE_LVM, \ - AUTOPART_TYPE_LVM_THINP +from pykickstart.constants import ( + AUTOPART_TYPE_BTRFS, + AUTOPART_TYPE_LVM, + AUTOPART_TYPE_LVM_THINP, + AUTOPART_TYPE_PLAIN, +) from pyanaconda.core.configuration.base import Section from pyanaconda.core.configuration.utils import split_name_and_attributes diff --git a/pyanaconda/core/configuration/storage_constraints.py b/pyanaconda/core/configuration/storage_constraints.py index aacaf97f9c0..084392758e2 100644 --- a/pyanaconda/core/configuration/storage_constraints.py +++ b/pyanaconda/core/configuration/storage_constraints.py @@ -19,8 +19,15 @@ from enum import Enum from pyanaconda.core.configuration.base import Section -from pyanaconda.core.storage import DEVICE_TYPE_LVM, DEVICE_TYPE_MD, DEVICE_TYPE_PARTITION, \ - DEVICE_TYPE_BTRFS, DEVICE_TYPE_DISK, DEVICE_TYPE_LVM_THINP, Size +from pyanaconda.core.storage import ( + DEVICE_TYPE_BTRFS, + DEVICE_TYPE_DISK, + DEVICE_TYPE_LVM, + DEVICE_TYPE_LVM_THINP, + DEVICE_TYPE_MD, + DEVICE_TYPE_PARTITION, + Size, +) class DeviceType(Enum): diff --git a/pyanaconda/core/configuration/system.py b/pyanaconda/core/configuration/system.py index 5ae8e981d56..9a975df1d3b 100644 --- a/pyanaconda/core/configuration/system.py +++ b/pyanaconda/core/configuration/system.py @@ -18,6 +18,7 @@ # Author(s): Vendula Poncova # from enum import Enum + from pyanaconda.core.configuration.base import Section diff --git a/pyanaconda/core/constants.py b/pyanaconda/core/constants.py index 0f333273b76..385bab5acab 100644 --- a/pyanaconda/core/constants.py +++ b/pyanaconda/core/constants.py @@ -24,7 +24,6 @@ from pyanaconda.core.i18n import N_ from pyanaconda.core.product import get_product_name, get_product_version - # Use -1 to indicate that the selinux configuration is unset SELINUX_DEFAULT = -1 diff --git a/pyanaconda/core/dbus.py b/pyanaconda/core/dbus.py index 43b98a78bcf..fb3c9fbbdab 100644 --- a/pyanaconda/core/dbus.py +++ b/pyanaconda/core/dbus.py @@ -18,11 +18,15 @@ # import os -from dasbus.connection import SystemMessageBus, MessageBus, SessionMessageBus +from dasbus.connection import MessageBus, SessionMessageBus, SystemMessageBus from dasbus.constants import DBUS_STARTER_ADDRESS -from dasbus.error import ErrorMapper, get_error_decorator, AbstractErrorRule +from dasbus.error import AbstractErrorRule, ErrorMapper, get_error_decorator + from pyanaconda.anaconda_loggers import get_module_logger -from pyanaconda.core.constants import DBUS_ANACONDA_SESSION_ADDRESS, ANACONDA_BUS_ADDR_FILE +from pyanaconda.core.constants import ( + ANACONDA_BUS_ADDR_FILE, + DBUS_ANACONDA_SESSION_ADDRESS, +) from pyanaconda.modules.common.errors import register_errors log = get_module_logger(__name__) diff --git a/pyanaconda/core/glib.py b/pyanaconda/core/glib.py index ee130ad35a5..b1b0405314f 100644 --- a/pyanaconda/core/glib.py +++ b/pyanaconda/core/glib.py @@ -23,23 +23,42 @@ # import gi + gi.require_version("GLib", "2.0") gi.require_version("Gio", "2.0") -from gi.repository.GLib import markup_escape_text, format_size_full, \ - timeout_add_seconds, timeout_add, idle_add, \ - io_add_watch, child_watch_add, \ - source_remove, timeout_source_new, \ - spawn_close_pid, spawn_async_with_pipes, \ - log_writer_format_fields, log_set_handler, log_set_writer_func, \ - MainLoop, MainContext, \ - GError, Variant, VariantType, Bytes, \ - IOCondition, IOChannel, SpawnFlags, \ - LogWriterOutput, LogLevelFlags, \ - MAXUINT from gi.repository.Gio import Cancellable +from gi.repository.GLib import ( + MAXUINT, + Bytes, + GError, + IOChannel, + IOCondition, + LogLevelFlags, + LogWriterOutput, + MainContext, + MainLoop, + SpawnFlags, + Variant, + VariantType, + child_watch_add, + format_size_full, + idle_add, + io_add_watch, + log_set_handler, + log_set_writer_func, + log_writer_format_fields, + markup_escape_text, + source_remove, + spawn_async_with_pipes, + spawn_close_pid, + timeout_add, + timeout_add_seconds, + timeout_source_new, +) from pyanaconda.anaconda_loggers import get_module_logger + log = get_module_logger(__name__) diff --git a/pyanaconda/core/hw.py b/pyanaconda/core/hw.py index 46e4cb913c5..73ad8514423 100644 --- a/pyanaconda/core/hw.py +++ b/pyanaconda/core/hw.py @@ -17,9 +17,10 @@ # along with this program. If not, see . # from blivet.arch import get_arch, is_arm -from pyanaconda.core.util import execWithCapture from pyanaconda.anaconda_loggers import get_module_logger +from pyanaconda.core.util import execWithCapture + log = get_module_logger(__name__) @@ -76,8 +77,8 @@ def is_smt_enabled(): :return: True or False """ - from pyanaconda.flags import flags from pyanaconda.core.configuration.anaconda import conf + from pyanaconda.flags import flags if flags.automatedInstall \ or not conf.target.is_hardware \ diff --git a/pyanaconda/core/kernel.py b/pyanaconda/core/kernel.py index db4e56675c4..5942a2379d0 100644 --- a/pyanaconda/core/kernel.py +++ b/pyanaconda/core/kernel.py @@ -15,11 +15,11 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -import shlex import glob - +import shlex from collections import OrderedDict -from pyanaconda.core.constants import CMDLINE_APPEND, CMDLINE_LIST, CMDLINE_FILES + +from pyanaconda.core.constants import CMDLINE_APPEND, CMDLINE_FILES, CMDLINE_LIST __all__ = ['KernelArguments', 'kernel_arguments'] diff --git a/pyanaconda/core/kickstart/__init__.py b/pyanaconda/core/kickstart/__init__.py index 69105e1891d..4a93f1aed98 100644 --- a/pyanaconda/core/kickstart/__init__.py +++ b/pyanaconda/core/kickstart/__init__.py @@ -16,7 +16,7 @@ # Red Hat, Inc. # -from pyanaconda.core.kickstart.version import VERSION from pyanaconda.core.kickstart.specification import KickstartSpecification +from pyanaconda.core.kickstart.version import VERSION __all__ = ["VERSION", "KickstartSpecification"] diff --git a/pyanaconda/core/kickstart/commands.py b/pyanaconda/core/kickstart/commands.py index 029ece1094f..ee20de1173a 100644 --- a/pyanaconda/core/kickstart/commands.py +++ b/pyanaconda/core/kickstart/commands.py @@ -20,7 +20,7 @@ # Disable unused imports for the whole module. # pylint:disable=unused-import -# ruff: noqa: F401 +# ruff: noqa: F401, I001 # Supported kickstart commands. from pykickstart.commands.authselect import F28_Authselect as Authselect diff --git a/pyanaconda/core/kickstart/scripts.py b/pyanaconda/core/kickstart/scripts.py index c39a70e22dd..e7d86c0ffd9 100644 --- a/pyanaconda/core/kickstart/scripts.py +++ b/pyanaconda/core/kickstart/scripts.py @@ -19,10 +19,11 @@ # import os import tempfile + +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core import util from pyanaconda.core.path import open_with_perm -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) script_log = log.getChild("script") diff --git a/pyanaconda/core/kickstart/specification.py b/pyanaconda/core/kickstart/specification.py index facd8ebb6c8..ab092feed06 100644 --- a/pyanaconda/core/kickstart/specification.py +++ b/pyanaconda/core/kickstart/specification.py @@ -20,8 +20,8 @@ from pykickstart.base import KickstartHandler from pykickstart.parser import KickstartParser +from pyanaconda.core.kickstart.addon import AddonRegistry, AddonSection from pyanaconda.core.kickstart.version import VERSION -from pyanaconda.core.kickstart.addon import AddonSection, AddonRegistry __all__ = [ "KickstartSpecification", diff --git a/pyanaconda/core/path.py b/pyanaconda/core/path.py index 3bed181eeef..9b3ee8d3aed 100644 --- a/pyanaconda/core/path.py +++ b/pyanaconda/core/path.py @@ -15,6 +15,7 @@ # along with this program. If not, see . # import os + from pyanaconda.core.configuration.anaconda import conf diff --git a/pyanaconda/core/product.py b/pyanaconda/core/product.py index 329b8595c7d..1e126438c56 100644 --- a/pyanaconda/core/product.py +++ b/pyanaconda/core/product.py @@ -15,11 +15,10 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -import os import configparser -from functools import cache +import os from collections import namedtuple - +from functools import cache ProductData = namedtuple("ProductData", [ "is_final_release", diff --git a/pyanaconda/core/service.py b/pyanaconda/core/service.py index 5316f8f1b86..7d8dc9805d1 100644 --- a/pyanaconda/core/service.py +++ b/pyanaconda/core/service.py @@ -15,8 +15,8 @@ # along with this program. If not, see . # -from pyanaconda.core.util import execWithRedirect, execWithCapture from pyanaconda.anaconda_loggers import get_module_logger +from pyanaconda.core.util import execWithCapture, execWithRedirect log = get_module_logger(__name__) diff --git a/pyanaconda/core/startup/dbus_launcher.py b/pyanaconda/core/startup/dbus_launcher.py index d8797de473f..c0adbe67b08 100644 --- a/pyanaconda/core/startup/dbus_launcher.py +++ b/pyanaconda/core/startup/dbus_launcher.py @@ -27,16 +27,20 @@ import signal from subprocess import TimeoutExpired +from dasbus.constants import DBUS_FLAG_NONE + +from pyanaconda.anaconda_loggers import get_anaconda_root_logger from pyanaconda.core.configuration.anaconda import conf -from pyanaconda.core.util import startProgram -from pyanaconda.core.constants import ANACONDA_BUS_ADDR_FILE, ANACONDA_CONFIG_TMP, \ - ANACONDA_BUS_CONF_FILE, DBUS_ANACONDA_SESSION_ADDRESS +from pyanaconda.core.constants import ( + ANACONDA_BUS_ADDR_FILE, + ANACONDA_BUS_CONF_FILE, + ANACONDA_CONFIG_TMP, + DBUS_ANACONDA_SESSION_ADDRESS, +) from pyanaconda.core.dbus import DBus from pyanaconda.core.path import open_with_perm -from dasbus.constants import DBUS_FLAG_NONE +from pyanaconda.core.util import startProgram from pyanaconda.modules.common.constants.services import BOSS - -from pyanaconda.anaconda_loggers import get_anaconda_root_logger from pyanaconda.modules.common.task import sync_run_task log = get_anaconda_root_logger() diff --git a/pyanaconda/core/storage.py b/pyanaconda/core/storage.py index 2e049e4d4ca..6771f46b0c5 100644 --- a/pyanaconda/core/storage.py +++ b/pyanaconda/core/storage.py @@ -16,16 +16,20 @@ # Red Hat, Inc. # import os - from decimal import Decimal from blivet import udev from blivet.size import Size from blivet.util import total_memory +from pykickstart.constants import ( + AUTOPART_TYPE_BTRFS, + AUTOPART_TYPE_LVM, + AUTOPART_TYPE_LVM_THINP, + AUTOPART_TYPE_PLAIN, +) + from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.i18n import N_ -from pykickstart.constants import AUTOPART_TYPE_PLAIN, AUTOPART_TYPE_BTRFS, AUTOPART_TYPE_LVM, \ - AUTOPART_TYPE_LVM_THINP log = get_module_logger(__name__) diff --git a/pyanaconda/core/subscription.py b/pyanaconda/core/subscription.py index 32518369657..0928af63ac5 100644 --- a/pyanaconda/core/subscription.py +++ b/pyanaconda/core/subscription.py @@ -19,8 +19,8 @@ import os -from pyanaconda.core.path import join_paths from pyanaconda.core.constants import RHSM_SYSPURPOSE_FILE_PATH +from pyanaconda.core.path import join_paths def check_system_purpose_set(sysroot="/"): diff --git a/pyanaconda/core/threads.py b/pyanaconda/core/threads.py index dd17239fa65..4f98a147571 100644 --- a/pyanaconda/core/threads.py +++ b/pyanaconda/core/threads.py @@ -21,6 +21,7 @@ import threading from pyanaconda.anaconda_loggers import get_module_logger + log = get_module_logger(__name__) diff --git a/pyanaconda/core/timer.py b/pyanaconda/core/timer.py index 62c67952045..5a9586c3407 100644 --- a/pyanaconda/core/timer.py +++ b/pyanaconda/core/timer.py @@ -19,7 +19,7 @@ # Author(s): Jiri Konecny # -from pyanaconda.core.glib import timeout_add, timeout_add_seconds, source_remove +from pyanaconda.core.glib import source_remove, timeout_add, timeout_add_seconds class Timer: diff --git a/pyanaconda/core/users.py b/pyanaconda/core/users.py index 5ea9051c788..878b42b6f07 100644 --- a/pyanaconda/core/users.py +++ b/pyanaconda/core/users.py @@ -19,18 +19,22 @@ import os import os.path +import re import subprocess from pathlib import Path +from random import SystemRandom as sr from pyanaconda.core import util from pyanaconda.core.configuration.anaconda import conf +from pyanaconda.core.i18n import _ from pyanaconda.core.path import make_directories, open_with_perm +from pyanaconda.core.regexes import ( + GROUPLIST_FANCY_PARSE, + GROUPLIST_SIMPLE_VALID, + NAME_VALID, + PORTABLE_FS_CHARS, +) from pyanaconda.core.string import strip_accents -from pyanaconda.core.regexes import GROUPLIST_FANCY_PARSE, NAME_VALID, PORTABLE_FS_CHARS, \ - GROUPLIST_SIMPLE_VALID -from pyanaconda.core.i18n import _ -import re -from random import SystemRandom as sr try: # Use the standalone (not deprecated) package when available @@ -40,6 +44,7 @@ import crypt as crypt_r # pylint: disable=deprecated-module from pyanaconda.anaconda_loggers import get_module_logger + log = get_module_logger(__name__) diff --git a/pyanaconda/core/util.py b/pyanaconda/core/util.py index 727c549827d..80fd05f356e 100644 --- a/pyanaconda/core/util.py +++ b/pyanaconda/core/util.py @@ -18,33 +18,38 @@ # along with this program. If not, see . # +import functools +import importlib.machinery +import importlib.util +import inspect import os import os.path -import subprocess -# Used for ascii_lowercase, ascii_uppercase constants -import tempfile import re import signal +import subprocess import sys + +# Used for ascii_lowercase, ascii_uppercase constants +import tempfile import types -import inspect -import functools -import importlib.util -import importlib.machinery import requests from requests_file import FileAdapter from requests_ftp import FTPAdapter +from pyanaconda.anaconda_loggers import get_module_logger, get_program_logger +from pyanaconda.anaconda_logging import program_log_lock from pyanaconda.core.configuration.anaconda import conf -from pyanaconda.core.path import make_directories, open_with_perm, join_paths -from pyanaconda.core.constants import DRACUT_SHUTDOWN_EJECT, \ - IPMI_ABORTED, PACKAGES_LIST_FILE, DRACUT_REPO_DIR +from pyanaconda.core.constants import ( + DRACUT_REPO_DIR, + DRACUT_SHUTDOWN_EJECT, + IPMI_ABORTED, + PACKAGES_LIST_FILE, +) from pyanaconda.core.live_user import get_live_user +from pyanaconda.core.path import join_paths, make_directories, open_with_perm from pyanaconda.errors import RemovedModuleError -from pyanaconda.anaconda_logging import program_log_lock -from pyanaconda.anaconda_loggers import get_module_logger, get_program_logger log = get_module_logger(__name__) program_log = get_program_logger() diff --git a/pyanaconda/display.py b/pyanaconda/display.py index 196ec2d857e..f9742621f0c 100644 --- a/pyanaconda/display.py +++ b/pyanaconda/display.py @@ -20,33 +20,30 @@ # Author(s): Martin Kolman # import os -import time -import textwrap import signal - +import textwrap +import time from collections import namedtuple -from pyanaconda.mutter_display import MutterDisplay, MutterConfigError +import blivet +from simpleline import App +from simpleline.render.screen_handler import ScreenHandler +from systemd import journal + +from pyanaconda import startup_utils +from pyanaconda.anaconda_loggers import get_module_logger, get_stdout_logger +from pyanaconda.core import constants, hw, util from pyanaconda.core.configuration.anaconda import conf +from pyanaconda.core.i18n import _ from pyanaconda.core.path import join_paths from pyanaconda.core.process_watchers import WatchProcesses -from pyanaconda import startup_utils -from pyanaconda.core import util, constants, hw -from pyanaconda.gnome_remote_desktop import GRDServer -from pyanaconda.core.i18n import _ from pyanaconda.flags import flags +from pyanaconda.gnome_remote_desktop import GRDServer from pyanaconda.modules.common.constants.services import NETWORK -from pyanaconda.ui.tui.spokes.askrd import AskRDSpoke, RDPAuthSpoke +from pyanaconda.mutter_display import MutterConfigError, MutterDisplay from pyanaconda.ui.tui import tui_quit_callback +from pyanaconda.ui.tui.spokes.askrd import AskRDSpoke, RDPAuthSpoke -import blivet - -from simpleline import App -from simpleline.render.screen_handler import ScreenHandler - -from systemd import journal - -from pyanaconda.anaconda_loggers import get_module_logger, get_stdout_logger log = get_module_logger(__name__) stdout_log = get_stdout_logger() diff --git a/pyanaconda/errors.py b/pyanaconda/errors.py index 4aec70deae6..152343ee81b 100644 --- a/pyanaconda/errors.py +++ b/pyanaconda/errors.py @@ -16,11 +16,16 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . from pyanaconda.anaconda_loggers import get_module_logger -from pyanaconda.core.i18n import _, C_ +from pyanaconda.core.i18n import C_, _ from pyanaconda.flags import flags -from pyanaconda.modules.common.errors.installation import BootloaderInstallationError, \ - StorageInstallationError, NonCriticalInstallationError, PayloadInstallationError, \ - InsightsClientMissingError, InsightsConnectError +from pyanaconda.modules.common.errors.installation import ( + BootloaderInstallationError, + InsightsClientMissingError, + InsightsConnectError, + NonCriticalInstallationError, + PayloadInstallationError, + StorageInstallationError, +) from pyanaconda.modules.common.errors.payload import SourceSetupError from pyanaconda.modules.common.errors.storage import UnusableStorageError from pyanaconda.modules.common.errors.subscription import SatelliteProvisioningError diff --git a/pyanaconda/exception.py b/pyanaconda/exception.py index 0d19fcf7424..58539b42409 100644 --- a/pyanaconda/exception.py +++ b/pyanaconda/exception.py @@ -19,7 +19,6 @@ # import errno import glob -import gi import os import re import shutil @@ -28,30 +27,29 @@ import traceback import blivet.errors - +import gi from meh import Config from meh.dump import ReverseExceptionDump from meh.handler import ExceptionHandler +from pykickstart.constants import KS_SCRIPT_ONERROR, KS_SCRIPT_TRACEBACK +from simpleline import App +from simpleline.event_loop.signals import ExceptionSignal +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core import util from pyanaconda.core.async_utils import run_in_loop from pyanaconda.core.configuration.anaconda import conf -from pyanaconda.core.constants import THREAD_EXCEPTION_HANDLING_TEST, IPMI_FAILED +from pyanaconda.core.constants import IPMI_FAILED, THREAD_EXCEPTION_HANDLING_TEST +from pyanaconda.core.i18n import _ from pyanaconda.core.product import get_product_is_final_release +from pyanaconda.core.threads import thread_manager from pyanaconda.errors import NonInteractiveError -from pyanaconda.core.i18n import _ from pyanaconda.modules.common.constants.objects import SCRIPTS from pyanaconda.modules.common.constants.services import RUNTIME from pyanaconda.modules.common.errors.storage import UnusableStorageError -from pyanaconda.core.threads import thread_manager from pyanaconda.modules.common.task import sync_run_task from pyanaconda.ui.communication import hubQ -from simpleline import App -from simpleline.event_loop.signals import ExceptionSignal -from pykickstart.constants import KS_SCRIPT_ONERROR, KS_SCRIPT_TRACEBACK - -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) diff --git a/pyanaconda/flags.py b/pyanaconda/flags.py index abb1e670dfc..d52fa2a7c48 100644 --- a/pyanaconda/flags.py +++ b/pyanaconda/flags.py @@ -16,9 +16,9 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.constants import ANACONDA_ENVIRON -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) diff --git a/pyanaconda/gnome_remote_desktop.py b/pyanaconda/gnome_remote_desktop.py index 4d253015e19..1034b880662 100644 --- a/pyanaconda/gnome_remote_desktop.py +++ b/pyanaconda/gnome_remote_desktop.py @@ -18,21 +18,20 @@ # import os +import socket import sys import time -import socket from systemd import journal + from pyanaconda import network +from pyanaconda.anaconda_loggers import get_module_logger, get_stdout_logger from pyanaconda.core import util from pyanaconda.core.constants import THREAD_RDP_OBTAIN_HOSTNAME +from pyanaconda.core.i18n import _ from pyanaconda.core.threads import thread_manager from pyanaconda.core.util import execWithRedirect, startProgram -from pyanaconda.core.i18n import _ - -from pyanaconda.anaconda_loggers import get_stdout_logger, get_module_logger - stdoutLog = get_stdout_logger() log = get_module_logger(__name__) diff --git a/pyanaconda/input_checking.py b/pyanaconda/input_checking.py index 4a84bdaebf1..3c86af095a3 100644 --- a/pyanaconda/input_checking.py +++ b/pyanaconda/input_checking.py @@ -20,12 +20,11 @@ import pwquality -from pyanaconda.core.signal import Signal +from pyanaconda.anaconda_loggers import get_module_logger +from pyanaconda.core import constants, regexes, users from pyanaconda.core.i18n import _ from pyanaconda.core.kernel import kernel_arguments -from pyanaconda.core import constants, regexes -from pyanaconda.core import users -from pyanaconda.anaconda_loggers import get_module_logger +from pyanaconda.core.signal import Signal from pyanaconda.modules.common.constants.objects import USER_INTERFACE from pyanaconda.modules.common.constants.services import RUNTIME from pyanaconda.modules.common.structures.policy import PasswordPolicy diff --git a/pyanaconda/installation.py b/pyanaconda/installation.py index 6b492c5ae01..8563a757805 100644 --- a/pyanaconda/installation.py +++ b/pyanaconda/installation.py @@ -17,30 +17,57 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from pyanaconda.core.dbus import DBus -from pyanaconda.core.configuration.anaconda import conf -from pyanaconda.core.constants import PAYLOAD_LIVE_TYPES, PAYLOAD_TYPE_DNF, CATEGORY_SYSTEM, \ - CATEGORY_BOOTLOADER, CATEGORY_ENVIRONMENT, CATEGORY_STORAGE, CATEGORY_SOFTWARE -from pyanaconda.modules.boss.install_manager.installation_category_interface \ - import CategoryReportTaskInterface -from pyanaconda.modules.common.constants.objects import BOOTLOADER, SNAPSHOT, FIREWALL, SCRIPTS -from pyanaconda.modules.common.constants.services import STORAGE, USERS, SERVICES, NETWORK, \ - SECURITY, LOCALIZATION, TIMEZONE, BOSS, SUBSCRIPTION, RUNTIME -from pyanaconda.modules.common.task import sync_run_task, Task as InstallationTask -from pyanaconda.modules.common.util import is_module_available -from pyanaconda import flags +from pykickstart.constants import ( + KS_SCRIPT_POST, + KS_SCRIPT_PREINSTALL, + SNAPSHOT_WHEN_POST_INSTALL, +) + +from pyanaconda import flags, network +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core import util +from pyanaconda.core.configuration.anaconda import conf +from pyanaconda.core.constants import ( + CATEGORY_BOOTLOADER, + CATEGORY_ENVIRONMENT, + CATEGORY_SOFTWARE, + CATEGORY_STORAGE, + CATEGORY_SYSTEM, + PAYLOAD_LIVE_TYPES, + PAYLOAD_TYPE_DNF, +) +from pyanaconda.core.dbus import DBus +from pyanaconda.core.i18n import _ from pyanaconda.core.path import open_with_perm from pyanaconda.core.service import is_service_installed -from pyanaconda import network -from pyanaconda.core.i18n import _ from pyanaconda.core.threads import thread_manager +from pyanaconda.installation_tasks import DBusTask, Task, TaskQueue from pyanaconda.kexec import setup_kexec -from pyanaconda.installation_tasks import Task, TaskQueue, DBusTask -from pykickstart.constants import (SNAPSHOT_WHEN_POST_INSTALL, KS_SCRIPT_PREINSTALL, - KS_SCRIPT_POST) +from pyanaconda.modules.boss.install_manager.installation_category_interface import ( + CategoryReportTaskInterface, +) +from pyanaconda.modules.common.constants.objects import ( + BOOTLOADER, + FIREWALL, + SCRIPTS, + SNAPSHOT, +) +from pyanaconda.modules.common.constants.services import ( + BOSS, + LOCALIZATION, + NETWORK, + RUNTIME, + SECURITY, + SERVICES, + STORAGE, + SUBSCRIPTION, + TIMEZONE, + USERS, +) +from pyanaconda.modules.common.task import Task as InstallationTask +from pyanaconda.modules.common.task import sync_run_task +from pyanaconda.modules.common.util import is_module_available -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) __all__ = ["RunInstallationTask"] diff --git a/pyanaconda/installation_tasks.py b/pyanaconda/installation_tasks.py index 3872ce1ffe6..a59df8441bb 100644 --- a/pyanaconda/installation_tasks.py +++ b/pyanaconda/installation_tasks.py @@ -22,14 +22,14 @@ from dasbus.error import DBusError +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core import util from pyanaconda.core.constants import IPMI_ABORTED from pyanaconda.core.signal import Signal -from pyanaconda.errors import errorHandler, ERROR_RAISE -from pyanaconda.modules.common.errors.runtime import ScriptError +from pyanaconda.errors import ERROR_RAISE, errorHandler from pyanaconda.flags import flags +from pyanaconda.modules.common.errors.runtime import ScriptError from pyanaconda.modules.common.task import sync_run_task -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) diff --git a/pyanaconda/kexec.py b/pyanaconda/kexec.py index db0eb32fab5..499bdfb79e2 100644 --- a/pyanaconda/kexec.py +++ b/pyanaconda/kexec.py @@ -18,9 +18,8 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -import shutil import shlex - +import shutil from collections import namedtuple from pyanaconda.anaconda_loggers import get_module_logger diff --git a/pyanaconda/keyboard.py b/pyanaconda/keyboard.py index 353ad110b48..634fe34c45b 100644 --- a/pyanaconda/keyboard.py +++ b/pyanaconda/keyboard.py @@ -21,15 +21,16 @@ """ import re + import langtable -from pyanaconda.core.configuration.anaconda import conf from pyanaconda import localization +from pyanaconda.anaconda_loggers import get_module_logger +from pyanaconda.core.configuration.anaconda import conf from pyanaconda.core.constants import DEFAULT_KEYBOARD -from pyanaconda.modules.common.task import sync_run_task from pyanaconda.modules.common.constants.services import LOCALIZATION +from pyanaconda.modules.common.task import sync_run_task -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py index a39c1f63e95..58b0f2660bd 100644 --- a/pyanaconda/kickstart.py +++ b/pyanaconda/kickstart.py @@ -22,31 +22,38 @@ import sys import time import warnings - from contextlib import contextmanager -from pyanaconda.anaconda_loggers import get_module_logger, get_stdout_logger -from pyanaconda.core import util -from pyanaconda.core.kickstart.scripts import run_script -from pyanaconda.core.kickstart import VERSION, commands as COMMANDS -from pyanaconda.core.kickstart.specification import KickstartSpecification -from pyanaconda.core.constants import IPMI_ABORTED -from pyanaconda.core.i18n import _ -from pyanaconda.errors import errorHandler, ScriptError -from pyanaconda.flags import flags -from pyanaconda.modules.common.constants.services import BOSS -from pyanaconda.modules.common.structures.kickstart import KickstartReport - from pykickstart.base import KickstartCommand, RemovedCommand from pykickstart.constants import KS_SCRIPT_PRE from pykickstart.errors import KickstartError, KickstartParseWarning from pykickstart.ko import KickstartObject from pykickstart.parser import KickstartParser from pykickstart.parser import Script as KSScript -from pykickstart.sections import NullSection, PostScriptSection, PreScriptSection, \ - PreInstallScriptSection, OnErrorScriptSection, TracebackScriptSection, Section +from pykickstart.sections import ( + NullSection, + OnErrorScriptSection, + PostScriptSection, + PreInstallScriptSection, + PreScriptSection, + Section, + TracebackScriptSection, +) from pykickstart.version import returnClassForVersion +from pyanaconda.anaconda_loggers import get_module_logger, get_stdout_logger +from pyanaconda.core import util +from pyanaconda.core.constants import IPMI_ABORTED +from pyanaconda.core.i18n import _ +from pyanaconda.core.kickstart import VERSION +from pyanaconda.core.kickstart import commands as COMMANDS +from pyanaconda.core.kickstart.scripts import run_script +from pyanaconda.core.kickstart.specification import KickstartSpecification +from pyanaconda.errors import ScriptError, errorHandler +from pyanaconda.flags import flags +from pyanaconda.modules.common.constants.services import BOSS +from pyanaconda.modules.common.structures.kickstart import KickstartReport + log = get_module_logger(__name__) stdoutLog = get_stdout_logger() diff --git a/pyanaconda/lifecycle.py b/pyanaconda/lifecycle.py index fb5fe6ad343..42c415fd6f0 100644 --- a/pyanaconda/lifecycle.py +++ b/pyanaconda/lifecycle.py @@ -19,10 +19,11 @@ # from threading import RLock + +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.signal import Signal from pyanaconda.core.util import synchronized -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) _controllers = {} diff --git a/pyanaconda/localization.py b/pyanaconda/localization.py index a865d9cafbd..3e44ebb462a 100644 --- a/pyanaconda/localization.py +++ b/pyanaconda/localization.py @@ -17,21 +17,22 @@ # Red Hat, Inc. # +import functools import gettext +import glob +import locale as locale_mod import os import re -import langtable -import locale as locale_mod -import glob from collections import namedtuple -import functools +import langtable + +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core import constants -from pyanaconda.core.util import setenv, execWithRedirect from pyanaconda.core.string import upcase_first_letter +from pyanaconda.core.util import execWithRedirect, setenv from pyanaconda.modules.common.constants.services import BOSS -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) SCRIPTS_SUPPORTED_BY_CONSOLE = {'Latn', 'Cyrl', 'Grek'} diff --git a/pyanaconda/modules/boss/__main__.py b/pyanaconda/modules/boss/__main__.py index 1bf7a5d3142..87087de29c1 100644 --- a/pyanaconda/modules/boss/__main__.py +++ b/pyanaconda/modules/boss/__main__.py @@ -18,8 +18,10 @@ # Red Hat, Inc. # from pyanaconda.modules.common import init + init() from pyanaconda.modules.boss.boss import Boss + service = Boss() service.run() diff --git a/pyanaconda/modules/boss/boss.py b/pyanaconda/modules/boss/boss.py index 2bb78f1fcd5..fc27c1897e4 100755 --- a/pyanaconda/modules/boss/boss.py +++ b/pyanaconda/modules/boss/boss.py @@ -21,10 +21,10 @@ from pyanaconda.core.configuration.anaconda import conf from pyanaconda.core.dbus import DBus from pyanaconda.modules.boss.boss_interface import BossInterface -from pyanaconda.modules.boss.module_manager import ModuleManager from pyanaconda.modules.boss.install_manager import InstallManager from pyanaconda.modules.boss.installation import CopyLogsTask, SetContextsTask from pyanaconda.modules.boss.kickstart_manager import KickstartManager +from pyanaconda.modules.boss.module_manager import ModuleManager from pyanaconda.modules.common.base import Service from pyanaconda.modules.common.constants.services import BOSS from pyanaconda.modules.common.containers import TaskContainer @@ -108,8 +108,8 @@ def install_with_tasks(self): :return: a list of DBus paths of the installation tasks """ from pyanaconda.installation import RunInstallationTask - from pyanaconda.payload.migrated import ActiveDBusPayload from pyanaconda.kickstart import superclass + from pyanaconda.payload.migrated import ActiveDBusPayload return [ RunInstallationTask( diff --git a/pyanaconda/modules/boss/boss_interface.py b/pyanaconda/modules/boss/boss_interface.py index aa911107cc3..317e924b006 100644 --- a/pyanaconda/modules/boss/boss_interface.py +++ b/pyanaconda/modules/boss/boss_interface.py @@ -21,12 +21,12 @@ from dasbus.server.interface import dbus_interface from dasbus.typing import * # pylint: disable=wildcard-import -from pyanaconda.modules.common.constants.services import BOSS from pyanaconda.modules.common.base.base_template import InterfaceTemplate +from pyanaconda.modules.common.constants.services import BOSS from pyanaconda.modules.common.containers import TaskContainer +from pyanaconda.modules.common.custom_typing import BusName from pyanaconda.modules.common.structures.kickstart import KickstartReport from pyanaconda.modules.common.structures.requirement import Requirement -from pyanaconda.modules.common.custom_typing import BusName __all__ = ["BossInterface"] diff --git a/pyanaconda/modules/boss/install_manager/install_manager.py b/pyanaconda/modules/boss/install_manager/install_manager.py index b9e7dcd7094..078af9edbcf 100644 --- a/pyanaconda/modules/boss/install_manager/install_manager.py +++ b/pyanaconda/modules/boss/install_manager/install_manager.py @@ -16,10 +16,10 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.dbus import DBus from pyanaconda.modules.common.structures.requirement import Requirement -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) diff --git a/pyanaconda/modules/boss/install_manager/installation_category_interface.py b/pyanaconda/modules/boss/install_manager/installation_category_interface.py index 6bb305ecc83..11383959619 100644 --- a/pyanaconda/modules/boss/install_manager/installation_category_interface.py +++ b/pyanaconda/modules/boss/install_manager/installation_category_interface.py @@ -19,8 +19,9 @@ # Red Hat, Inc. # from dasbus.server.interface import dbus_interface, dbus_signal -from pyanaconda.modules.common.constants.interfaces import TASK_CATEGORY from dasbus.typing import * # pylint: disable=wildcard-import + +from pyanaconda.modules.common.constants.interfaces import TASK_CATEGORY from pyanaconda.modules.common.task import TaskInterface __all__ = ['CategoryReportTaskInterface'] diff --git a/pyanaconda/modules/boss/installation.py b/pyanaconda/modules/boss/installation.py index d3bcfe4200f..49206384940 100644 --- a/pyanaconda/modules/boss/installation.py +++ b/pyanaconda/modules/boss/installation.py @@ -15,13 +15,13 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # +import glob import os.path import shutil -import glob from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.configuration.anaconda import conf -from pyanaconda.core.path import make_directories, join_paths, open_with_perm +from pyanaconda.core.path import join_paths, make_directories, open_with_perm from pyanaconda.core.util import execWithRedirect, restorecon from pyanaconda.modules.common.task import Task diff --git a/pyanaconda/modules/boss/kickstart_manager/kickstart_manager.py b/pyanaconda/modules/boss/kickstart_manager/kickstart_manager.py index 789c36466b7..1b23f0bac70 100644 --- a/pyanaconda/modules/boss/kickstart_manager/kickstart_manager.py +++ b/pyanaconda/modules/boss/kickstart_manager/kickstart_manager.py @@ -20,10 +20,15 @@ from pykickstart.version import makeVersion from pyanaconda.anaconda_loggers import get_module_logger -from pyanaconda.modules.boss.kickstart_manager.parser import SplitKickstartParser,\ - VALID_SECTIONS_ANACONDA +from pyanaconda.modules.boss.kickstart_manager.parser import ( + VALID_SECTIONS_ANACONDA, + SplitKickstartParser, +) from pyanaconda.modules.common.constants.services import BOSS -from pyanaconda.modules.common.structures.kickstart import KickstartReport, KickstartMessage +from pyanaconda.modules.common.structures.kickstart import ( + KickstartMessage, + KickstartReport, +) log = get_module_logger(__name__) diff --git a/pyanaconda/modules/boss/kickstart_manager/parser.py b/pyanaconda/modules/boss/kickstart_manager/parser.py index e67237e65b8..7d10b9bffae 100644 --- a/pyanaconda/modules/boss/kickstart_manager/parser.py +++ b/pyanaconda/modules/boss/kickstart_manager/parser.py @@ -21,8 +21,10 @@ from pykickstart.parser import KickstartParser from pykickstart.sections import Section -from pyanaconda.modules.boss.kickstart_manager.element import KickstartElement,\ - TrackedKickstartElements +from pyanaconda.modules.boss.kickstart_manager.element import ( + KickstartElement, + TrackedKickstartElements, +) VALID_SECTIONS_ANACONDA = [ "%pre", "%pre-install", "%post", "%onerror", "%traceback", "%packages", "%addon" diff --git a/pyanaconda/modules/boss/module_manager/__init__.py b/pyanaconda/modules/boss/module_manager/__init__.py index 4046a51fa0a..9c3a813a381 100644 --- a/pyanaconda/modules/boss/module_manager/__init__.py +++ b/pyanaconda/modules/boss/module_manager/__init__.py @@ -15,7 +15,7 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from pyanaconda.modules.boss.module_manager.module_observer import ModuleObserver from pyanaconda.modules.boss.module_manager.module_manager import ModuleManager +from pyanaconda.modules.boss.module_manager.module_observer import ModuleObserver __all__ = ['ModuleManager', 'ModuleObserver'] diff --git a/pyanaconda/modules/boss/module_manager/module_manager.py b/pyanaconda/modules/boss/module_manager/module_manager.py index 5246294b6e9..94d2f40013e 100644 --- a/pyanaconda/modules/boss/module_manager/module_manager.py +++ b/pyanaconda/modules/boss/module_manager/module_manager.py @@ -16,12 +16,12 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.configuration.anaconda import conf -from pyanaconda.core.signal import Signal from pyanaconda.core.dbus import DBus +from pyanaconda.core.signal import Signal from pyanaconda.modules.boss.module_manager.start_modules import StartModulesTask -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) diff --git a/pyanaconda/modules/boss/module_manager/module_observer.py b/pyanaconda/modules/boss/module_manager/module_observer.py index 2b7a9f945ea..904713f2052 100644 --- a/pyanaconda/modules/boss/module_manager/module_observer.py +++ b/pyanaconda/modules/boss/module_manager/module_observer.py @@ -14,8 +14,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -from dasbus.namespace import get_namespace_from_name, get_dbus_path, get_dbus_name from dasbus.client.observer import DBusObserver, DBusObserverError +from dasbus.namespace import get_dbus_name, get_dbus_path, get_namespace_from_name from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.modules.common.constants.namespaces import ADDONS_NAMESPACE diff --git a/pyanaconda/modules/boss/module_manager/start_modules.py b/pyanaconda/modules/boss/module_manager/start_modules.py index 4532a621a65..db7598f155a 100644 --- a/pyanaconda/modules/boss/module_manager/start_modules.py +++ b/pyanaconda/modules/boss/module_manager/start_modules.py @@ -19,9 +19,10 @@ from functools import partial from queue import SimpleQueue -from pyanaconda.anaconda_loggers import get_module_logger from dasbus.constants import DBUS_FLAG_NONE, DBUS_START_REPLY_SUCCESS -from pyanaconda.modules.boss.module_manager import ModuleObserver + +from pyanaconda.anaconda_loggers import get_module_logger +from pyanaconda.modules.boss.module_manager.module_observer import ModuleObserver from pyanaconda.modules.common.errors.module import UnavailableModuleError from pyanaconda.modules.common.task import Task diff --git a/pyanaconda/modules/common/__init__.py b/pyanaconda/modules/common/__init__.py index 27c78601b32..27f54738337 100644 --- a/pyanaconda/modules/common/__init__.py +++ b/pyanaconda/modules/common/__init__.py @@ -56,10 +56,11 @@ def init(log_filename=None, log_stream=sys.stderr): ) import locale + from pyanaconda.core.constants import DEFAULT_LANG locale.setlocale(locale.LC_ALL, DEFAULT_LANG) - from pyanaconda.core.configuration.anaconda import conf from pyanaconda.anaconda_loggers import get_module_logger + from pyanaconda.core.configuration.anaconda import conf log = get_module_logger(__name__) log.debug("The configuration is loaded from: %s", conf.get_sources()) diff --git a/pyanaconda/modules/common/base/__init__.py b/pyanaconda/modules/common/base/__init__.py index 01363fffdbe..7334f96a51c 100644 --- a/pyanaconda/modules/common/base/__init__.py +++ b/pyanaconda/modules/common/base/__init__.py @@ -15,11 +15,17 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from pyanaconda.modules.common.base.base import BaseModule, Service, KickstartService, \ - KickstartBaseModule +from pyanaconda.modules.common.base.base import ( + BaseModule, + KickstartBaseModule, + KickstartService, + Service, +) from pyanaconda.modules.common.base.base_interface import KickstartModuleInterface -from pyanaconda.modules.common.base.base_template import ModuleInterfaceTemplate, \ - KickstartModuleInterfaceTemplate +from pyanaconda.modules.common.base.base_template import ( + KickstartModuleInterfaceTemplate, + ModuleInterfaceTemplate, +) __all__ = [ "BaseModule", diff --git a/pyanaconda/modules/common/base/base.py b/pyanaconda/modules/common/base/base.py index 9a21cf9ce37..1cacd34988f 100644 --- a/pyanaconda/modules/common/base/base.py +++ b/pyanaconda/modules/common/base/base.py @@ -21,20 +21,26 @@ import os import warnings from abc import ABC -from locale import setlocale, LC_ALL +from locale import LC_ALL, setlocale from pykickstart.errors import KickstartError, KickstartParseWarning +from pyanaconda.anaconda_loggers import get_module_logger +from pyanaconda.core.dbus import DBus from pyanaconda.core.glib import create_main_loop +from pyanaconda.core.kickstart.specification import ( + KickstartSpecificationHandler, + KickstartSpecificationParser, + NoKickstartSpecification, +) +from pyanaconda.core.signal import Signal from pyanaconda.core.timer import Timer from pyanaconda.core.util import setenv -from pyanaconda.core.dbus import DBus -from pyanaconda.core.signal import Signal -from pyanaconda.core.kickstart.specification import NoKickstartSpecification, \ - KickstartSpecificationHandler, KickstartSpecificationParser -from pyanaconda.modules.common.structures.kickstart import KickstartReport, KickstartMessage +from pyanaconda.modules.common.structures.kickstart import ( + KickstartMessage, + KickstartReport, +) -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) diff --git a/pyanaconda/modules/common/base/base_interface.py b/pyanaconda/modules/common/base/base_interface.py index 4c33e12d556..9ef8972814e 100644 --- a/pyanaconda/modules/common/base/base_interface.py +++ b/pyanaconda/modules/common/base/base_interface.py @@ -17,11 +17,14 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from pyanaconda.modules.common.base.base_template import KickstartModuleInterfaceTemplate -from pyanaconda.modules.common.constants.interfaces import KICKSTART_MODULE +from dasbus.server.interface import dbus_interface from dasbus.server.property import emits_properties_changed from dasbus.typing import * # pylint: disable=wildcard-import -from dasbus.server.interface import dbus_interface + +from pyanaconda.modules.common.base.base_template import ( + KickstartModuleInterfaceTemplate, +) +from pyanaconda.modules.common.constants.interfaces import KICKSTART_MODULE from pyanaconda.modules.common.containers import TaskContainer from pyanaconda.modules.common.structures.kickstart import KickstartReport from pyanaconda.modules.common.structures.requirement import Requirement diff --git a/pyanaconda/modules/common/constants/interfaces.py b/pyanaconda/modules/common/constants/interfaces.py index a143b0459c4..f8f25eb3a00 100644 --- a/pyanaconda/modules/common/constants/interfaces.py +++ b/pyanaconda/modules/common/constants/interfaces.py @@ -17,10 +17,15 @@ # along with this program. If not, see . # from dasbus.identifier import DBusInterfaceIdentifier -from pyanaconda.modules.common.constants.namespaces import ANACONDA_NAMESPACE, \ - MODULES_NAMESPACE, PARTITIONING_NAMESPACE, DEVICE_TREE_NAMESPACE, PAYLOAD_NAMESPACE, \ - SOURCE_NAMESPACE +from pyanaconda.modules.common.constants.namespaces import ( + ANACONDA_NAMESPACE, + DEVICE_TREE_NAMESPACE, + MODULES_NAMESPACE, + PARTITIONING_NAMESPACE, + PAYLOAD_NAMESPACE, + SOURCE_NAMESPACE, +) KICKSTART_MODULE = DBusInterfaceIdentifier( namespace=MODULES_NAMESPACE diff --git a/pyanaconda/modules/common/constants/objects.py b/pyanaconda/modules/common/constants/objects.py index f5b1ab00ca7..573888a1614 100644 --- a/pyanaconda/modules/common/constants/objects.py +++ b/pyanaconda/modules/common/constants/objects.py @@ -17,9 +17,15 @@ # along with this program. If not, see . # from dasbus.identifier import DBusObjectIdentifier -from pyanaconda.modules.common.constants.namespaces import STORAGE_NAMESPACE, NETWORK_NAMESPACE, \ - PARTITIONING_NAMESPACE, DEVICE_TREE_NAMESPACE, \ - RHSM_NAMESPACE, RUNTIME_NAMESPACE + +from pyanaconda.modules.common.constants.namespaces import ( + DEVICE_TREE_NAMESPACE, + NETWORK_NAMESPACE, + PARTITIONING_NAMESPACE, + RHSM_NAMESPACE, + RUNTIME_NAMESPACE, + STORAGE_NAMESPACE, +) # Runtime objects diff --git a/pyanaconda/modules/common/constants/services.py b/pyanaconda/modules/common/constants/services.py index 72ed9b4890a..241f49d69c2 100644 --- a/pyanaconda/modules/common/constants/services.py +++ b/pyanaconda/modules/common/constants/services.py @@ -16,12 +16,24 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -from pyanaconda.core.dbus import SystemBus, SessionBus, DBus from dasbus.identifier import DBusServiceIdentifier -from pyanaconda.modules.common.constants.namespaces import BOSS_NAMESPACE, TIMEZONE_NAMESPACE, \ - NETWORK_NAMESPACE, LOCALIZATION_NAMESPACE, SECURITY_NAMESPACE, USERS_NAMESPACE, \ - PAYLOADS_NAMESPACE, STORAGE_NAMESPACE, SERVICES_NAMESPACE, SUBSCRIPTION_NAMESPACE, \ - RHSM_NAMESPACE, NETWORK_MANAGER_NAMESPACE, RUNTIME_NAMESPACE + +from pyanaconda.core.dbus import DBus, SessionBus, SystemBus +from pyanaconda.modules.common.constants.namespaces import ( + BOSS_NAMESPACE, + LOCALIZATION_NAMESPACE, + NETWORK_MANAGER_NAMESPACE, + NETWORK_NAMESPACE, + PAYLOADS_NAMESPACE, + RHSM_NAMESPACE, + RUNTIME_NAMESPACE, + SECURITY_NAMESPACE, + SERVICES_NAMESPACE, + STORAGE_NAMESPACE, + SUBSCRIPTION_NAMESPACE, + TIMEZONE_NAMESPACE, + USERS_NAMESPACE, +) # Anaconda services. diff --git a/pyanaconda/modules/common/containers.py b/pyanaconda/modules/common/containers.py index 66d1b1a0a79..4669edff72c 100644 --- a/pyanaconda/modules/common/containers.py +++ b/pyanaconda/modules/common/containers.py @@ -17,9 +17,15 @@ # along with this program. If not, see . # from dasbus.server.container import DBusContainer + from pyanaconda.core.dbus import DBus -from pyanaconda.modules.common.constants.namespaces import ANACONDA_NAMESPACE, \ - DEVICE_TREE_NAMESPACE, PARTITIONING_NAMESPACE, SOURCE_NAMESPACE, PAYLOAD_NAMESPACE +from pyanaconda.modules.common.constants.namespaces import ( + ANACONDA_NAMESPACE, + DEVICE_TREE_NAMESPACE, + PARTITIONING_NAMESPACE, + PAYLOAD_NAMESPACE, + SOURCE_NAMESPACE, +) TaskContainer = DBusContainer( namespace=ANACONDA_NAMESPACE, diff --git a/pyanaconda/modules/common/errors/__init__.py b/pyanaconda/modules/common/errors/__init__.py index ab19025a8e2..3def3bd57c4 100644 --- a/pyanaconda/modules/common/errors/__init__.py +++ b/pyanaconda/modules/common/errors/__init__.py @@ -29,5 +29,5 @@ def register_errors(): payload, runtime, storage, - task + task, ) diff --git a/pyanaconda/modules/common/structures/group.py b/pyanaconda/modules/common/structures/group.py index 37e2025a792..218f70097ca 100644 --- a/pyanaconda/modules/common/structures/group.py +++ b/pyanaconda/modules/common/structures/group.py @@ -17,7 +17,6 @@ # along with this program. If not, see . # from dasbus.structure import DBusData - from dasbus.typing import * # pylint: disable=wildcard-import from pyanaconda.core.constants import ID_MODE_USE_DEFAULT, ID_MODE_USE_VALUE diff --git a/pyanaconda/modules/common/structures/live_image.py b/pyanaconda/modules/common/structures/live_image.py index b47e6252c52..08be113c648 100644 --- a/pyanaconda/modules/common/structures/live_image.py +++ b/pyanaconda/modules/common/structures/live_image.py @@ -18,7 +18,7 @@ # Red Hat, Inc. # from dasbus.structure import DBusData -from dasbus.typing import Str, Bool +from dasbus.typing import Bool, Str __all__ = ["LiveImageConfigurationData"] diff --git a/pyanaconda/modules/common/structures/packages.py b/pyanaconda/modules/common/structures/packages.py index 72beed2558d..6d94a228b5e 100644 --- a/pyanaconda/modules/common/structures/packages.py +++ b/pyanaconda/modules/common/structures/packages.py @@ -20,8 +20,12 @@ from dasbus.structure import DBusData from dasbus.typing import * # pylint: disable=wildcard-import -from pyanaconda.core.constants import MULTILIB_POLICY_BEST, RPM_LANGUAGES_ALL, \ - DNF_DEFAULT_TIMEOUT, DNF_DEFAULT_RETRIES +from pyanaconda.core.constants import ( + DNF_DEFAULT_RETRIES, + DNF_DEFAULT_TIMEOUT, + MULTILIB_POLICY_BEST, + RPM_LANGUAGES_ALL, +) __all__ = ["PackagesConfigurationData", "PackagesSelectionData"] diff --git a/pyanaconda/modules/common/structures/payload.py b/pyanaconda/modules/common/structures/payload.py index eafc8300070..37d3602475a 100644 --- a/pyanaconda/modules/common/structures/payload.py +++ b/pyanaconda/modules/common/structures/payload.py @@ -21,8 +21,12 @@ from dasbus.structure import DBusData from dasbus.typing import * # pylint: disable=wildcard-import +from pyanaconda.core.constants import ( + DNF_DEFAULT_REPO_COST, + REPO_ORIGIN_USER, + URL_TYPE_BASEURL, +) from pyanaconda.core.path import join_paths -from pyanaconda.core.constants import URL_TYPE_BASEURL, DNF_DEFAULT_REPO_COST, REPO_ORIGIN_USER __all__ = ["RepoConfigurationData", "SSLConfigurationData"] diff --git a/pyanaconda/modules/common/structures/requirement.py b/pyanaconda/modules/common/structures/requirement.py index 61010e03246..a038de1f57c 100644 --- a/pyanaconda/modules/common/structures/requirement.py +++ b/pyanaconda/modules/common/structures/requirement.py @@ -20,7 +20,7 @@ from dasbus.structure import DBusData from dasbus.typing import * # pylint: disable=wildcard-import -from pyanaconda.core.constants import REQUIREMENT_TYPE_PACKAGE, REQUIREMENT_TYPE_GROUP +from pyanaconda.core.constants import REQUIREMENT_TYPE_GROUP, REQUIREMENT_TYPE_PACKAGE __all__ = ["Requirement"] diff --git a/pyanaconda/modules/common/structures/rpm_ostree.py b/pyanaconda/modules/common/structures/rpm_ostree.py index 38db37dcc8c..4119163a46b 100644 --- a/pyanaconda/modules/common/structures/rpm_ostree.py +++ b/pyanaconda/modules/common/structures/rpm_ostree.py @@ -18,7 +18,7 @@ # Red Hat, Inc. # from dasbus.structure import DBusData -from dasbus.typing import Str, Bool +from dasbus.typing import Bool, Str __all__ = ["RPMOSTreeConfigurationData", "RPMOSTreeContainerConfigurationData"] diff --git a/pyanaconda/modules/common/structures/secret.py b/pyanaconda/modules/common/structures/secret.py index 73c8aed818d..df008947169 100644 --- a/pyanaconda/modules/common/structures/secret.py +++ b/pyanaconda/modules/common/structures/secret.py @@ -19,11 +19,15 @@ # import copy -from dasbus.structure import DBusData, get_fields, generate_string_from_data +from dasbus.structure import DBusData, generate_string_from_data, get_fields from dasbus.typing import * # pylint: disable=wildcard-import from pyanaconda.anaconda_loggers import get_module_logger -from pyanaconda.core.constants import SECRET_TYPE_NONE, SECRET_TYPE_TEXT, SECRET_TYPE_HIDDEN +from pyanaconda.core.constants import ( + SECRET_TYPE_HIDDEN, + SECRET_TYPE_NONE, + SECRET_TYPE_TEXT, +) log = get_module_logger(__name__) diff --git a/pyanaconda/modules/common/structures/sshkey.py b/pyanaconda/modules/common/structures/sshkey.py index 88e860be302..630892c5749 100644 --- a/pyanaconda/modules/common/structures/sshkey.py +++ b/pyanaconda/modules/common/structures/sshkey.py @@ -17,7 +17,6 @@ # along with this program. If not, see . # from dasbus.structure import DBusData - from dasbus.typing import * # pylint: disable=wildcard-import __all__ = ["SshKeyData"] diff --git a/pyanaconda/modules/common/structures/subscription.py b/pyanaconda/modules/common/structures/subscription.py index 1e06b5e4a76..d42c6fa0c93 100644 --- a/pyanaconda/modules/common/structures/subscription.py +++ b/pyanaconda/modules/common/structures/subscription.py @@ -20,7 +20,6 @@ from dasbus.typing import * # pylint: disable=wildcard-import from pyanaconda.core.constants import DEFAULT_SUBSCRIPTION_REQUEST_TYPE - from pyanaconda.modules.common.structures.secret import SecretData, SecretDataList __all__ = ["SubscriptionRequest", "SystemPurposeData"] diff --git a/pyanaconda/modules/common/structures/user.py b/pyanaconda/modules/common/structures/user.py index 4eea3615bf7..72c60246f48 100644 --- a/pyanaconda/modules/common/structures/user.py +++ b/pyanaconda/modules/common/structures/user.py @@ -16,9 +16,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -from dasbus.structure import DBusData - -from dasbus.structure import generate_string_from_data +from dasbus.structure import DBusData, generate_string_from_data from dasbus.typing import * # pylint: disable=wildcard-import from pyanaconda.core.constants import ID_MODE_USE_DEFAULT, ID_MODE_USE_VALUE diff --git a/pyanaconda/modules/common/task/__init__.py b/pyanaconda/modules/common/task/__init__.py index d31eccf1b83..75ba8ca103a 100644 --- a/pyanaconda/modules/common/task/__init__.py +++ b/pyanaconda/modules/common/task/__init__.py @@ -16,10 +16,10 @@ # Red Hat, Inc. # import math -from time import sleep, perf_counter +from time import perf_counter, sleep +from pyanaconda.modules.common.task.task import AbstractTask, Task, ValidationTask from pyanaconda.modules.common.task.task_interface import TaskInterface -from pyanaconda.modules.common.task.task import Task, ValidationTask, AbstractTask __all__ = [ "AbstractTask", diff --git a/pyanaconda/modules/common/task/cancellable.py b/pyanaconda/modules/common/task/cancellable.py index 5e6c1df44b3..a501ba80188 100644 --- a/pyanaconda/modules/common/task/cancellable.py +++ b/pyanaconda/modules/common/task/cancellable.py @@ -15,10 +15,11 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from threading import Lock from abc import ABC +from threading import Lock from pyanaconda.anaconda_loggers import get_module_logger + log = get_module_logger(__name__) __all__ = ['Cancellable'] diff --git a/pyanaconda/modules/common/task/progress.py b/pyanaconda/modules/common/task/progress.py index e7b73894619..068949ff8d7 100644 --- a/pyanaconda/modules/common/task/progress.py +++ b/pyanaconda/modules/common/task/progress.py @@ -18,8 +18,8 @@ from abc import ABC, abstractmethod from threading import Lock -from pyanaconda.core.signal import Signal from pyanaconda.core.async_utils import async_action_nowait +from pyanaconda.core.signal import Signal __all__ = ['ProgressReporter'] diff --git a/pyanaconda/modules/common/task/runnable.py b/pyanaconda/modules/common/task/runnable.py index d1c82ab8d4e..1c342f38750 100644 --- a/pyanaconda/modules/common/task/runnable.py +++ b/pyanaconda/modules/common/task/runnable.py @@ -17,8 +17,8 @@ # from abc import ABC, abstractmethod -from pyanaconda.core.signal import Signal from pyanaconda.core.async_utils import async_action_nowait +from pyanaconda.core.signal import Signal __all__ = ['Runnable'] diff --git a/pyanaconda/modules/common/task/task.py b/pyanaconda/modules/common/task/task.py index dfa2cc4ce9a..eb7727561c7 100644 --- a/pyanaconda/modules/common/task/task.py +++ b/pyanaconda/modules/common/task/task.py @@ -23,18 +23,21 @@ import traceback from abc import abstractmethod -from pyanaconda.core.constants import THREAD_DBUS_TASK from dasbus.server.publishable import Publishable +from pyanaconda.anaconda_loggers import get_module_logger +from pyanaconda.core.constants import THREAD_DBUS_TASK +from pyanaconda.core.threads import thread_manager from pyanaconda.modules.common.errors.task import NoResultError -from pyanaconda.modules.common.task.task_interface import TaskInterface, ValidationTaskInterface from pyanaconda.modules.common.task.cancellable import Cancellable from pyanaconda.modules.common.task.progress import ProgressReporter from pyanaconda.modules.common.task.result import ResultProvider from pyanaconda.modules.common.task.runnable import Runnable -from pyanaconda.core.threads import thread_manager +from pyanaconda.modules.common.task.task_interface import ( + TaskInterface, + ValidationTaskInterface, +) -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) __all__ = ['AbstractTask', 'Task', 'ValidationTask'] diff --git a/pyanaconda/modules/common/task/task_interface.py b/pyanaconda/modules/common/task/task_interface.py index 8a539b14d9e..51b5e246437 100644 --- a/pyanaconda/modules/common/task/task_interface.py +++ b/pyanaconda/modules/common/task/task_interface.py @@ -20,10 +20,11 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from dasbus.server.interface import dbus_interface, dbus_signal, dbus_class -from pyanaconda.modules.common.constants.interfaces import TASK -from pyanaconda.modules.common.base.base_template import InterfaceTemplate +from dasbus.server.interface import dbus_class, dbus_interface, dbus_signal from dasbus.typing import * # pylint: disable=wildcard-import + +from pyanaconda.modules.common.base.base_template import InterfaceTemplate +from pyanaconda.modules.common.constants.interfaces import TASK from pyanaconda.modules.common.errors.task import NoResultError from pyanaconda.modules.common.structures.validation import ValidationReport diff --git a/pyanaconda/modules/localization/__main__.py b/pyanaconda/modules/localization/__main__.py index 77340b8149c..de189c177c6 100644 --- a/pyanaconda/modules/localization/__main__.py +++ b/pyanaconda/modules/localization/__main__.py @@ -18,8 +18,10 @@ # Red Hat, Inc. # from pyanaconda.modules.common import init + init() from pyanaconda.modules.localization.localization import LocalizationService + service = LocalizationService() service.run() diff --git a/pyanaconda/modules/localization/installation.py b/pyanaconda/modules/localization/installation.py index b4006a66989..6b6d419835c 100644 --- a/pyanaconda/modules/localization/installation.py +++ b/pyanaconda/modules/localization/installation.py @@ -20,11 +20,13 @@ from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.constants import DEFAULT_VC_FONT -from pyanaconda.core.util import execWithCapture from pyanaconda.core.path import join_paths -from pyanaconda.localization import get_locale_console_fonts, find_best_locale_match -from pyanaconda.modules.common.errors.installation import LanguageInstallationError, \ - KeyboardInstallationError +from pyanaconda.core.util import execWithCapture +from pyanaconda.localization import find_best_locale_match, get_locale_console_fonts +from pyanaconda.modules.common.errors.installation import ( + KeyboardInstallationError, + LanguageInstallationError, +) from pyanaconda.modules.common.task import Task from pyanaconda.modules.localization.utils import get_missing_keyboard_configuration diff --git a/pyanaconda/modules/localization/kickstart.py b/pyanaconda/modules/localization/kickstart.py index 4598da78279..868fcde4528 100644 --- a/pyanaconda/modules/localization/kickstart.py +++ b/pyanaconda/modules/localization/kickstart.py @@ -17,7 +17,8 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from pyanaconda.core.kickstart import KickstartSpecification, commands as COMMANDS +from pyanaconda.core.kickstart import KickstartSpecification +from pyanaconda.core.kickstart import commands as COMMANDS class LocalizationKickstartSpecification(KickstartSpecification): diff --git a/pyanaconda/modules/localization/live_keyboard.py b/pyanaconda/modules/localization/live_keyboard.py index 0ff4a459e00..160f6c9a8bc 100644 --- a/pyanaconda/modules/localization/live_keyboard.py +++ b/pyanaconda/modules/localization/live_keyboard.py @@ -15,12 +15,13 @@ # Red Hat, Inc. # -from abc import ABC, abstractmethod import ast -from pyanaconda.core.util import execWithCaptureAsLiveUser -from pyanaconda.core.configuration.anaconda import conf +from abc import ABC, abstractmethod from pyanaconda.anaconda_loggers import get_module_logger +from pyanaconda.core.configuration.anaconda import conf +from pyanaconda.core.util import execWithCaptureAsLiveUser + log = get_module_logger(__name__) diff --git a/pyanaconda/modules/localization/localed.py b/pyanaconda/modules/localization/localed.py index f51fe5c9741..af5e5c926e9 100644 --- a/pyanaconda/modules/localization/localed.py +++ b/pyanaconda/modules/localization/localed.py @@ -15,14 +15,17 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # +from pyanaconda.anaconda_loggers import get_module_logger +from pyanaconda.core.configuration.anaconda import conf from pyanaconda.core.dbus import SystemBus from pyanaconda.core.signal import Signal +from pyanaconda.keyboard import ( + InvalidLayoutVariantSpec, + join_layout_variant, + parse_layout_variant, +) from pyanaconda.modules.common.constants.services import LOCALED -from pyanaconda.core.configuration.anaconda import conf -from pyanaconda.keyboard import join_layout_variant, parse_layout_variant, \ - InvalidLayoutVariantSpec -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) diff --git a/pyanaconda/modules/localization/localization.py b/pyanaconda/modules/localization/localization.py index 6d8e44951d1..627f39dc2f8 100644 --- a/pyanaconda/modules/localization/localization.py +++ b/pyanaconda/modules/localization/localization.py @@ -19,24 +19,35 @@ # import langtable +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.configuration.anaconda import conf from pyanaconda.core.dbus import DBus from pyanaconda.core.signal import Signal -from pyanaconda.localization import get_available_translations, get_common_languages, \ - get_english_name, get_language_locales, get_language_id, get_native_name +from pyanaconda.localization import ( + get_available_translations, + get_common_languages, + get_english_name, + get_language_id, + get_language_locales, + get_native_name, +) from pyanaconda.modules.common.base import KickstartService from pyanaconda.modules.common.constants.services import LOCALIZATION from pyanaconda.modules.common.containers import TaskContainer from pyanaconda.modules.common.structures.language import LanguageData, LocaleData -from pyanaconda.modules.localization.localization_interface import LocalizationInterface +from pyanaconda.modules.localization.installation import ( + KeyboardInstallationTask, + LanguageInstallationTask, +) from pyanaconda.modules.localization.kickstart import LocalizationKickstartSpecification -from pyanaconda.modules.localization.installation import LanguageInstallationTask, \ - KeyboardInstallationTask -from pyanaconda.modules.localization.runtime import GetMissingKeyboardConfigurationTask, \ - ApplyKeyboardTask, AssignGenericKeyboardSettingTask from pyanaconda.modules.localization.localed import LocaledWrapper +from pyanaconda.modules.localization.localization_interface import LocalizationInterface +from pyanaconda.modules.localization.runtime import ( + ApplyKeyboardTask, + AssignGenericKeyboardSettingTask, + GetMissingKeyboardConfigurationTask, +) -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) diff --git a/pyanaconda/modules/localization/localization_interface.py b/pyanaconda/modules/localization/localization_interface.py index 4a299f2b7ce..0b46702583c 100644 --- a/pyanaconda/modules/localization/localization_interface.py +++ b/pyanaconda/modules/localization/localization_interface.py @@ -18,13 +18,14 @@ # Red Hat, Inc. # -from pyanaconda.modules.common.structures.language import LanguageData, LocaleData -from pyanaconda.modules.common.constants.services import LOCALIZATION +from dasbus.server.interface import dbus_interface, dbus_signal from dasbus.server.property import emits_properties_changed from dasbus.typing import * # pylint: disable=wildcard-import + from pyanaconda.modules.common.base import KickstartModuleInterface +from pyanaconda.modules.common.constants.services import LOCALIZATION from pyanaconda.modules.common.containers import TaskContainer -from dasbus.server.interface import dbus_interface, dbus_signal +from pyanaconda.modules.common.structures.language import LanguageData, LocaleData @dbus_interface(LOCALIZATION.interface_name) diff --git a/pyanaconda/modules/localization/runtime.py b/pyanaconda/modules/localization/runtime.py index 721b1156e8e..d0d1ab283d0 100644 --- a/pyanaconda/modules/localization/runtime.py +++ b/pyanaconda/modules/localization/runtime.py @@ -15,13 +15,13 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from pyanaconda.core.util import execWithRedirect +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.configuration.anaconda import conf +from pyanaconda.core.util import execWithRedirect from pyanaconda.modules.common.errors.configuration import KeyboardConfigurationError from pyanaconda.modules.common.task import Task -from pyanaconda.modules.localization.utils import get_missing_keyboard_configuration -from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.modules.localization.installation import write_vc_configuration +from pyanaconda.modules.localization.utils import get_missing_keyboard_configuration log = get_module_logger(__name__) diff --git a/pyanaconda/modules/localization/utils.py b/pyanaconda/modules/localization/utils.py index 758886597f8..ac11a884276 100644 --- a/pyanaconda/modules/localization/utils.py +++ b/pyanaconda/modules/localization/utils.py @@ -15,10 +15,10 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.constants import DEFAULT_KEYBOARD from pyanaconda.modules.localization.live_keyboard import get_live_keyboard_instance -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) diff --git a/pyanaconda/modules/network/__main__.py b/pyanaconda/modules/network/__main__.py index 2f2b978e921..a42e0c45bdf 100644 --- a/pyanaconda/modules/network/__main__.py +++ b/pyanaconda/modules/network/__main__.py @@ -18,8 +18,10 @@ # Red Hat, Inc. # from pyanaconda.modules.common import init + init() from pyanaconda.modules.network.network import NetworkService + service = NetworkService() service.run() diff --git a/pyanaconda/modules/network/config_file.py b/pyanaconda/modules/network/config_file.py index 7a43e34a547..0d0b0d1fc73 100644 --- a/pyanaconda/modules/network/config_file.py +++ b/pyanaconda/modules/network/config_file.py @@ -21,6 +21,7 @@ import os from pyanaconda.anaconda_loggers import get_module_logger + log = get_module_logger(__name__) __all__ = ["IFCFG_DIR", "KEYFILE_DIR", "get_config_files_content", "is_config_file_for_system"] diff --git a/pyanaconda/modules/network/constants.py b/pyanaconda/modules/network/constants.py index f6cd603e14c..01a2bfc1266 100644 --- a/pyanaconda/modules/network/constants.py +++ b/pyanaconda/modules/network/constants.py @@ -19,9 +19,12 @@ # from enum import Enum, unique -from pyanaconda.core.constants import FIREWALL_DEFAULT, FIREWALL_DISABLED, \ - FIREWALL_ENABLED, FIREWALL_USE_SYSTEM_DEFAULTS - +from pyanaconda.core.constants import ( + FIREWALL_DEFAULT, + FIREWALL_DISABLED, + FIREWALL_ENABLED, + FIREWALL_USE_SYSTEM_DEFAULTS, +) NM_CONNECTION_UUID_LENGTH = 36 CONNECTION_ADDING_TIMEOUT = 5 diff --git a/pyanaconda/modules/network/device_configuration.py b/pyanaconda/modules/network/device_configuration.py index 8460dded1c0..c600aedd2c7 100644 --- a/pyanaconda/modules/network/device_configuration.py +++ b/pyanaconda/modules/network/device_configuration.py @@ -20,21 +20,32 @@ import copy +import gi + from pyanaconda.core.signal import Signal -from pyanaconda.modules.network.nm_client import get_iface_from_connection, \ - get_vlan_interface_name_from_connection, get_config_file_connection_of_device, \ - is_bootif_connection from pyanaconda.modules.common.structures.network import NetworkDeviceConfiguration -from pyanaconda.modules.network.constants import NM_CONNECTION_TYPE_WIFI, \ - NM_CONNECTION_TYPE_ETHERNET, NM_CONNECTION_TYPE_VLAN, NM_CONNECTION_TYPE_BOND, \ - NM_CONNECTION_TYPE_TEAM, NM_CONNECTION_TYPE_BRIDGE, NM_CONNECTION_TYPE_INFINIBAND +from pyanaconda.modules.network.constants import ( + NM_CONNECTION_TYPE_BOND, + NM_CONNECTION_TYPE_BRIDGE, + NM_CONNECTION_TYPE_ETHERNET, + NM_CONNECTION_TYPE_INFINIBAND, + NM_CONNECTION_TYPE_TEAM, + NM_CONNECTION_TYPE_VLAN, + NM_CONNECTION_TYPE_WIFI, +) +from pyanaconda.modules.network.nm_client import ( + get_config_file_connection_of_device, + get_iface_from_connection, + get_vlan_interface_name_from_connection, + is_bootif_connection, +) from pyanaconda.modules.network.utils import is_ibft_configured_device, is_nbft_device -import gi gi.require_version("NM", "1.0") from gi.repository import NM from pyanaconda.anaconda_loggers import get_module_logger + log = get_module_logger(__name__) diff --git a/pyanaconda/modules/network/firewall/__init__.py b/pyanaconda/modules/network/firewall/__init__.py index 0f182278a00..12a8677bc09 100644 --- a/pyanaconda/modules/network/firewall/__init__.py +++ b/pyanaconda/modules/network/firewall/__init__.py @@ -16,4 +16,5 @@ # Red Hat, Inc. # from pyanaconda.modules.network.firewall.firewall import FirewallModule + __all__ = ["FirewallModule"] diff --git a/pyanaconda/modules/network/firewall/firewall.py b/pyanaconda/modules/network/firewall/firewall.py index 9a850f5a8a7..06516148ab6 100644 --- a/pyanaconda/modules/network/firewall/firewall.py +++ b/pyanaconda/modules/network/firewall/firewall.py @@ -17,9 +17,10 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.configuration.anaconda import conf -from pyanaconda.core.signal import Signal from pyanaconda.core.dbus import DBus +from pyanaconda.core.signal import Signal from pyanaconda.modules.common.base import KickstartBaseModule from pyanaconda.modules.common.constants.objects import FIREWALL from pyanaconda.modules.common.structures.requirement import Requirement @@ -27,7 +28,6 @@ from pyanaconda.modules.network.firewall.firewall_interface import FirewallInterface from pyanaconda.modules.network.firewall.installation import ConfigureFirewallTask -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) diff --git a/pyanaconda/modules/network/firewall/firewall_interface.py b/pyanaconda/modules/network/firewall/firewall_interface.py index 8ee9102a538..fefce356875 100644 --- a/pyanaconda/modules/network/firewall/firewall_interface.py +++ b/pyanaconda/modules/network/firewall/firewall_interface.py @@ -20,6 +20,7 @@ from dasbus.server.interface import dbus_interface from dasbus.server.property import emits_properties_changed from dasbus.typing import * # pylint: disable=wildcard-import + from pyanaconda.modules.common.base import KickstartModuleInterfaceTemplate from pyanaconda.modules.common.constants.objects import FIREWALL from pyanaconda.modules.common.containers import TaskContainer diff --git a/pyanaconda/modules/network/firewall/installation.py b/pyanaconda/modules/network/firewall/installation.py index 8322dcb5cb6..ef209b2fc6f 100644 --- a/pyanaconda/modules/network/firewall/installation.py +++ b/pyanaconda/modules/network/firewall/installation.py @@ -17,12 +17,12 @@ # import os -from pyanaconda.core.util import execWithRedirect -from pyanaconda.modules.network.constants import FirewallMode +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.i18n import _ -from pyanaconda.modules.common.task import Task +from pyanaconda.core.util import execWithRedirect from pyanaconda.modules.common.errors.installation import FirewallConfigurationError -from pyanaconda.anaconda_loggers import get_module_logger +from pyanaconda.modules.common.task import Task +from pyanaconda.modules.network.constants import FirewallMode log = get_module_logger(__name__) diff --git a/pyanaconda/modules/network/initialization.py b/pyanaconda/modules/network/initialization.py index acedc602692..b5b134ede5e 100644 --- a/pyanaconda/modules/network/initialization.py +++ b/pyanaconda/modules/network/initialization.py @@ -18,23 +18,38 @@ import copy import re -from pyanaconda.core.regexes import NM_MAC_INITRAMFS_CONNECTION +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.constants import NETWORK_CAPABILITY_TEAM +from pyanaconda.core.regexes import NM_MAC_INITRAMFS_CONNECTION from pyanaconda.modules.common.task import Task -from pyanaconda.anaconda_loggers import get_module_logger -from pyanaconda.modules.network.network_interface import NetworkInitializationTaskInterface -from pyanaconda.modules.network.nm_client import get_device_name_from_network_data, \ - update_connection_from_ksdata, add_connection_from_ksdata, bound_hwaddr_of_device, \ - update_connection_values, commit_changes_with_autoconnection_blocked, \ - get_config_file_connection_of_device, clone_connection_sync, nm_client_in_thread, \ - is_bootif_connection -from pyanaconda.modules.network.device_configuration import supported_wired_device_types, \ - virtual_device_types -from pyanaconda.modules.network.utils import guard_by_system_configuration, is_nbft_device +from pyanaconda.modules.network.device_configuration import ( + supported_wired_device_types, + virtual_device_types, +) +from pyanaconda.modules.network.network_interface import ( + NetworkInitializationTaskInterface, +) +from pyanaconda.modules.network.nm_client import ( + add_connection_from_ksdata, + bound_hwaddr_of_device, + clone_connection_sync, + commit_changes_with_autoconnection_blocked, + get_config_file_connection_of_device, + get_device_name_from_network_data, + is_bootif_connection, + nm_client_in_thread, + update_connection_from_ksdata, + update_connection_values, +) +from pyanaconda.modules.network.utils import ( + guard_by_system_configuration, + is_nbft_device, +) log = get_module_logger(__name__) import gi + gi.require_version("NM", "1.0") from gi.repository import NM diff --git a/pyanaconda/modules/network/installation.py b/pyanaconda/modules/network/installation.py index 00be4b306f7..2c95c368c5f 100644 --- a/pyanaconda/modules/network/installation.py +++ b/pyanaconda/modules/network/installation.py @@ -18,19 +18,26 @@ import os import shutil -from pyanaconda.core.path import make_directories, join_paths +from pyanaconda.anaconda_loggers import get_module_logger +from pyanaconda.core.path import join_paths, make_directories from pyanaconda.modules.common.errors.installation import NetworkInstallationError from pyanaconda.modules.common.task import Task -from pyanaconda.anaconda_loggers import get_module_logger -from pyanaconda.modules.network.nm_client import update_connection_values, \ - commit_changes_with_autoconnection_blocked, nm_client_in_thread -from pyanaconda.modules.network.utils import guard_by_system_configuration, is_nbft_device -from pyanaconda.modules.network.nm_client import get_config_file_connection_of_device from pyanaconda.modules.network.config_file import IFCFG_DIR, KEYFILE_DIR +from pyanaconda.modules.network.nm_client import ( + commit_changes_with_autoconnection_blocked, + get_config_file_connection_of_device, + nm_client_in_thread, + update_connection_values, +) +from pyanaconda.modules.network.utils import ( + guard_by_system_configuration, + is_nbft_device, +) log = get_module_logger(__name__) import gi + gi.require_version("NM", "1.0") from gi.repository import NM diff --git a/pyanaconda/modules/network/kickstart.py b/pyanaconda/modules/network/kickstart.py index 50b8be5b117..8268c7d58df 100644 --- a/pyanaconda/modules/network/kickstart.py +++ b/pyanaconda/modules/network/kickstart.py @@ -18,7 +18,9 @@ # Red Hat, Inc. # from pykickstart.errors import KickstartParseError -from pyanaconda.core.kickstart import KickstartSpecification, commands as COMMANDS + +from pyanaconda.core.kickstart import KickstartSpecification +from pyanaconda.core.kickstart import commands as COMMANDS from pyanaconda.network import is_valid_hostname DEFAULT_DEVICE_SPECIFICATION = "link" diff --git a/pyanaconda/modules/network/network.py b/pyanaconda/modules/network/network.py index 0882144b8cd..142697feddf 100644 --- a/pyanaconda/modules/network/network.py +++ b/pyanaconda/modules/network/network.py @@ -17,42 +17,62 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # +import gi from dasbus.client.observer import DBusObserver from pyanaconda.core.async_utils import run_in_loop from pyanaconda.core.configuration.anaconda import conf from pyanaconda.core.configuration.network import NetworkOnBoot -from pyanaconda.core.kernel import kernel_arguments +from pyanaconda.core.constants import NETWORK_CAPABILITY_TEAM from pyanaconda.core.dbus import DBus +from pyanaconda.core.kernel import kernel_arguments from pyanaconda.core.signal import Signal -from pyanaconda.core.constants import NETWORK_CAPABILITY_TEAM from pyanaconda.modules.common.base import KickstartService +from pyanaconda.modules.common.constants.services import HOSTNAME, NETWORK from pyanaconda.modules.common.containers import TaskContainer +from pyanaconda.modules.common.structures.network import NetworkDeviceInfo from pyanaconda.modules.common.structures.requirement import Requirement -from pyanaconda.modules.common.constants.services import NETWORK, HOSTNAME -from pyanaconda.modules.network.network_interface import NetworkInterface -from pyanaconda.modules.network.kickstart import NetworkKickstartSpecification, \ - update_network_hostname_data, update_network_data_with_default_device, \ - DEFAULT_DEVICE_SPECIFICATION, update_first_network_command_activate_value +from pyanaconda.modules.network.config_file import ( + get_config_files_content, + is_config_file_for_system, +) +from pyanaconda.modules.network.device_configuration import ( + DeviceConfigurations, + supported_device_types, + supported_wired_device_types, +) from pyanaconda.modules.network.firewall import FirewallModule -from pyanaconda.modules.network.device_configuration import DeviceConfigurations, \ - supported_device_types, supported_wired_device_types -from pyanaconda.modules.network.nm_client import devices_ignore_ipv6, get_connections_dump, \ - get_dracut_arguments_from_connection, get_kickstart_network_data, get_new_nm_client -from pyanaconda.modules.network.config_file import get_config_files_content, \ - is_config_file_for_system -from pyanaconda.modules.network.installation import NetworkInstallationTask, \ - ConfigureActivationOnBootTask, HostnameConfigurationTask -from pyanaconda.modules.network.initialization import ApplyKickstartTask, \ - DumpMissingConfigFilesTask +from pyanaconda.modules.network.initialization import ( + ApplyKickstartTask, + DumpMissingConfigFilesTask, +) +from pyanaconda.modules.network.installation import ( + ConfigureActivationOnBootTask, + HostnameConfigurationTask, + NetworkInstallationTask, +) +from pyanaconda.modules.network.kickstart import ( + DEFAULT_DEVICE_SPECIFICATION, + NetworkKickstartSpecification, + update_first_network_command_activate_value, + update_network_data_with_default_device, + update_network_hostname_data, +) +from pyanaconda.modules.network.network_interface import NetworkInterface +from pyanaconda.modules.network.nm_client import ( + devices_ignore_ipv6, + get_connections_dump, + get_dracut_arguments_from_connection, + get_kickstart_network_data, + get_new_nm_client, +) from pyanaconda.modules.network.utils import get_default_route_iface -from pyanaconda.modules.common.structures.network import NetworkDeviceInfo -import gi gi.require_version("NM", "1.0") from gi.repository import NM from pyanaconda.anaconda_loggers import get_module_logger + log = get_module_logger(__name__) diff --git a/pyanaconda/modules/network/network_interface.py b/pyanaconda/modules/network/network_interface.py index e2731671885..2999ce2d699 100644 --- a/pyanaconda/modules/network/network_interface.py +++ b/pyanaconda/modules/network/network_interface.py @@ -18,14 +18,17 @@ # Red Hat, Inc. # -from pyanaconda.modules.common.constants.services import NETWORK +from dasbus.server.interface import dbus_class, dbus_interface, dbus_signal from dasbus.server.property import emits_properties_changed from dasbus.typing import * # pylint: disable=wildcard-import + from pyanaconda.modules.common.base import KickstartModuleInterface -from dasbus.server.interface import dbus_interface, dbus_signal, dbus_class +from pyanaconda.modules.common.constants.services import NETWORK from pyanaconda.modules.common.containers import TaskContainer -from pyanaconda.modules.common.structures.network import NetworkDeviceInfo, \ - NetworkDeviceConfiguration +from pyanaconda.modules.common.structures.network import ( + NetworkDeviceConfiguration, + NetworkDeviceInfo, +) from pyanaconda.modules.common.task import TaskInterface diff --git a/pyanaconda/modules/network/nm_client.py b/pyanaconda/modules/network/nm_client.py index 5c2012ee7ce..ffa54464c7a 100644 --- a/pyanaconda/modules/network/nm_client.py +++ b/pyanaconda/modules/network/nm_client.py @@ -19,25 +19,38 @@ # import gi + gi.require_version("NM", "1.0") -from gi.repository import NM +import socket from contextlib import contextmanager -import socket from blivet.arch import is_s390 +from gi.repository import NM from pykickstart.constants import BIND_TO_MAC -from pyanaconda.core.glib import create_new_context, GError, sync_call_glib -from pyanaconda.modules.network.constants import NM_CONNECTION_UUID_LENGTH, \ - CONNECTION_ADDING_TIMEOUT, NM_CONNECTION_TYPE_WIFI, NM_CONNECTION_TYPE_ETHERNET, \ - NM_CONNECTION_TYPE_VLAN, NM_CONNECTION_TYPE_BOND, NM_CONNECTION_TYPE_TEAM, \ - NM_CONNECTION_TYPE_BRIDGE, NM_CONNECTION_TYPE_INFINIBAND -from pyanaconda.modules.network.kickstart import default_ks_vlan_interface_name -from pyanaconda.modules.network.utils import get_s390_settings, netmask2prefix, prefix2netmask -from pyanaconda.modules.network.config_file import is_config_file_for_system -from pyanaconda.core.dbus import SystemBus -from pyanaconda.core import util from pyanaconda.anaconda_loggers import get_module_logger +from pyanaconda.core import util +from pyanaconda.core.dbus import SystemBus +from pyanaconda.core.glib import GError, create_new_context, sync_call_glib +from pyanaconda.modules.network.config_file import is_config_file_for_system +from pyanaconda.modules.network.constants import ( + CONNECTION_ADDING_TIMEOUT, + NM_CONNECTION_TYPE_BOND, + NM_CONNECTION_TYPE_BRIDGE, + NM_CONNECTION_TYPE_ETHERNET, + NM_CONNECTION_TYPE_INFINIBAND, + NM_CONNECTION_TYPE_TEAM, + NM_CONNECTION_TYPE_VLAN, + NM_CONNECTION_TYPE_WIFI, + NM_CONNECTION_UUID_LENGTH, +) +from pyanaconda.modules.network.kickstart import default_ks_vlan_interface_name +from pyanaconda.modules.network.utils import ( + get_s390_settings, + netmask2prefix, + prefix2netmask, +) + log = get_module_logger(__name__) diff --git a/pyanaconda/modules/network/utils.py b/pyanaconda/modules/network/utils.py index 445c05ef33b..e6ae737a6b2 100644 --- a/pyanaconda/modules/network/utils.py +++ b/pyanaconda/modules/network/utils.py @@ -18,15 +18,15 @@ # Red Hat, Inc. # -import os import glob +import os from functools import wraps +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core import util from pyanaconda.core.configuration.anaconda import conf from pyanaconda.core.regexes import IBFT_CONFIGURED_DEVICE_NAME -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) diff --git a/pyanaconda/modules/payloads/__main__.py b/pyanaconda/modules/payloads/__main__.py index afbeda59ec7..6d37125a5e0 100644 --- a/pyanaconda/modules/payloads/__main__.py +++ b/pyanaconda/modules/payloads/__main__.py @@ -18,12 +18,15 @@ # Red Hat, Inc. # from pyanaconda.modules.common import init + init("/tmp/packaging.log") import os + if "LD_PRELOAD" in os.environ: del os.environ["LD_PRELOAD"] # pylint: disable=environment-modify from pyanaconda.modules.payloads.payloads import PayloadsService + service = PayloadsService() service.run() diff --git a/pyanaconda/modules/payloads/base/initialization.py b/pyanaconda/modules/payloads/base/initialization.py index de957497f9d..0827c1b791e 100644 --- a/pyanaconda/modules/payloads/base/initialization.py +++ b/pyanaconda/modules/payloads/base/initialization.py @@ -16,7 +16,10 @@ # Red Hat, Inc. # from pyanaconda.anaconda_loggers import get_module_logger -from pyanaconda.modules.common.errors.payload import SourceSetupError, SourceTearDownError +from pyanaconda.modules.common.errors.payload import ( + SourceSetupError, + SourceTearDownError, +) from pyanaconda.modules.common.task import Task log = get_module_logger(__name__) diff --git a/pyanaconda/modules/payloads/base/utils.py b/pyanaconda/modules/payloads/base/utils.py index 8bf2b21ce97..9be5602bbf6 100644 --- a/pyanaconda/modules/payloads/base/utils.py +++ b/pyanaconda/modules/payloads/base/utils.py @@ -19,6 +19,7 @@ # from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.payload import rpm_version_key + log = get_module_logger(__name__) diff --git a/pyanaconda/modules/payloads/constants.py b/pyanaconda/modules/payloads/constants.py index afa6b27d5fb..eaf84cd0d1b 100644 --- a/pyanaconda/modules/payloads/constants.py +++ b/pyanaconda/modules/payloads/constants.py @@ -16,15 +16,29 @@ # source code or documentation are not subject to the GNU General Public # License and may only be used or replicated with the express permission of # Red Hat, Inc. -from enum import Enum, unique, auto +from enum import Enum, auto, unique -from pyanaconda.core.constants import \ - PAYLOAD_TYPE_DNF, PAYLOAD_TYPE_LIVE_OS, PAYLOAD_TYPE_LIVE_IMAGE, \ - SOURCE_TYPE_LIVE_OS_IMAGE, SOURCE_TYPE_HMC, SOURCE_TYPE_CDROM, SOURCE_TYPE_REPO_FILES, \ - SOURCE_TYPE_REPO_PATH, SOURCE_TYPE_NFS, SOURCE_TYPE_URL, SOURCE_TYPE_HDD, SOURCE_TYPE_CDN, \ - SOURCE_TYPE_CLOSEST_MIRROR, PAYLOAD_TYPE_RPM_OSTREE, \ - SOURCE_TYPE_RPM_OSTREE, SOURCE_TYPE_RPM_OSTREE_CONTAINER, \ - SOURCE_TYPE_LIVE_IMAGE, SOURCE_TYPE_FLATPAK, SOURCE_TYPE_LIVE_TAR +from pyanaconda.core.constants import ( + PAYLOAD_TYPE_DNF, + PAYLOAD_TYPE_LIVE_IMAGE, + PAYLOAD_TYPE_LIVE_OS, + PAYLOAD_TYPE_RPM_OSTREE, + SOURCE_TYPE_CDN, + SOURCE_TYPE_CDROM, + SOURCE_TYPE_CLOSEST_MIRROR, + SOURCE_TYPE_FLATPAK, + SOURCE_TYPE_HDD, + SOURCE_TYPE_HMC, + SOURCE_TYPE_LIVE_IMAGE, + SOURCE_TYPE_LIVE_OS_IMAGE, + SOURCE_TYPE_LIVE_TAR, + SOURCE_TYPE_NFS, + SOURCE_TYPE_REPO_FILES, + SOURCE_TYPE_REPO_PATH, + SOURCE_TYPE_RPM_OSTREE, + SOURCE_TYPE_RPM_OSTREE_CONTAINER, + SOURCE_TYPE_URL, +) # Locations of repo files. DNF_REPO_DIRS = [ diff --git a/pyanaconda/modules/payloads/kickstart.py b/pyanaconda/modules/payloads/kickstart.py index c1478ae432c..e20a7a58320 100644 --- a/pyanaconda/modules/payloads/kickstart.py +++ b/pyanaconda/modules/payloads/kickstart.py @@ -17,18 +17,37 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from pykickstart.parser import Packages, Group +from pykickstart.constants import ( + GROUP_ALL, + GROUP_DEFAULT, + GROUP_REQUIRED, + KS_BROKEN_IGNORE, + KS_MISSING_IGNORE, +) +from pykickstart.parser import Group, Packages from pykickstart.sections import PackageSection -from pykickstart.constants import GROUP_DEFAULT, GROUP_ALL, GROUP_REQUIRED, KS_MISSING_IGNORE, \ - KS_BROKEN_IGNORE - -from pyanaconda.core.constants import URL_TYPE_BASEURL, URL_TYPE_MIRRORLIST, URL_TYPE_METALINK, \ - DNF_DEFAULT_REPO_COST, REPO_ORIGIN_SYSTEM, REPO_ORIGIN_USER, GROUP_PACKAGE_TYPES_ALL, \ - GROUP_PACKAGE_TYPES_REQUIRED, RPM_LANGUAGES_NONE, MULTILIB_POLICY_ALL, RPM_LANGUAGES_ALL, \ - DNF_DEFAULT_TIMEOUT, DNF_DEFAULT_RETRIES -from pyanaconda.core.kickstart import KickstartSpecification, commands as COMMANDS -from pyanaconda.modules.common.structures.packages import PackagesSelectionData, \ - PackagesConfigurationData + +from pyanaconda.core.constants import ( + DNF_DEFAULT_REPO_COST, + DNF_DEFAULT_RETRIES, + DNF_DEFAULT_TIMEOUT, + GROUP_PACKAGE_TYPES_ALL, + GROUP_PACKAGE_TYPES_REQUIRED, + MULTILIB_POLICY_ALL, + REPO_ORIGIN_SYSTEM, + REPO_ORIGIN_USER, + RPM_LANGUAGES_ALL, + RPM_LANGUAGES_NONE, + URL_TYPE_BASEURL, + URL_TYPE_METALINK, + URL_TYPE_MIRRORLIST, +) +from pyanaconda.core.kickstart import KickstartSpecification +from pyanaconda.core.kickstart import commands as COMMANDS +from pyanaconda.modules.common.structures.packages import ( + PackagesConfigurationData, + PackagesSelectionData, +) from pyanaconda.modules.common.structures.payload import RepoConfigurationData diff --git a/pyanaconda/modules/payloads/payload/dnf/dnf.py b/pyanaconda/modules/payloads/payload/dnf/dnf.py index b0a8e0ace5b..6f6ee29d436 100644 --- a/pyanaconda/modules/payloads/payload/dnf/dnf.py +++ b/pyanaconda/modules/payloads/payload/dnf/dnf.py @@ -20,28 +20,49 @@ from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.configuration.anaconda import conf from pyanaconda.core.signal import Signal -from pyanaconda.modules.common.structures.packages import PackagesConfigurationData, \ - PackagesSelectionData +from pyanaconda.modules.common.structures.packages import ( + PackagesConfigurationData, + PackagesSelectionData, +) from pyanaconda.modules.payloads.constants import PayloadType, SourceType -from pyanaconda.modules.payloads.kickstart import convert_ks_repo_to_repo_data, \ - convert_repo_data_to_ks_repo, convert_ks_data_to_packages_selection, \ - convert_packages_selection_to_ksdata, convert_ks_data_to_packages_configuration, \ - convert_packages_configuration_to_ksdata +from pyanaconda.modules.payloads.kickstart import ( + convert_ks_data_to_packages_configuration, + convert_ks_data_to_packages_selection, + convert_ks_repo_to_repo_data, + convert_packages_configuration_to_ksdata, + convert_packages_selection_to_ksdata, + convert_repo_data_to_ks_repo, +) +from pyanaconda.modules.payloads.payload.dnf.dnf_interface import DNFInterface from pyanaconda.modules.payloads.payload.dnf.dnf_manager import DNFManager -from pyanaconda.modules.payloads.payload.dnf.utils import protect_installation_devices, \ - collect_installation_devices -from pyanaconda.modules.payloads.payload.dnf.validation import CheckPackagesSelectionTask, \ - VerifyRepomdHashesTask -from pyanaconda.modules.payloads.payload.dnf.initialization import configure_dnf_logging, \ - SetUpDNFSourcesTask, SetUpDNFSourcesResult, TearDownDNFSourcesTask -from pyanaconda.modules.payloads.payload.dnf.installation import SetRPMMacrosTask, \ - ResolvePackagesTask, PrepareDownloadLocationTask, DownloadPackagesTask, InstallPackagesTask, \ - CleanUpDownloadLocationTask, WriteRepositoriesTask, ImportRPMKeysTask, \ - UpdateDNFConfigurationTask +from pyanaconda.modules.payloads.payload.dnf.initialization import ( + SetUpDNFSourcesResult, + SetUpDNFSourcesTask, + TearDownDNFSourcesTask, + configure_dnf_logging, +) +from pyanaconda.modules.payloads.payload.dnf.installation import ( + CleanUpDownloadLocationTask, + DownloadPackagesTask, + ImportRPMKeysTask, + InstallPackagesTask, + PrepareDownloadLocationTask, + ResolvePackagesTask, + SetRPMMacrosTask, + UpdateDNFConfigurationTask, + WriteRepositoriesTask, +) from pyanaconda.modules.payloads.payload.dnf.tear_down import ResetDNFManagerTask -from pyanaconda.modules.payloads.payload.dnf.utils import calculate_required_space +from pyanaconda.modules.payloads.payload.dnf.utils import ( + calculate_required_space, + collect_installation_devices, + protect_installation_devices, +) +from pyanaconda.modules.payloads.payload.dnf.validation import ( + CheckPackagesSelectionTask, + VerifyRepomdHashesTask, +) from pyanaconda.modules.payloads.payload.payload_base import PayloadBase -from pyanaconda.modules.payloads.payload.dnf.dnf_interface import DNFInterface from pyanaconda.modules.payloads.source.factory import SourceFactory from pyanaconda.modules.payloads.source.utils import has_network_protocol diff --git a/pyanaconda/modules/payloads/payload/dnf/dnf_interface.py b/pyanaconda/modules/payloads/payload/dnf/dnf_interface.py index 2d8be4fb56d..def621b8530 100644 --- a/pyanaconda/modules/payloads/payload/dnf/dnf_interface.py +++ b/pyanaconda/modules/payloads/payload/dnf/dnf_interface.py @@ -21,13 +21,20 @@ from dasbus.server.property import emits_properties_changed from dasbus.typing import * # pylint: disable=wildcard-import -from pyanaconda.modules.common.containers import TaskContainer from pyanaconda.modules.common.constants.interfaces import PAYLOAD_DNF -from pyanaconda.modules.common.structures.comps import CompsEnvironmentData, CompsGroupData +from pyanaconda.modules.common.containers import TaskContainer +from pyanaconda.modules.common.structures.comps import ( + CompsEnvironmentData, + CompsGroupData, +) +from pyanaconda.modules.common.structures.packages import ( + PackagesConfigurationData, + PackagesSelectionData, +) from pyanaconda.modules.common.structures.payload import RepoConfigurationData -from pyanaconda.modules.common.structures.packages import PackagesConfigurationData, \ - PackagesSelectionData -from pyanaconda.modules.payloads.payload.payload_base_interface import PayloadBaseInterface +from pyanaconda.modules.payloads.payload.payload_base_interface import ( + PayloadBaseInterface, +) __all__ = ["DNFInterface"] diff --git a/pyanaconda/modules/payloads/payload/dnf/dnf_manager.py b/pyanaconda/modules/payloads/payload/dnf/dnf_manager.py index 823569185c6..44860bfe534 100644 --- a/pyanaconda/modules/payloads/payload/dnf/dnf_manager.py +++ b/pyanaconda/modules/payloads/payload/dnf/dnf_manager.py @@ -28,28 +28,44 @@ import dnf.repo import dnf.subject import libdnf.conf - from blivet.size import Size from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.configuration.anaconda import conf -from pyanaconda.core.constants import DNF_DEFAULT_TIMEOUT, DNF_DEFAULT_RETRIES, URL_TYPE_BASEURL, \ - URL_TYPE_MIRRORLIST, URL_TYPE_METALINK, DNF_DEFAULT_REPO_COST +from pyanaconda.core.constants import ( + DNF_DEFAULT_REPO_COST, + DNF_DEFAULT_RETRIES, + DNF_DEFAULT_TIMEOUT, + URL_TYPE_BASEURL, + URL_TYPE_METALINK, + URL_TYPE_MIRRORLIST, +) from pyanaconda.core.i18n import _ from pyanaconda.core.payload import ProxyString, ProxyStringError from pyanaconda.core.util import get_os_release_value from pyanaconda.modules.common.errors.installation import PayloadInstallationError -from pyanaconda.modules.common.errors.payload import UnknownCompsEnvironmentError, \ - UnknownCompsGroupError, UnknownRepositoryError -from pyanaconda.modules.common.structures.comps import CompsEnvironmentData, CompsGroupData +from pyanaconda.modules.common.errors.payload import ( + UnknownCompsEnvironmentError, + UnknownCompsGroupError, + UnknownRepositoryError, +) +from pyanaconda.modules.common.structures.comps import ( + CompsEnvironmentData, + CompsGroupData, +) from pyanaconda.modules.common.structures.packages import PackagesConfigurationData from pyanaconda.modules.common.structures.payload import RepoConfigurationData from pyanaconda.modules.payloads.constants import DNF_REPO_DIRS from pyanaconda.modules.payloads.payload.dnf.download_progress import DownloadProgress -from pyanaconda.modules.payloads.payload.dnf.transaction_progress import TransactionProgress, \ - process_transaction_progress -from pyanaconda.modules.payloads.payload.dnf.utils import get_product_release_version, \ - calculate_hash, transaction_has_errors +from pyanaconda.modules.payloads.payload.dnf.transaction_progress import ( + TransactionProgress, + process_transaction_progress, +) +from pyanaconda.modules.payloads.payload.dnf.utils import ( + calculate_hash, + get_product_release_version, + transaction_has_errors, +) log = get_module_logger(__name__) diff --git a/pyanaconda/modules/payloads/payload/dnf/download_progress.py b/pyanaconda/modules/payloads/payload/dnf/download_progress.py index 057fd609f49..e2694d5f627 100644 --- a/pyanaconda/modules/payloads/payload/dnf/download_progress.py +++ b/pyanaconda/modules/payloads/payload/dnf/download_progress.py @@ -20,7 +20,6 @@ import dnf import dnf.callback - from blivet.size import Size from pyanaconda.anaconda_loggers import get_module_logger diff --git a/pyanaconda/modules/payloads/payload/dnf/initialization.py b/pyanaconda/modules/payloads/payload/dnf/initialization.py index 841c122c3e5..0d198caee00 100644 --- a/pyanaconda/modules/payloads/payload/dnf/initialization.py +++ b/pyanaconda/modules/payloads/payload/dnf/initialization.py @@ -25,12 +25,23 @@ from pyanaconda.core.constants import BASE_REPO_NAME, REPO_ORIGIN_SYSTEM from pyanaconda.core.i18n import _ from pyanaconda.modules.common.errors.payload import SourceSetupError -from pyanaconda.modules.payloads.base.initialization import SetUpSourcesTask, TearDownSourcesTask +from pyanaconda.modules.payloads.base.initialization import ( + SetUpSourcesTask, + TearDownSourcesTask, +) from pyanaconda.modules.payloads.constants import SourceType -from pyanaconda.modules.payloads.payload.dnf.dnf_manager import DNFManager, MetadataError -from pyanaconda.modules.payloads.payload.dnf.repositories import update_treeinfo_repositories, \ - disable_default_repositories, enable_updates_repositories, create_repository, \ - enable_existing_repository, generate_source_from_repository +from pyanaconda.modules.payloads.payload.dnf.dnf_manager import ( + DNFManager, + MetadataError, +) +from pyanaconda.modules.payloads.payload.dnf.repositories import ( + create_repository, + disable_default_repositories, + enable_existing_repository, + enable_updates_repositories, + generate_source_from_repository, + update_treeinfo_repositories, +) from pyanaconda.modules.payloads.payload.dnf.tree_info import LoadTreeInfoMetadataTask DNF_LIBREPO_LOG = "/tmp/dnf.librepo.log" diff --git a/pyanaconda/modules/payloads/payload/dnf/installation.py b/pyanaconda/modules/payloads/payload/dnf/installation.py index fd37fc2ac34..af126003f02 100644 --- a/pyanaconda/modules/payloads/payload/dnf/installation.py +++ b/pyanaconda/modules/payloads/payload/dnf/installation.py @@ -17,25 +17,40 @@ # import os import shutil + import rpm from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core import util from pyanaconda.core.configuration.anaconda import conf -from pyanaconda.core.constants import RPM_LANGUAGES_NONE, RPM_LANGUAGES_ALL, \ - MULTILIB_POLICY_BEST +from pyanaconda.core.constants import ( + MULTILIB_POLICY_BEST, + RPM_LANGUAGES_ALL, + RPM_LANGUAGES_NONE, +) from pyanaconda.core.i18n import _ from pyanaconda.core.path import join_paths, make_directories -from pyanaconda.modules.common.errors.installation import PayloadInstallationError, \ - NonCriticalInstallationError +from pyanaconda.modules.common.errors.installation import ( + NonCriticalInstallationError, + PayloadInstallationError, +) from pyanaconda.modules.common.structures.packages import PackagesConfigurationData from pyanaconda.modules.common.task import Task -from pyanaconda.modules.payloads.payload.dnf.requirements import collect_remote_requirements, \ - collect_language_requirements, collect_platform_requirements, collect_dnf_requirements, \ - collect_driver_disk_requirements, apply_requirements -from pyanaconda.modules.payloads.payload.dnf.utils import pick_download_location, \ - get_kernel_version_list -from pyanaconda.modules.payloads.payload.dnf.validation import CheckPackagesSelectionTask +from pyanaconda.modules.payloads.payload.dnf.requirements import ( + apply_requirements, + collect_dnf_requirements, + collect_driver_disk_requirements, + collect_language_requirements, + collect_platform_requirements, + collect_remote_requirements, +) +from pyanaconda.modules.payloads.payload.dnf.utils import ( + get_kernel_version_list, + pick_download_location, +) +from pyanaconda.modules.payloads.payload.dnf.validation import ( + CheckPackagesSelectionTask, +) log = get_module_logger(__name__) diff --git a/pyanaconda/modules/payloads/payload/dnf/repositories.py b/pyanaconda/modules/payloads/payload/dnf/repositories.py index c836541313b..56b9020f63d 100644 --- a/pyanaconda/modules/payloads/payload/dnf/repositories.py +++ b/pyanaconda/modules/payloads/payload/dnf/repositories.py @@ -15,19 +15,22 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -import os import copy +import os from glob import glob from itertools import count from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.configuration.anaconda import conf -from pyanaconda.core.constants import REPO_ORIGIN_TREEINFO, REPO_ORIGIN_SYSTEM +from pyanaconda.core.constants import REPO_ORIGIN_SYSTEM, REPO_ORIGIN_TREEINFO from pyanaconda.core.i18n import _ from pyanaconda.core.path import join_paths from pyanaconda.core.product import get_product_is_final_release from pyanaconda.core.util import execWithRedirect -from pyanaconda.modules.common.errors.payload import UnknownRepositoryError, SourceSetupError +from pyanaconda.modules.common.errors.payload import ( + SourceSetupError, + UnknownRepositoryError, +) from pyanaconda.modules.common.structures.payload import RepoConfigurationData from pyanaconda.modules.payloads.constants import SourceType from pyanaconda.modules.payloads.payload.dnf.dnf_manager import MetadataError diff --git a/pyanaconda/modules/payloads/payload/dnf/requirements.py b/pyanaconda/modules/payloads/payload/dnf/requirements.py index fe171eb68f6..bc96973af36 100644 --- a/pyanaconda/modules/payloads/payload/dnf/requirements.py +++ b/pyanaconda/modules/payloads/payload/dnf/requirements.py @@ -21,11 +21,14 @@ from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.configuration.anaconda import conf -from pyanaconda.core.constants import REQUIREMENT_TYPE_PACKAGE, REQUIREMENT_TYPE_GROUP, \ - MULTILIB_POLICY_BEST +from pyanaconda.core.constants import ( + MULTILIB_POLICY_BEST, + REQUIREMENT_TYPE_GROUP, + REQUIREMENT_TYPE_PACKAGE, +) from pyanaconda.core.hw import detect_virtualized_platform from pyanaconda.localization import find_best_locale_match, is_valid_langcode -from pyanaconda.modules.common.constants.services import LOCALIZATION, BOSS +from pyanaconda.modules.common.constants.services import BOSS, LOCALIZATION from pyanaconda.modules.common.structures.requirement import Requirement from pyanaconda.modules.common.util import is_module_available diff --git a/pyanaconda/modules/payloads/payload/dnf/transaction_progress.py b/pyanaconda/modules/payloads/payload/dnf/transaction_progress.py index e3378ca7abb..7cb297aa89d 100644 --- a/pyanaconda/modules/payloads/payload/dnf/transaction_progress.py +++ b/pyanaconda/modules/payloads/payload/dnf/transaction_progress.py @@ -15,8 +15,8 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -import dnf.transaction import dnf.callback +import dnf.transaction from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.i18n import _ diff --git a/pyanaconda/modules/payloads/payload/dnf/tree_info.py b/pyanaconda/modules/payloads/payload/dnf/tree_info.py index f9cfab2cd0b..edba8c8c506 100644 --- a/pyanaconda/modules/payloads/payload/dnf/tree_info.py +++ b/pyanaconda/modules/payloads/payload/dnf/tree_info.py @@ -20,20 +20,25 @@ import os import time from collections import namedtuple - from functools import partial + from productmd.treeinfo import TreeInfo -from pyanaconda.modules.common.task import Task from requests import RequestException from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.configuration.anaconda import conf -from pyanaconda.core.constants import URL_TYPE_BASEURL, NETWORK_CONNECTION_TIMEOUT, \ - DEFAULT_REPOS, USER_AGENT, REPO_ORIGIN_TREEINFO +from pyanaconda.core.constants import ( + DEFAULT_REPOS, + NETWORK_CONNECTION_TIMEOUT, + REPO_ORIGIN_TREEINFO, + URL_TYPE_BASEURL, + USER_AGENT, +) from pyanaconda.core.path import join_paths -from pyanaconda.core.payload import split_protocol, ProxyString, ProxyStringError +from pyanaconda.core.payload import ProxyString, ProxyStringError, split_protocol from pyanaconda.core.util import requests_session, xprogressive_delay from pyanaconda.modules.common.structures.payload import RepoConfigurationData +from pyanaconda.modules.common.task import Task log = get_module_logger(__name__) diff --git a/pyanaconda/modules/payloads/payload/dnf/utils.py b/pyanaconda/modules/payloads/payload/dnf/utils.py index cfd43c445e3..f0b765de57b 100644 --- a/pyanaconda/modules/payloads/payload/dnf/utils.py +++ b/pyanaconda/modules/payloads/payload/dnf/utils.py @@ -18,24 +18,24 @@ import fnmatch import hashlib import os -import rpm -from libdnf.transaction import TransactionItemState_ERROR +import rpm from blivet.size import Size +from libdnf.transaction import TransactionItemState_ERROR from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.configuration.anaconda import conf +from pyanaconda.core.hw import is_lpae_available +from pyanaconda.core.path import join_paths from pyanaconda.core.payload import parse_hdd_url +from pyanaconda.core.product import get_product_name, get_product_version from pyanaconda.core.regexes import VERSION_DIGITS from pyanaconda.core.util import execWithCapture -from pyanaconda.core.hw import is_lpae_available -from pyanaconda.core.path import join_paths from pyanaconda.modules.common.constants.objects import DEVICE_TREE, DISK_SELECTION from pyanaconda.modules.common.constants.services import STORAGE from pyanaconda.modules.common.structures.packages import PackagesSelectionData -from pyanaconda.modules.payloads.constants import SourceType -from pyanaconda.core.product import get_product_name, get_product_version from pyanaconda.modules.payloads.base.utils import sort_kernel_version_list +from pyanaconda.modules.payloads.constants import SourceType log = get_module_logger(__name__) diff --git a/pyanaconda/modules/payloads/payload/dnf/validation.py b/pyanaconda/modules/payloads/payload/dnf/validation.py index f5afb42f801..407a7d3eb7d 100644 --- a/pyanaconda/modules/payloads/payload/dnf/validation.py +++ b/pyanaconda/modules/payloads/payload/dnf/validation.py @@ -22,10 +22,15 @@ from pyanaconda.modules.common.structures.packages import PackagesSelectionData from pyanaconda.modules.common.structures.validation import ValidationReport from pyanaconda.modules.common.task import ValidationTask -from pyanaconda.modules.payloads.payload.dnf.dnf_manager import MissingSpecsError, \ - BrokenSpecsError, InvalidSelectionError -from pyanaconda.modules.payloads.payload.dnf.utils import get_installation_specs, \ - get_kernel_package +from pyanaconda.modules.payloads.payload.dnf.dnf_manager import ( + BrokenSpecsError, + InvalidSelectionError, + MissingSpecsError, +) +from pyanaconda.modules.payloads.payload.dnf.utils import ( + get_installation_specs, + get_kernel_package, +) log = get_module_logger(__name__) diff --git a/pyanaconda/modules/payloads/payload/factory.py b/pyanaconda/modules/payloads/payload/factory.py index 00c69e0e2b5..dc85be577ad 100644 --- a/pyanaconda/modules/payloads/payload/factory.py +++ b/pyanaconda/modules/payloads/payload/factory.py @@ -33,8 +33,9 @@ def create_payload(payload_type: PayloadType): :return: a payload module """ if payload_type == PayloadType.LIVE_IMAGE: - from pyanaconda.modules.payloads.payload.live_image.live_image import \ - LiveImageModule + from pyanaconda.modules.payloads.payload.live_image.live_image import ( + LiveImageModule, + ) return LiveImageModule() if payload_type == PayloadType.LIVE_OS: @@ -46,7 +47,9 @@ def create_payload(payload_type: PayloadType): return DNFModule() if payload_type == PayloadType.RPM_OSTREE: - from pyanaconda.modules.payloads.payload.rpm_ostree.rpm_ostree import RPMOSTreeModule + from pyanaconda.modules.payloads.payload.rpm_ostree.rpm_ostree import ( + RPMOSTreeModule, + ) return RPMOSTreeModule() raise ValueError("Unknown payload type: {}".format(payload_type)) diff --git a/pyanaconda/modules/payloads/payload/live_image/installation.py b/pyanaconda/modules/payloads/payload/live_image/installation.py index c027e5b524b..676e2448c77 100644 --- a/pyanaconda/modules/payloads/payload/live_image/installation.py +++ b/pyanaconda/modules/payloads/payload/live_image/installation.py @@ -19,21 +19,25 @@ import hashlib import os import stat -import requests + import blivet.util +import requests from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.constants import NETWORK_CONNECTION_TIMEOUT from pyanaconda.core.i18n import _ -from pyanaconda.core.util import execWithRedirect, execReadlines, requests_session from pyanaconda.core.path import join_paths from pyanaconda.core.string import lower_ascii +from pyanaconda.core.util import execReadlines, execWithRedirect, requests_session +from pyanaconda.modules.common.errors.installation import PayloadInstallationError from pyanaconda.modules.common.structures.live_image import LiveImageConfigurationData from pyanaconda.modules.common.task import Task -from pyanaconda.modules.common.errors.installation import PayloadInstallationError -from pyanaconda.modules.payloads.payload.live_image.download_progress import DownloadProgress -from pyanaconda.modules.payloads.payload.live_image.installation_progress import \ - InstallationProgress +from pyanaconda.modules.payloads.payload.live_image.download_progress import ( + DownloadProgress, +) +from pyanaconda.modules.payloads.payload.live_image.installation_progress import ( + InstallationProgress, +) from pyanaconda.modules.payloads.payload.live_image.utils import get_proxies_from_option log = get_module_logger(__name__) diff --git a/pyanaconda/modules/payloads/payload/live_image/installation_progress.py b/pyanaconda/modules/payloads/payload/live_image/installation_progress.py index 22dce6f5dbe..d190c727129 100644 --- a/pyanaconda/modules/payloads/payload/live_image/installation_progress.py +++ b/pyanaconda/modules/payloads/payload/live_image/installation_progress.py @@ -24,11 +24,11 @@ from pyanaconda.core.constants import THREAD_LIVE_PROGRESS from pyanaconda.core.i18n import _ from pyanaconda.core.path import join_paths +from pyanaconda.core.threads import thread_manager from pyanaconda.modules.common.constants.objects import DEVICE_TREE from pyanaconda.modules.common.constants.services import STORAGE from pyanaconda.modules.common.structures.storage import DeviceData from pyanaconda.modules.common.task.cancellable import Cancellable -from pyanaconda.core.threads import thread_manager log = get_module_logger(__name__) diff --git a/pyanaconda/modules/payloads/payload/live_image/live_image.py b/pyanaconda/modules/payloads/payload/live_image/live_image.py index 058dd1b2e06..88cb323063c 100644 --- a/pyanaconda/modules/payloads/payload/live_image/live_image.py +++ b/pyanaconda/modules/payloads/payload/live_image/live_image.py @@ -20,9 +20,10 @@ from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.modules.common.errors.payload import IncompatibleSourceError from pyanaconda.modules.payloads.constants import PayloadType, SourceType +from pyanaconda.modules.payloads.payload.live_image.live_image_interface import ( + LiveImageInterface, +) from pyanaconda.modules.payloads.payload.payload_base import PayloadBase -from pyanaconda.modules.payloads.payload.live_image.live_image_interface import \ - LiveImageInterface from pyanaconda.modules.payloads.source.factory import SourceFactory log = get_module_logger(__name__) diff --git a/pyanaconda/modules/payloads/payload/live_image/live_image_interface.py b/pyanaconda/modules/payloads/payload/live_image/live_image_interface.py index 3258c74ff75..195ef4f246f 100644 --- a/pyanaconda/modules/payloads/payload/live_image/live_image_interface.py +++ b/pyanaconda/modules/payloads/payload/live_image/live_image_interface.py @@ -20,7 +20,9 @@ from dasbus.server.interface import dbus_interface from pyanaconda.modules.common.constants.interfaces import PAYLOAD_LIVE_IMAGE -from pyanaconda.modules.payloads.payload.payload_base_interface import PayloadBaseInterface +from pyanaconda.modules.payloads.payload.payload_base_interface import ( + PayloadBaseInterface, +) __all__ = ["LiveImageInterface"] diff --git a/pyanaconda/modules/payloads/payload/live_os/live_os.py b/pyanaconda/modules/payloads/payload/live_os/live_os.py index 6e7b969f977..689713b3803 100644 --- a/pyanaconda/modules/payloads/payload/live_os/live_os.py +++ b/pyanaconda/modules/payloads/payload/live_os/live_os.py @@ -17,17 +17,22 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.configuration.anaconda import conf from pyanaconda.modules.common.errors.payload import IncompatibleSourceError -from pyanaconda.modules.payloads.constants import SourceType, PayloadType -from pyanaconda.modules.payloads.payload.live_image.installation import InstallFromImageTask -from pyanaconda.modules.payloads.payload.live_os.installation import \ - CopyTransientGnomeInitialSetupStateTask +from pyanaconda.modules.payloads.constants import PayloadType, SourceType +from pyanaconda.modules.payloads.payload.live_image.installation import ( + InstallFromImageTask, +) +from pyanaconda.modules.payloads.payload.live_os.installation import ( + CopyTransientGnomeInitialSetupStateTask, +) +from pyanaconda.modules.payloads.payload.live_os.live_os_interface import ( + LiveOSInterface, +) from pyanaconda.modules.payloads.payload.live_os.utils import get_kernel_version_list from pyanaconda.modules.payloads.payload.payload_base import PayloadBase -from pyanaconda.modules.payloads.payload.live_os.live_os_interface import LiveOSInterface -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) diff --git a/pyanaconda/modules/payloads/payload/live_os/live_os_interface.py b/pyanaconda/modules/payloads/payload/live_os/live_os_interface.py index 1c1ef4f58bb..6d8f5cc88ae 100644 --- a/pyanaconda/modules/payloads/payload/live_os/live_os_interface.py +++ b/pyanaconda/modules/payloads/payload/live_os/live_os_interface.py @@ -20,7 +20,9 @@ from dasbus.server.interface import dbus_interface from pyanaconda.modules.common.constants.interfaces import PAYLOAD_LIVE_OS -from pyanaconda.modules.payloads.payload.payload_base_interface import PayloadBaseInterface +from pyanaconda.modules.payloads.payload.payload_base_interface import ( + PayloadBaseInterface, +) @dbus_interface(PAYLOAD_LIVE_OS.interface_name) diff --git a/pyanaconda/modules/payloads/payload/payload_base.py b/pyanaconda/modules/payloads/payload/payload_base.py index 6a12c1cb680..a6066c5408a 100644 --- a/pyanaconda/modules/payloads/payload/payload_base.py +++ b/pyanaconda/modules/payloads/payload/payload_base.py @@ -21,14 +21,20 @@ from dasbus.server.publishable import Publishable +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.signal import Signal -from pyanaconda.modules.common.errors.general import UnavailableValueError -from pyanaconda.modules.common.errors.payload import IncompatibleSourceError, SourceSetupError from pyanaconda.modules.common.base import KickstartBaseModule -from pyanaconda.modules.payloads.base.initialization import SetUpSourcesTask, TearDownSourcesTask +from pyanaconda.modules.common.errors.general import UnavailableValueError +from pyanaconda.modules.common.errors.payload import ( + IncompatibleSourceError, + SourceSetupError, +) +from pyanaconda.modules.payloads.base.initialization import ( + SetUpSourcesTask, + TearDownSourcesTask, +) from pyanaconda.modules.payloads.constants import SourceState -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) diff --git a/pyanaconda/modules/payloads/payload/payload_base_interface.py b/pyanaconda/modules/payloads/payload/payload_base_interface.py index 805c725fd06..bf45b996ae4 100644 --- a/pyanaconda/modules/payloads/payload/payload_base_interface.py +++ b/pyanaconda/modules/payloads/payload/payload_base_interface.py @@ -22,6 +22,7 @@ from dasbus.server.interface import dbus_interface from dasbus.server.property import emits_properties_changed from dasbus.typing import * # pylint: disable=wildcard-import + from pyanaconda.modules.common.base.base_template import ModuleInterfaceTemplate from pyanaconda.modules.common.constants.interfaces import PAYLOAD from pyanaconda.modules.common.containers import PayloadSourceContainer, TaskContainer diff --git a/pyanaconda/modules/payloads/payload/rpm_ostree/flatpak_installation.py b/pyanaconda/modules/payloads/payload/rpm_ostree/flatpak_installation.py index a87b77c1822..7ae84128ee4 100644 --- a/pyanaconda/modules/payloads/payload/rpm_ostree/flatpak_installation.py +++ b/pyanaconda/modules/payloads/payload/rpm_ostree/flatpak_installation.py @@ -18,7 +18,9 @@ from pyanaconda.core.configuration.anaconda import conf from pyanaconda.core.i18n import _ from pyanaconda.modules.common.task import Task -from pyanaconda.modules.payloads.payload.rpm_ostree.flatpak_manager import FlatpakManager +from pyanaconda.modules.payloads.payload.rpm_ostree.flatpak_manager import ( + FlatpakManager, +) __all__ = ["InstallFlatpaksTask"] diff --git a/pyanaconda/modules/payloads/payload/rpm_ostree/flatpak_manager.py b/pyanaconda/modules/payloads/payload/rpm_ostree/flatpak_manager.py index 8b10182d574..0d74f41fe1c 100644 --- a/pyanaconda/modules/payloads/payload/rpm_ostree/flatpak_manager.py +++ b/pyanaconda/modules/payloads/payload/rpm_ostree/flatpak_manager.py @@ -19,19 +19,24 @@ # import os import shutil -import gi - from abc import ABC, abstractmethod +import gi + from pyanaconda.anaconda_loggers import get_module_logger +from pyanaconda.core.glib import Bytes, GError, Variant, VariantType from pyanaconda.core.i18n import _ -from pyanaconda.core.glib import GError, VariantType, Variant, Bytes from pyanaconda.modules.common.errors.installation import PayloadInstallationError gi.require_version("Flatpak", "1.0") gi.require_version("Gio", "2.0") -from gi.repository.Flatpak import Transaction, Installation, Remote, TransactionOperationType +from gi.repository.Flatpak import ( + Installation, + Remote, + Transaction, + TransactionOperationType, +) from gi.repository.Gio import File log = get_module_logger(__name__) diff --git a/pyanaconda/modules/payloads/payload/rpm_ostree/installation.py b/pyanaconda/modules/payloads/payload/rpm_ostree/installation.py index 5d5af8faf9d..083f1187db9 100644 --- a/pyanaconda/modules/payloads/payload/rpm_ostree/installation.py +++ b/pyanaconda/modules/payloads/payload/rpm_ostree/installation.py @@ -16,29 +16,31 @@ # Red Hat, Inc. # import os -import blivet.util - from subprocess import CalledProcessError +import blivet.util +import gi + from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.configuration.anaconda import conf -from pyanaconda.core.glib import format_size_full, create_new_context, Variant, GError +from pyanaconda.core.glib import GError, Variant, create_new_context, format_size_full from pyanaconda.core.i18n import _ -from pyanaconda.core.path import set_system_root, make_directories +from pyanaconda.core.path import make_directories, set_system_root from pyanaconda.core.util import execWithRedirect -from pyanaconda.modules.common.errors.installation import PayloadInstallationError, \ - BootloaderInstallationError -from pyanaconda.modules.common.task import Task -from pyanaconda.modules.common.constants.objects import DEVICE_TREE, BOOTLOADER -from pyanaconda.modules.common.constants.services import STORAGE, LOCALIZATION +from pyanaconda.modules.common.constants.objects import BOOTLOADER, DEVICE_TREE +from pyanaconda.modules.common.constants.services import LOCALIZATION, STORAGE +from pyanaconda.modules.common.errors.installation import ( + BootloaderInstallationError, + PayloadInstallationError, +) from pyanaconda.modules.common.structures.storage import DeviceData +from pyanaconda.modules.common.task import Task from pyanaconda.modules.payloads.payload.rpm_ostree.util import have_bootupd -import gi gi.require_version("OSTree", "1.0") gi.require_version("Gio", "2.0") gi.require_version("RpmOstree", "1.0") -from gi.repository import RpmOstree, OSTree, Gio +from gi.repository import Gio, OSTree, RpmOstree log = get_module_logger(__name__) diff --git a/pyanaconda/modules/payloads/payload/rpm_ostree/rpm_ostree.py b/pyanaconda/modules/payloads/payload/rpm_ostree/rpm_ostree.py index e7975c4166c..1c2b9c890c7 100644 --- a/pyanaconda/modules/payloads/payload/rpm_ostree/rpm_ostree.py +++ b/pyanaconda/modules/payloads/payload/rpm_ostree/rpm_ostree.py @@ -21,12 +21,23 @@ from pyanaconda.core.configuration.anaconda import conf from pyanaconda.modules.payloads.constants import PayloadType, SourceType from pyanaconda.modules.payloads.payload.payload_base import PayloadBase -from pyanaconda.modules.payloads.payload.rpm_ostree.flatpak_installation import InstallFlatpaksTask -from pyanaconda.modules.payloads.payload.rpm_ostree.installation import InitOSTreeFsAndRepoTask, \ - ChangeOSTreeRemoteTask, PullRemoteAndDeleteTask, DeployOSTreeTask, SetSystemRootTask, \ - CopyBootloaderDataTask, PrepareOSTreeMountTargetsTask, ConfigureBootloader, \ - TearDownOSTreeMountTargetsTask -from pyanaconda.modules.payloads.payload.rpm_ostree.rpm_ostree_interface import RPMOSTreeInterface +from pyanaconda.modules.payloads.payload.rpm_ostree.flatpak_installation import ( + InstallFlatpaksTask, +) +from pyanaconda.modules.payloads.payload.rpm_ostree.installation import ( + ChangeOSTreeRemoteTask, + ConfigureBootloader, + CopyBootloaderDataTask, + DeployOSTreeTask, + InitOSTreeFsAndRepoTask, + PrepareOSTreeMountTargetsTask, + PullRemoteAndDeleteTask, + SetSystemRootTask, + TearDownOSTreeMountTargetsTask, +) +from pyanaconda.modules.payloads.payload.rpm_ostree.rpm_ostree_interface import ( + RPMOSTreeInterface, +) from pyanaconda.modules.payloads.source.factory import SourceFactory log = get_module_logger(__name__) diff --git a/pyanaconda/modules/payloads/payload/rpm_ostree/rpm_ostree_interface.py b/pyanaconda/modules/payloads/payload/rpm_ostree/rpm_ostree_interface.py index c2dd6fc73e6..b2290a8fb7a 100644 --- a/pyanaconda/modules/payloads/payload/rpm_ostree/rpm_ostree_interface.py +++ b/pyanaconda/modules/payloads/payload/rpm_ostree/rpm_ostree_interface.py @@ -20,7 +20,9 @@ from dasbus.server.interface import dbus_interface from pyanaconda.modules.common.constants.interfaces import PAYLOAD_RPM_OSTREE -from pyanaconda.modules.payloads.payload.payload_base_interface import PayloadBaseInterface +from pyanaconda.modules.payloads.payload.payload_base_interface import ( + PayloadBaseInterface, +) @dbus_interface(PAYLOAD_RPM_OSTREE.interface_name) diff --git a/pyanaconda/modules/payloads/payload/rpm_ostree/util.py b/pyanaconda/modules/payloads/payload/rpm_ostree/util.py index d604dcd0ff9..6a9b02b7142 100644 --- a/pyanaconda/modules/payloads/payload/rpm_ostree/util.py +++ b/pyanaconda/modules/payloads/payload/rpm_ostree/util.py @@ -17,6 +17,7 @@ # import os.path + from pyanaconda.core.path import join_paths __all__ = ["have_bootupd"] diff --git a/pyanaconda/modules/payloads/payloads.py b/pyanaconda/modules/payloads/payloads.py index 8060fdee161..71f73fb19f8 100644 --- a/pyanaconda/modules/payloads/payloads.py +++ b/pyanaconda/modules/payloads/payloads.py @@ -24,8 +24,10 @@ from pyanaconda.modules.common.base import KickstartService from pyanaconda.modules.common.constants.services import PAYLOADS from pyanaconda.modules.common.containers import TaskContainer -from pyanaconda.modules.payloads.installation import PrepareSystemForInstallationTask, \ - CopyDriverDisksFilesTask +from pyanaconda.modules.payloads.installation import ( + CopyDriverDisksFilesTask, + PrepareSystemForInstallationTask, +) from pyanaconda.modules.payloads.kickstart import PayloadKickstartSpecification from pyanaconda.modules.payloads.payload.factory import PayloadFactory from pyanaconda.modules.payloads.payloads_interface import PayloadsInterface diff --git a/pyanaconda/modules/payloads/payloads_interface.py b/pyanaconda/modules/payloads/payloads_interface.py index 7fe18bc8634..638bdd3a7a5 100644 --- a/pyanaconda/modules/payloads/payloads_interface.py +++ b/pyanaconda/modules/payloads/payloads_interface.py @@ -22,9 +22,12 @@ from dasbus.typing import * # pylint: disable=wildcard-import from pyanaconda.modules.common.base import KickstartModuleInterface -from pyanaconda.modules.common.containers import PayloadSourceContainer, PayloadContainer, \ - TaskContainer from pyanaconda.modules.common.constants.services import PAYLOADS +from pyanaconda.modules.common.containers import ( + PayloadContainer, + PayloadSourceContainer, + TaskContainer, +) from pyanaconda.modules.payloads.constants import PayloadType, SourceType diff --git a/pyanaconda/modules/payloads/source/cdn/cdn.py b/pyanaconda/modules/payloads/source/cdn/cdn.py index 2546b6f68d2..3e58a03ad3c 100644 --- a/pyanaconda/modules/payloads/source/cdn/cdn.py +++ b/pyanaconda/modules/payloads/source/cdn/cdn.py @@ -17,12 +17,14 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.i18n import _ from pyanaconda.modules.payloads.constants import SourceType -from pyanaconda.modules.payloads.source.cdn.initialization import SetUpCDNSourceTask -from pyanaconda.modules.payloads.source.repo_files.repo_files import RepoFilesSourceModule from pyanaconda.modules.payloads.source.cdn.cdn_interface import CDNSourceInterface -from pyanaconda.anaconda_loggers import get_module_logger +from pyanaconda.modules.payloads.source.cdn.initialization import SetUpCDNSourceTask +from pyanaconda.modules.payloads.source.repo_files.repo_files import ( + RepoFilesSourceModule, +) log = get_module_logger(__name__) diff --git a/pyanaconda/modules/payloads/source/cdn/cdn_interface.py b/pyanaconda/modules/payloads/source/cdn/cdn_interface.py index 037b27e78a4..59c40d445fe 100644 --- a/pyanaconda/modules/payloads/source/cdn/cdn_interface.py +++ b/pyanaconda/modules/payloads/source/cdn/cdn_interface.py @@ -18,8 +18,11 @@ # Red Hat, Inc. # from dasbus.server.interface import dbus_interface + from pyanaconda.modules.common.constants.interfaces import PAYLOAD_SOURCE_CDN -from pyanaconda.modules.payloads.source.source_base_interface import PayloadSourceBaseInterface +from pyanaconda.modules.payloads.source.source_base_interface import ( + PayloadSourceBaseInterface, +) @dbus_interface(PAYLOAD_SOURCE_CDN.interface_name) diff --git a/pyanaconda/modules/payloads/source/cdrom/cdrom.py b/pyanaconda/modules/payloads/source/cdrom/cdrom.py index de9858618a9..0c8bda606ed 100644 --- a/pyanaconda/modules/payloads/source/cdrom/cdrom.py +++ b/pyanaconda/modules/payloads/source/cdrom/cdrom.py @@ -17,17 +17,22 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.i18n import _ from pyanaconda.core.signal import Signal from pyanaconda.modules.common.structures.payload import RepoConfigurationData -from pyanaconda.modules.payloads.constants import SourceType, SourceState -from pyanaconda.modules.payloads.source.mount_tasks import TearDownMountTask -from pyanaconda.modules.payloads.source.source_base import PayloadSourceBase, \ - MountingSourceMixin, RPMSourceMixin -from pyanaconda.modules.payloads.source.cdrom.cdrom_interface import CdromSourceInterface +from pyanaconda.modules.payloads.constants import SourceState, SourceType +from pyanaconda.modules.payloads.source.cdrom.cdrom_interface import ( + CdromSourceInterface, +) from pyanaconda.modules.payloads.source.cdrom.initialization import SetUpCdromSourceTask +from pyanaconda.modules.payloads.source.mount_tasks import TearDownMountTask +from pyanaconda.modules.payloads.source.source_base import ( + MountingSourceMixin, + PayloadSourceBase, + RPMSourceMixin, +) -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) diff --git a/pyanaconda/modules/payloads/source/cdrom/cdrom_interface.py b/pyanaconda/modules/payloads/source/cdrom/cdrom_interface.py index 2353b2a7cc9..4cf70fcc560 100644 --- a/pyanaconda/modules/payloads/source/cdrom/cdrom_interface.py +++ b/pyanaconda/modules/payloads/source/cdrom/cdrom_interface.py @@ -19,8 +19,11 @@ # from dasbus.server.interface import dbus_interface from dasbus.typing import * # pylint: disable=wildcard-import + from pyanaconda.modules.common.constants.interfaces import PAYLOAD_SOURCE_CDROM -from pyanaconda.modules.payloads.source.source_base_interface import PayloadSourceBaseInterface +from pyanaconda.modules.payloads.source.source_base_interface import ( + PayloadSourceBaseInterface, +) @dbus_interface(PAYLOAD_SOURCE_CDROM.interface_name) diff --git a/pyanaconda/modules/payloads/source/cdrom/initialization.py b/pyanaconda/modules/payloads/source/cdrom/initialization.py index f5ce3c262ed..503f4a68fd9 100644 --- a/pyanaconda/modules/payloads/source/cdrom/initialization.py +++ b/pyanaconda/modules/payloads/source/cdrom/initialization.py @@ -15,6 +15,7 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.modules.common.constants.objects import DEVICE_TREE from pyanaconda.modules.common.constants.services import STORAGE from pyanaconda.modules.common.errors.payload import SourceSetupError @@ -23,7 +24,6 @@ from pyanaconda.modules.payloads.source.utils import is_valid_install_disk from pyanaconda.payload.utils import mount, unmount -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) __all__ = ["SetUpCdromSourceTask"] diff --git a/pyanaconda/modules/payloads/source/closest_mirror/closest_mirror.py b/pyanaconda/modules/payloads/source/closest_mirror/closest_mirror.py index 61341511af4..60329051427 100644 --- a/pyanaconda/modules/payloads/source/closest_mirror/closest_mirror.py +++ b/pyanaconda/modules/payloads/source/closest_mirror/closest_mirror.py @@ -17,13 +17,16 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.i18n import _ from pyanaconda.core.signal import Signal from pyanaconda.modules.payloads.constants import SourceType -from pyanaconda.modules.payloads.source.closest_mirror.closest_mirror_interface import \ - ClosestMirrorSourceInterface -from pyanaconda.modules.payloads.source.repo_files.repo_files import RepoFilesSourceModule -from pyanaconda.anaconda_loggers import get_module_logger +from pyanaconda.modules.payloads.source.closest_mirror.closest_mirror_interface import ( + ClosestMirrorSourceInterface, +) +from pyanaconda.modules.payloads.source.repo_files.repo_files import ( + RepoFilesSourceModule, +) log = get_module_logger(__name__) diff --git a/pyanaconda/modules/payloads/source/closest_mirror/closest_mirror_interface.py b/pyanaconda/modules/payloads/source/closest_mirror/closest_mirror_interface.py index 6bdca9c3c22..a2881327a63 100644 --- a/pyanaconda/modules/payloads/source/closest_mirror/closest_mirror_interface.py +++ b/pyanaconda/modules/payloads/source/closest_mirror/closest_mirror_interface.py @@ -22,7 +22,9 @@ from dasbus.typing import Bool from pyanaconda.modules.common.constants.interfaces import PAYLOAD_SOURCE_CLOSEST_MIRROR -from pyanaconda.modules.payloads.source.source_base_interface import PayloadSourceBaseInterface +from pyanaconda.modules.payloads.source.source_base_interface import ( + PayloadSourceBaseInterface, +) __all__ = ["ClosestMirrorSourceInterface"] diff --git a/pyanaconda/modules/payloads/source/factory.py b/pyanaconda/modules/payloads/source/factory.py index 1e70753edfc..8ca0897391d 100644 --- a/pyanaconda/modules/payloads/source/factory.py +++ b/pyanaconda/modules/payloads/source/factory.py @@ -34,14 +34,19 @@ def create_source(source_type: SourceType): :return: a source module """ if source_type == SourceType.LIVE_OS_IMAGE: - from pyanaconda.modules.payloads.source.live_os.live_os import LiveOSSourceModule + from pyanaconda.modules.payloads.source.live_os.live_os import ( + LiveOSSourceModule, + ) return LiveOSSourceModule() elif source_type == SourceType.LIVE_IMAGE: - from pyanaconda.modules.payloads.source.live_image.live_image import \ - LiveImageSourceModule + from pyanaconda.modules.payloads.source.live_image.live_image import ( + LiveImageSourceModule, + ) return LiveImageSourceModule() elif source_type == SourceType.LIVE_TAR: - from pyanaconda.modules.payloads.source.live_tar.live_tar import LiveTarSourceModule + from pyanaconda.modules.payloads.source.live_tar.live_tar import ( + LiveTarSourceModule, + ) return LiveTarSourceModule() elif source_type == SourceType.CDROM: from pyanaconda.modules.payloads.source.cdrom.cdrom import CdromSourceModule @@ -50,12 +55,14 @@ def create_source(source_type: SourceType): from pyanaconda.modules.payloads.source.hmc.hmc import HMCSourceModule return HMCSourceModule() elif source_type == SourceType.REPO_FILES: - from pyanaconda.modules.payloads.source.repo_files.repo_files import \ - RepoFilesSourceModule + from pyanaconda.modules.payloads.source.repo_files.repo_files import ( + RepoFilesSourceModule, + ) return RepoFilesSourceModule() elif source_type == SourceType.REPO_PATH: - from pyanaconda.modules.payloads.source.repo_path.repo_path import \ - RepoPathSourceModule + from pyanaconda.modules.payloads.source.repo_path.repo_path import ( + RepoPathSourceModule, + ) return RepoPathSourceModule() elif source_type == SourceType.NFS: from pyanaconda.modules.payloads.source.nfs.nfs import NFSSourceModule @@ -64,27 +71,32 @@ def create_source(source_type: SourceType): from pyanaconda.modules.payloads.source.url.url import URLSourceModule return URLSourceModule() elif source_type == SourceType.HDD: - from pyanaconda.modules.payloads.source.harddrive.harddrive import \ - HardDriveSourceModule + from pyanaconda.modules.payloads.source.harddrive.harddrive import ( + HardDriveSourceModule, + ) return HardDriveSourceModule() elif source_type == SourceType.CDN: from pyanaconda.modules.payloads.source.cdn.cdn import CDNSourceModule return CDNSourceModule() elif source_type == SourceType.CLOSEST_MIRROR: - from pyanaconda.modules.payloads.source.closest_mirror.closest_mirror import \ - ClosestMirrorSourceModule + from pyanaconda.modules.payloads.source.closest_mirror.closest_mirror import ( + ClosestMirrorSourceModule, + ) return ClosestMirrorSourceModule() elif source_type == SourceType.RPM_OSTREE: - from pyanaconda.modules.payloads.source.rpm_ostree.rpm_ostree import \ - RPMOSTreeSourceModule + from pyanaconda.modules.payloads.source.rpm_ostree.rpm_ostree import ( + RPMOSTreeSourceModule, + ) return RPMOSTreeSourceModule() elif source_type == SourceType.RPM_OSTREE_CONTAINER: - from pyanaconda.modules.payloads.source.rpm_ostree_container.rpm_ostree_container import \ - RPMOSTreeContainerSourceModule + from pyanaconda.modules.payloads.source.rpm_ostree_container.rpm_ostree_container import ( + RPMOSTreeContainerSourceModule, + ) return RPMOSTreeContainerSourceModule() elif source_type == SourceType.FLATPAK: - from pyanaconda.modules.payloads.source.flatpak.flatpak import \ - FlatpakSourceModule + from pyanaconda.modules.payloads.source.flatpak.flatpak import ( + FlatpakSourceModule, + ) return FlatpakSourceModule() raise ValueError("Unknown source type: {}".format(source_type)) diff --git a/pyanaconda/modules/payloads/source/flatpak/flatpak.py b/pyanaconda/modules/payloads/source/flatpak/flatpak.py index 18e48e07d38..affb8bde534 100644 --- a/pyanaconda/modules/payloads/source/flatpak/flatpak.py +++ b/pyanaconda/modules/payloads/source/flatpak/flatpak.py @@ -20,11 +20,17 @@ from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.configuration.anaconda import conf from pyanaconda.core.i18n import _ -from pyanaconda.modules.payloads.constants import SourceType, SourceState -from pyanaconda.modules.payloads.source.flatpak.flatpak_interface import FlatpakSourceInterface -from pyanaconda.modules.payloads.source.flatpak.initialization import GetFlatpaksSizeTask +from pyanaconda.modules.payloads.constants import SourceState, SourceType +from pyanaconda.modules.payloads.payload.rpm_ostree.flatpak_manager import ( + FlatpakManager, +) +from pyanaconda.modules.payloads.source.flatpak.flatpak_interface import ( + FlatpakSourceInterface, +) +from pyanaconda.modules.payloads.source.flatpak.initialization import ( + GetFlatpaksSizeTask, +) from pyanaconda.modules.payloads.source.source_base import PayloadSourceBase -from pyanaconda.modules.payloads.payload.rpm_ostree.flatpak_manager import FlatpakManager log = get_module_logger(__name__) diff --git a/pyanaconda/modules/payloads/source/flatpak/flatpak_interface.py b/pyanaconda/modules/payloads/source/flatpak/flatpak_interface.py index 7f56e41e7b5..583c65c3ad3 100644 --- a/pyanaconda/modules/payloads/source/flatpak/flatpak_interface.py +++ b/pyanaconda/modules/payloads/source/flatpak/flatpak_interface.py @@ -21,7 +21,9 @@ from dasbus.typing import * # pylint: disable=wildcard-import from pyanaconda.modules.common.constants.interfaces import PAYLOAD_SOURCE_FLATPAK -from pyanaconda.modules.payloads.source.source_base_interface import PayloadSourceBaseInterface +from pyanaconda.modules.payloads.source.source_base_interface import ( + PayloadSourceBaseInterface, +) __all__ = ["FlatpakSourceInterface"] diff --git a/pyanaconda/modules/payloads/source/flatpak/initialization.py b/pyanaconda/modules/payloads/source/flatpak/initialization.py index 9cfb473f217..5121b947090 100644 --- a/pyanaconda/modules/payloads/source/flatpak/initialization.py +++ b/pyanaconda/modules/payloads/source/flatpak/initialization.py @@ -18,7 +18,9 @@ from blivet.size import Size from pyanaconda.modules.common.task import Task -from pyanaconda.modules.payloads.payload.rpm_ostree.flatpak_manager import FlatpakManager +from pyanaconda.modules.payloads.payload.rpm_ostree.flatpak_manager import ( + FlatpakManager, +) __all__ = ["GetFlatpaksSizeTask"] diff --git a/pyanaconda/modules/payloads/source/harddrive/harddrive.py b/pyanaconda/modules/payloads/source/harddrive/harddrive.py index d8e18b0ed2a..28a2d5a67f7 100644 --- a/pyanaconda/modules/payloads/source/harddrive/harddrive.py +++ b/pyanaconda/modules/payloads/source/harddrive/harddrive.py @@ -21,18 +21,24 @@ from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.constants import URL_TYPE_BASEURL -from pyanaconda.core.payload import parse_hdd_url, create_hdd_url +from pyanaconda.core.payload import create_hdd_url, parse_hdd_url from pyanaconda.core.storage import device_matches from pyanaconda.modules.common.errors.general import InvalidValueError from pyanaconda.modules.common.structures.payload import RepoConfigurationData -from pyanaconda.modules.payloads.constants import SourceType, SourceState -from pyanaconda.modules.payloads.source.harddrive.harddrive_interface import \ - HardDriveSourceInterface -from pyanaconda.modules.payloads.source.harddrive.initialization import SetUpHardDriveSourceTask, \ - SetupHardDriveResult +from pyanaconda.modules.payloads.constants import SourceState, SourceType +from pyanaconda.modules.payloads.source.harddrive.harddrive_interface import ( + HardDriveSourceInterface, +) +from pyanaconda.modules.payloads.source.harddrive.initialization import ( + SetupHardDriveResult, + SetUpHardDriveSourceTask, +) from pyanaconda.modules.payloads.source.mount_tasks import TearDownMountTask -from pyanaconda.modules.payloads.source.source_base import PayloadSourceBase, RPMSourceMixin, \ - RepositorySourceMixin +from pyanaconda.modules.payloads.source.source_base import ( + PayloadSourceBase, + RepositorySourceMixin, + RPMSourceMixin, +) from pyanaconda.modules.payloads.source.utils import MountPointGenerator log = get_module_logger(__name__) diff --git a/pyanaconda/modules/payloads/source/harddrive/harddrive_interface.py b/pyanaconda/modules/payloads/source/harddrive/harddrive_interface.py index 08205dedb8b..e247dd4b8d6 100644 --- a/pyanaconda/modules/payloads/source/harddrive/harddrive_interface.py +++ b/pyanaconda/modules/payloads/source/harddrive/harddrive_interface.py @@ -19,8 +19,11 @@ # from dasbus.server.interface import dbus_interface from dasbus.typing import * # pylint: disable=wildcard-import + from pyanaconda.modules.common.constants.interfaces import PAYLOAD_SOURCE_HARDDRIVE -from pyanaconda.modules.payloads.source.source_base_interface import RepositorySourceInterface +from pyanaconda.modules.payloads.source.source_base_interface import ( + RepositorySourceInterface, +) __all__ = ["HardDriveSourceInterface"] diff --git a/pyanaconda/modules/payloads/source/harddrive/initialization.py b/pyanaconda/modules/payloads/source/harddrive/initialization.py index 114e8bbd789..3894ff45033 100644 --- a/pyanaconda/modules/payloads/source/harddrive/initialization.py +++ b/pyanaconda/modules/payloads/source/harddrive/initialization.py @@ -17,17 +17,19 @@ # import copy import os.path - from collections import namedtuple +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.path import join_paths from pyanaconda.core.payload import parse_hdd_url from pyanaconda.modules.common.errors.payload import SourceSetupError from pyanaconda.modules.common.task import Task -from pyanaconda.modules.payloads.source.utils import find_and_mount_device, \ - find_and_mount_iso_image, verify_valid_repository +from pyanaconda.modules.payloads.source.utils import ( + find_and_mount_device, + find_and_mount_iso_image, + verify_valid_repository, +) from pyanaconda.payload.utils import unmount -from pyanaconda.anaconda_loggers import get_module_logger __all__ = ["SetUpHardDriveSourceTask", "SetupHardDriveResult"] diff --git a/pyanaconda/modules/payloads/source/hmc/hmc.py b/pyanaconda/modules/payloads/source/hmc/hmc.py index 044f1f1e9c8..42af4ae7227 100644 --- a/pyanaconda/modules/payloads/source/hmc/hmc.py +++ b/pyanaconda/modules/payloads/source/hmc/hmc.py @@ -17,16 +17,19 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.i18n import _ from pyanaconda.modules.common.structures.payload import RepoConfigurationData -from pyanaconda.modules.payloads.constants import SourceType, SourceState +from pyanaconda.modules.payloads.constants import SourceState, SourceType from pyanaconda.modules.payloads.source.hmc.hmc_interface import HMCSourceInterface from pyanaconda.modules.payloads.source.hmc.initialization import SetUpHMCSourceTask from pyanaconda.modules.payloads.source.mount_tasks import TearDownMountTask -from pyanaconda.modules.payloads.source.source_base import PayloadSourceBase, \ - MountingSourceMixin, RPMSourceMixin +from pyanaconda.modules.payloads.source.source_base import ( + MountingSourceMixin, + PayloadSourceBase, + RPMSourceMixin, +) -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) __all__ = ["HMCSourceModule"] diff --git a/pyanaconda/modules/payloads/source/hmc/hmc_interface.py b/pyanaconda/modules/payloads/source/hmc/hmc_interface.py index 7790428e2a7..588a1bf4ab6 100644 --- a/pyanaconda/modules/payloads/source/hmc/hmc_interface.py +++ b/pyanaconda/modules/payloads/source/hmc/hmc_interface.py @@ -18,8 +18,11 @@ # Red Hat, Inc. # from dasbus.server.interface import dbus_interface + from pyanaconda.modules.common.constants.interfaces import PAYLOAD_SOURCE_HMC -from pyanaconda.modules.payloads.source.source_base_interface import PayloadSourceBaseInterface +from pyanaconda.modules.payloads.source.source_base_interface import ( + PayloadSourceBaseInterface, +) __all__ = ["HMCSourceInterface"] diff --git a/pyanaconda/modules/payloads/source/hmc/initialization.py b/pyanaconda/modules/payloads/source/hmc/initialization.py index 27c6b7941c7..b252544845f 100644 --- a/pyanaconda/modules/payloads/source/hmc/initialization.py +++ b/pyanaconda/modules/payloads/source/hmc/initialization.py @@ -16,8 +16,8 @@ # Red Hat, Inc. # from pyanaconda.anaconda_loggers import get_module_logger -from pyanaconda.core.util import execWithRedirect from pyanaconda.core.path import make_directories +from pyanaconda.core.util import execWithRedirect from pyanaconda.modules.common.errors.payload import SourceSetupError from pyanaconda.modules.payloads.source.mount_tasks import SetUpMountTask diff --git a/pyanaconda/modules/payloads/source/live_image/initialization.py b/pyanaconda/modules/payloads/source/live_image/initialization.py index ecb236e224a..0ca41f28ec6 100644 --- a/pyanaconda/modules/payloads/source/live_image/initialization.py +++ b/pyanaconda/modules/payloads/source/live_image/initialization.py @@ -17,6 +17,7 @@ # import os from collections import namedtuple + from requests import RequestException from pyanaconda.anaconda_loggers import get_module_logger @@ -25,8 +26,10 @@ from pyanaconda.modules.common.errors.payload import SourceSetupError from pyanaconda.modules.common.structures.live_image import LiveImageConfigurationData from pyanaconda.modules.common.task import Task -from pyanaconda.modules.payloads.payload.live_image.utils import get_proxies_from_option, \ - get_local_image_path_from_url +from pyanaconda.modules.payloads.payload.live_image.utils import ( + get_local_image_path_from_url, + get_proxies_from_option, +) log = get_module_logger(__name__) diff --git a/pyanaconda/modules/payloads/source/live_image/installation.py b/pyanaconda/modules/payloads/source/live_image/installation.py index 55a9468e354..ed8d263ae5f 100644 --- a/pyanaconda/modules/payloads/source/live_image/installation.py +++ b/pyanaconda/modules/payloads/source/live_image/installation.py @@ -15,13 +15,18 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from pyanaconda.modules.common.task import Task from pyanaconda.modules.common.structures.live_image import LiveImageConfigurationData +from pyanaconda.modules.common.task import Task +from pyanaconda.modules.payloads.payload.live_image.installation import ( + DownloadImageTask, + InstallFromImageTask, + MountImageTask, + RemoveImageTask, + VerifyImageChecksumTask, +) +from pyanaconda.modules.payloads.payload.live_os.utils import get_kernel_version_list from pyanaconda.modules.payloads.source.mount_tasks import TearDownMountTask from pyanaconda.modules.payloads.source.utils import MountPointGenerator -from pyanaconda.modules.payloads.payload.live_image.installation import DownloadImageTask, \ - VerifyImageChecksumTask, MountImageTask, InstallFromImageTask, RemoveImageTask -from pyanaconda.modules.payloads.payload.live_os.utils import get_kernel_version_list __all__ = ["InstallLiveImageTask"] diff --git a/pyanaconda/modules/payloads/source/live_image/live_image.py b/pyanaconda/modules/payloads/source/live_image/live_image.py index 7350d0e5eea..fe64be80fbd 100644 --- a/pyanaconda/modules/payloads/source/live_image/live_image.py +++ b/pyanaconda/modules/payloads/source/live_image/live_image.py @@ -22,14 +22,20 @@ from pyanaconda.core.i18n import _ from pyanaconda.core.signal import Signal from pyanaconda.modules.common.structures.live_image import LiveImageConfigurationData -from pyanaconda.modules.payloads.constants import SourceType, SourceState -from pyanaconda.modules.payloads.source.live_image.initialization import \ - SetUpLocalImageSourceTask, SetUpRemoteImageSourceTask, SetupImageResult -from pyanaconda.modules.payloads.source.live_image.installation import InstallLiveImageTask -from pyanaconda.modules.payloads.source.utils import has_network_protocol -from pyanaconda.modules.payloads.source.live_image.live_image_interface import \ - LiveImageSourceInterface +from pyanaconda.modules.payloads.constants import SourceState, SourceType +from pyanaconda.modules.payloads.source.live_image.initialization import ( + SetupImageResult, + SetUpLocalImageSourceTask, + SetUpRemoteImageSourceTask, +) +from pyanaconda.modules.payloads.source.live_image.installation import ( + InstallLiveImageTask, +) +from pyanaconda.modules.payloads.source.live_image.live_image_interface import ( + LiveImageSourceInterface, +) from pyanaconda.modules.payloads.source.source_base import PayloadSourceBase +from pyanaconda.modules.payloads.source.utils import has_network_protocol log = get_module_logger(__name__) diff --git a/pyanaconda/modules/payloads/source/live_image/live_image_interface.py b/pyanaconda/modules/payloads/source/live_image/live_image_interface.py index d0167abede0..220184fa7e7 100644 --- a/pyanaconda/modules/payloads/source/live_image/live_image_interface.py +++ b/pyanaconda/modules/payloads/source/live_image/live_image_interface.py @@ -23,7 +23,9 @@ from pyanaconda.modules.common.constants.interfaces import PAYLOAD_SOURCE_LIVE_IMAGE from pyanaconda.modules.common.structures.live_image import LiveImageConfigurationData -from pyanaconda.modules.payloads.source.source_base_interface import PayloadSourceBaseInterface +from pyanaconda.modules.payloads.source.source_base_interface import ( + PayloadSourceBaseInterface, +) __all__ = ["LiveImageSourceInterface"] diff --git a/pyanaconda/modules/payloads/source/live_os/initialization.py b/pyanaconda/modules/payloads/source/live_os/initialization.py index d3a1dde1699..3ecbb7951d1 100644 --- a/pyanaconda/modules/payloads/source/live_os/initialization.py +++ b/pyanaconda/modules/payloads/source/live_os/initialization.py @@ -17,17 +17,18 @@ # import os import stat -import blivet.util - from collections import namedtuple + +import blivet.util from blivet.size import Size + from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.util import execWithCapture -from pyanaconda.modules.common.task import Task from pyanaconda.modules.common.constants.objects import DEVICE_TREE from pyanaconda.modules.common.constants.services import STORAGE from pyanaconda.modules.common.errors.payload import SourceSetupError from pyanaconda.modules.common.structures.storage import DeviceData +from pyanaconda.modules.common.task import Task from pyanaconda.modules.payloads.source.mount_tasks import SetUpMountTask log = get_module_logger(__name__) diff --git a/pyanaconda/modules/payloads/source/live_os/live_os.py b/pyanaconda/modules/payloads/source/live_os/live_os.py index e87b8b34edc..245504fbfc1 100644 --- a/pyanaconda/modules/payloads/source/live_os/live_os.py +++ b/pyanaconda/modules/payloads/source/live_os/live_os.py @@ -17,16 +17,24 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.i18n import _ from pyanaconda.core.signal import Signal -from pyanaconda.modules.payloads.constants import SourceType, SourceState +from pyanaconda.modules.payloads.constants import SourceState, SourceType +from pyanaconda.modules.payloads.source.live_os.initialization import ( + DetectLiveOSImageTask, + SetupLiveOSResult, + SetUpLiveOSSourceTask, +) +from pyanaconda.modules.payloads.source.live_os.live_os_interface import ( + LiveOSSourceInterface, +) from pyanaconda.modules.payloads.source.mount_tasks import TearDownMountTask -from pyanaconda.modules.payloads.source.source_base import PayloadSourceBase, MountingSourceMixin -from pyanaconda.modules.payloads.source.live_os.live_os_interface import LiveOSSourceInterface -from pyanaconda.modules.payloads.source.live_os.initialization import SetUpLiveOSSourceTask, \ - SetupLiveOSResult, DetectLiveOSImageTask +from pyanaconda.modules.payloads.source.source_base import ( + MountingSourceMixin, + PayloadSourceBase, +) -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) diff --git a/pyanaconda/modules/payloads/source/live_os/live_os_interface.py b/pyanaconda/modules/payloads/source/live_os/live_os_interface.py index 8e7284a64ab..7c59cf8836c 100644 --- a/pyanaconda/modules/payloads/source/live_os/live_os_interface.py +++ b/pyanaconda/modules/payloads/source/live_os/live_os_interface.py @@ -18,11 +18,14 @@ # Red Hat, Inc. # from dasbus.server.interface import dbus_interface -from dasbus.typing import * # pylint: disable=wildcard-import from dasbus.server.property import emits_properties_changed +from dasbus.typing import * # pylint: disable=wildcard-import + from pyanaconda.modules.common.constants.interfaces import PAYLOAD_SOURCE_LIVE_OS from pyanaconda.modules.common.containers import TaskContainer -from pyanaconda.modules.payloads.source.source_base_interface import PayloadSourceBaseInterface +from pyanaconda.modules.payloads.source.source_base_interface import ( + PayloadSourceBaseInterface, +) @dbus_interface(PAYLOAD_SOURCE_LIVE_OS.interface_name) diff --git a/pyanaconda/modules/payloads/source/live_tar/installation.py b/pyanaconda/modules/payloads/source/live_tar/installation.py index f9923e9ed1c..18d2b6e93c7 100644 --- a/pyanaconda/modules/payloads/source/live_tar/installation.py +++ b/pyanaconda/modules/payloads/source/live_tar/installation.py @@ -15,11 +15,17 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from pyanaconda.modules.common.task import Task from pyanaconda.modules.common.structures.live_image import LiveImageConfigurationData -from pyanaconda.modules.payloads.payload.live_image.installation import DownloadImageTask, \ - VerifyImageChecksumTask, RemoveImageTask, InstallFromTarTask -from pyanaconda.modules.payloads.payload.live_image.utils import get_kernel_version_list_from_tar +from pyanaconda.modules.common.task import Task +from pyanaconda.modules.payloads.payload.live_image.installation import ( + DownloadImageTask, + InstallFromTarTask, + RemoveImageTask, + VerifyImageChecksumTask, +) +from pyanaconda.modules.payloads.payload.live_image.utils import ( + get_kernel_version_list_from_tar, +) __all__ = ["InstallLiveTarTask"] diff --git a/pyanaconda/modules/payloads/source/live_tar/live_tar.py b/pyanaconda/modules/payloads/source/live_tar/live_tar.py index 52cbb9ad2fd..27265962c20 100644 --- a/pyanaconda/modules/payloads/source/live_tar/live_tar.py +++ b/pyanaconda/modules/payloads/source/live_tar/live_tar.py @@ -21,7 +21,9 @@ from pyanaconda.core.configuration.anaconda import conf from pyanaconda.core.i18n import _ from pyanaconda.modules.payloads.constants import SourceType -from pyanaconda.modules.payloads.source.live_image.live_image import LiveImageSourceModule +from pyanaconda.modules.payloads.source.live_image.live_image import ( + LiveImageSourceModule, +) from pyanaconda.modules.payloads.source.live_tar.installation import InstallLiveTarTask log = get_module_logger(__name__) diff --git a/pyanaconda/modules/payloads/source/mount_tasks.py b/pyanaconda/modules/payloads/source/mount_tasks.py index 5987c23a0ee..3bc8b967b36 100644 --- a/pyanaconda/modules/payloads/source/mount_tasks.py +++ b/pyanaconda/modules/payloads/source/mount_tasks.py @@ -20,11 +20,13 @@ import os.path from abc import ABC, abstractmethod +from pyanaconda.anaconda_loggers import get_module_logger +from pyanaconda.modules.common.errors.payload import ( + SourceSetupError, + SourceTearDownError, +) from pyanaconda.modules.common.task import Task -from pyanaconda.modules.common.errors.payload import SourceSetupError, SourceTearDownError - from pyanaconda.payload.utils import unmount -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) diff --git a/pyanaconda/modules/payloads/source/nfs/initialization.py b/pyanaconda/modules/payloads/source/nfs/initialization.py index d03559fdc94..cb09c45c36b 100644 --- a/pyanaconda/modules/payloads/source/nfs/initialization.py +++ b/pyanaconda/modules/payloads/source/nfs/initialization.py @@ -20,12 +20,14 @@ from collections import namedtuple from pyanaconda.anaconda_loggers import get_module_logger -from pyanaconda.core.payload import parse_nfs_url from pyanaconda.core.path import join_paths +from pyanaconda.core.payload import parse_nfs_url from pyanaconda.modules.common.errors.payload import SourceSetupError from pyanaconda.modules.common.task import Task -from pyanaconda.modules.payloads.source.utils import find_and_mount_iso_image, \ - verify_valid_repository +from pyanaconda.modules.payloads.source.utils import ( + find_and_mount_iso_image, + verify_valid_repository, +) from pyanaconda.payload.utils import mount, unmount log = get_module_logger(__name__) diff --git a/pyanaconda/modules/payloads/source/nfs/nfs.py b/pyanaconda/modules/payloads/source/nfs/nfs.py index eae5edfe892..f54a3c77563 100644 --- a/pyanaconda/modules/payloads/source/nfs/nfs.py +++ b/pyanaconda/modules/payloads/source/nfs/nfs.py @@ -25,13 +25,20 @@ from pyanaconda.core.payload import create_nfs_url, parse_nfs_url from pyanaconda.modules.common.errors.general import InvalidValueError from pyanaconda.modules.common.structures.payload import RepoConfigurationData -from pyanaconda.modules.payloads.constants import SourceType, SourceState +from pyanaconda.modules.payloads.constants import SourceState, SourceType from pyanaconda.modules.payloads.source.mount_tasks import TearDownMountTask -from pyanaconda.modules.payloads.source.nfs.initialization import SetUpNFSSourceTask, \ - SetUpNFSSourceResult -from pyanaconda.modules.payloads.source.source_base import PayloadSourceBase, RPMSourceMixin, \ - RepositorySourceMixin -from pyanaconda.modules.payloads.source.source_base_interface import RepositorySourceInterface +from pyanaconda.modules.payloads.source.nfs.initialization import ( + SetUpNFSSourceResult, + SetUpNFSSourceTask, +) +from pyanaconda.modules.payloads.source.source_base import ( + PayloadSourceBase, + RepositorySourceMixin, + RPMSourceMixin, +) +from pyanaconda.modules.payloads.source.source_base_interface import ( + RepositorySourceInterface, +) from pyanaconda.modules.payloads.source.utils import MountPointGenerator log = get_module_logger(__name__) diff --git a/pyanaconda/modules/payloads/source/repo_files/initialization.py b/pyanaconda/modules/payloads/source/repo_files/initialization.py index 617f956b169..0cd9ff8f10b 100644 --- a/pyanaconda/modules/payloads/source/repo_files/initialization.py +++ b/pyanaconda/modules/payloads/source/repo_files/initialization.py @@ -17,11 +17,11 @@ # import glob +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.path import join_paths from pyanaconda.modules.common.errors.payload import SourceSetupError from pyanaconda.modules.common.task import Task -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) __all__ = ["SetUpRepoFilesSourceTask"] diff --git a/pyanaconda/modules/payloads/source/repo_files/repo_files.py b/pyanaconda/modules/payloads/source/repo_files/repo_files.py index 3fd5a5764c3..fecb0881476 100644 --- a/pyanaconda/modules/payloads/source/repo_files/repo_files.py +++ b/pyanaconda/modules/payloads/source/repo_files/repo_files.py @@ -17,14 +17,16 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.i18n import _ -from pyanaconda.modules.payloads.constants import SourceType, SourceState, DNF_REPO_DIRS +from pyanaconda.modules.payloads.constants import DNF_REPO_DIRS, SourceState, SourceType +from pyanaconda.modules.payloads.source.repo_files.initialization import ( + SetUpRepoFilesSourceTask, +) +from pyanaconda.modules.payloads.source.repo_files.repo_files_interface import ( + RepoFilesSourceInterface, +) from pyanaconda.modules.payloads.source.source_base import PayloadSourceBase -from pyanaconda.modules.payloads.source.repo_files.repo_files_interface import \ - RepoFilesSourceInterface -from pyanaconda.modules.payloads.source.repo_files.initialization import \ - SetUpRepoFilesSourceTask -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) diff --git a/pyanaconda/modules/payloads/source/repo_files/repo_files_interface.py b/pyanaconda/modules/payloads/source/repo_files/repo_files_interface.py index 5858e8c0fb6..daed5200ed3 100644 --- a/pyanaconda/modules/payloads/source/repo_files/repo_files_interface.py +++ b/pyanaconda/modules/payloads/source/repo_files/repo_files_interface.py @@ -18,8 +18,11 @@ # Red Hat, Inc. # from dasbus.server.interface import dbus_interface + from pyanaconda.modules.common.constants.interfaces import PAYLOAD_SOURCE_REPO_FILES -from pyanaconda.modules.payloads.source.source_base_interface import PayloadSourceBaseInterface +from pyanaconda.modules.payloads.source.source_base_interface import ( + PayloadSourceBaseInterface, +) @dbus_interface(PAYLOAD_SOURCE_REPO_FILES.interface_name) diff --git a/pyanaconda/modules/payloads/source/repo_path/repo_path.py b/pyanaconda/modules/payloads/source/repo_path/repo_path.py index 015a5edd69f..e27e22ec475 100644 --- a/pyanaconda/modules/payloads/source/repo_path/repo_path.py +++ b/pyanaconda/modules/payloads/source/repo_path/repo_path.py @@ -15,18 +15,22 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.i18n import _ from pyanaconda.core.signal import Signal from pyanaconda.modules.common.structures.payload import RepoConfigurationData -from pyanaconda.modules.payloads.constants import SourceType, SourceState -from pyanaconda.modules.payloads.source.source_base import PayloadSourceBase, \ - RPMSourceMixin -from pyanaconda.modules.payloads.source.repo_path.repo_path_interface import \ - RepoPathSourceInterface -from pyanaconda.modules.payloads.source.repo_path.initialization import \ - SetUpRepoPathSourceTask +from pyanaconda.modules.payloads.constants import SourceState, SourceType +from pyanaconda.modules.payloads.source.repo_path.initialization import ( + SetUpRepoPathSourceTask, +) +from pyanaconda.modules.payloads.source.repo_path.repo_path_interface import ( + RepoPathSourceInterface, +) +from pyanaconda.modules.payloads.source.source_base import ( + PayloadSourceBase, + RPMSourceMixin, +) -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) diff --git a/pyanaconda/modules/payloads/source/repo_path/repo_path_interface.py b/pyanaconda/modules/payloads/source/repo_path/repo_path_interface.py index 260bfdc1fc4..4fd66fd9f75 100644 --- a/pyanaconda/modules/payloads/source/repo_path/repo_path_interface.py +++ b/pyanaconda/modules/payloads/source/repo_path/repo_path_interface.py @@ -16,10 +16,13 @@ # Red Hat, Inc. # from dasbus.server.interface import dbus_interface -from dasbus.typing import * # pylint: disable=wildcard-import from dasbus.server.property import emits_properties_changed +from dasbus.typing import * # pylint: disable=wildcard-import + from pyanaconda.modules.common.constants.interfaces import PAYLOAD_SOURCE_REPO_PATH -from pyanaconda.modules.payloads.source.source_base_interface import PayloadSourceBaseInterface +from pyanaconda.modules.payloads.source.source_base_interface import ( + PayloadSourceBaseInterface, +) __all__ = ["RepoPathSourceInterface"] diff --git a/pyanaconda/modules/payloads/source/rpm_ostree/rpm_ostree.py b/pyanaconda/modules/payloads/source/rpm_ostree/rpm_ostree.py index fb51eb0f725..29222283141 100644 --- a/pyanaconda/modules/payloads/source/rpm_ostree/rpm_ostree.py +++ b/pyanaconda/modules/payloads/source/rpm_ostree/rpm_ostree.py @@ -23,9 +23,10 @@ from pyanaconda.core.i18n import _ from pyanaconda.core.signal import Signal from pyanaconda.modules.common.structures.rpm_ostree import RPMOSTreeConfigurationData -from pyanaconda.modules.payloads.constants import SourceType, SourceState -from pyanaconda.modules.payloads.source.rpm_ostree.rpm_ostree_interface import \ - RPMOSTreeSourceInterface +from pyanaconda.modules.payloads.constants import SourceState, SourceType +from pyanaconda.modules.payloads.source.rpm_ostree.rpm_ostree_interface import ( + RPMOSTreeSourceInterface, +) from pyanaconda.modules.payloads.source.source_base import PayloadSourceBase from pyanaconda.modules.payloads.source.utils import has_network_protocol diff --git a/pyanaconda/modules/payloads/source/rpm_ostree/rpm_ostree_interface.py b/pyanaconda/modules/payloads/source/rpm_ostree/rpm_ostree_interface.py index 4846363d4cc..001e1598677 100644 --- a/pyanaconda/modules/payloads/source/rpm_ostree/rpm_ostree_interface.py +++ b/pyanaconda/modules/payloads/source/rpm_ostree/rpm_ostree_interface.py @@ -17,12 +17,15 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # +from dasbus.server.interface import dbus_interface from dasbus.server.property import emits_properties_changed from dasbus.typing import * # pylint: disable=wildcard-import -from dasbus.server.interface import dbus_interface + from pyanaconda.modules.common.constants.interfaces import PAYLOAD_SOURCE_RPM_OSTREE from pyanaconda.modules.common.structures.rpm_ostree import RPMOSTreeConfigurationData -from pyanaconda.modules.payloads.source.source_base_interface import PayloadSourceBaseInterface +from pyanaconda.modules.payloads.source.source_base_interface import ( + PayloadSourceBaseInterface, +) __all__ = ["RPMOSTreeSourceInterface"] diff --git a/pyanaconda/modules/payloads/source/rpm_ostree_container/rpm_ostree_container.py b/pyanaconda/modules/payloads/source/rpm_ostree_container/rpm_ostree_container.py index 0a9127179ea..456106ba6b5 100644 --- a/pyanaconda/modules/payloads/source/rpm_ostree_container/rpm_ostree_container.py +++ b/pyanaconda/modules/payloads/source/rpm_ostree_container/rpm_ostree_container.py @@ -19,12 +19,16 @@ # from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.i18n import _ -from pyanaconda.modules.common.structures.rpm_ostree import RPMOSTreeContainerConfigurationData +from pyanaconda.modules.common.structures.rpm_ostree import ( + RPMOSTreeContainerConfigurationData, +) from pyanaconda.modules.payloads.constants import SourceType -from pyanaconda.modules.payloads.source.rpm_ostree.rpm_ostree import \ - RPMOSTreeSourceModule -from pyanaconda.modules.payloads.source.rpm_ostree_container.rpm_ostree_container_interface import \ - RPMOSTreeContainerSourceInterface +from pyanaconda.modules.payloads.source.rpm_ostree.rpm_ostree import ( + RPMOSTreeSourceModule, +) +from pyanaconda.modules.payloads.source.rpm_ostree_container.rpm_ostree_container_interface import ( + RPMOSTreeContainerSourceInterface, +) log = get_module_logger(__name__) diff --git a/pyanaconda/modules/payloads/source/rpm_ostree_container/rpm_ostree_container_interface.py b/pyanaconda/modules/payloads/source/rpm_ostree_container/rpm_ostree_container_interface.py index 5a39d83e4b3..75625c360d9 100644 --- a/pyanaconda/modules/payloads/source/rpm_ostree_container/rpm_ostree_container_interface.py +++ b/pyanaconda/modules/payloads/source/rpm_ostree_container/rpm_ostree_container_interface.py @@ -17,12 +17,19 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # +from dasbus.server.interface import dbus_interface from dasbus.server.property import emits_properties_changed from dasbus.typing import * # pylint: disable=wildcard-import -from dasbus.server.interface import dbus_interface -from pyanaconda.modules.common.constants.interfaces import PAYLOAD_SOURCE_RPM_OSTREE_CONTAINER -from pyanaconda.modules.common.structures.rpm_ostree import RPMOSTreeContainerConfigurationData -from pyanaconda.modules.payloads.source.source_base_interface import PayloadSourceBaseInterface + +from pyanaconda.modules.common.constants.interfaces import ( + PAYLOAD_SOURCE_RPM_OSTREE_CONTAINER, +) +from pyanaconda.modules.common.structures.rpm_ostree import ( + RPMOSTreeContainerConfigurationData, +) +from pyanaconda.modules.payloads.source.source_base_interface import ( + PayloadSourceBaseInterface, +) __all__ = ["RPMOSTreeContainerSourceInterface"] diff --git a/pyanaconda/modules/payloads/source/source_base_interface.py b/pyanaconda/modules/payloads/source/source_base_interface.py index 5cfb7198612..012fc319a1d 100644 --- a/pyanaconda/modules/payloads/source/source_base_interface.py +++ b/pyanaconda/modules/payloads/source/source_base_interface.py @@ -23,10 +23,12 @@ from dasbus.server.property import emits_properties_changed from dasbus.typing import * # pylint: disable=wildcard-import -from pyanaconda.modules.common.structures.payload import RepoConfigurationData from pyanaconda.modules.common.base.base_template import ModuleInterfaceTemplate -from pyanaconda.modules.common.constants.interfaces import PAYLOAD_SOURCE, \ - PAYLOAD_SOURCE_REPOSITORY +from pyanaconda.modules.common.constants.interfaces import ( + PAYLOAD_SOURCE, + PAYLOAD_SOURCE_REPOSITORY, +) +from pyanaconda.modules.common.structures.payload import RepoConfigurationData __all__ = [ "PayloadSourceBaseInterface", diff --git a/pyanaconda/modules/payloads/source/url/url.py b/pyanaconda/modules/payloads/source/url/url.py index a27b5faf8ee..2a7cbf606b4 100644 --- a/pyanaconda/modules/payloads/source/url/url.py +++ b/pyanaconda/modules/payloads/source/url/url.py @@ -19,18 +19,27 @@ # import copy -from pyanaconda.core.constants import URL_TYPE_BASEURL, URL_TYPE_METALINK, URL_TYPE_MIRRORLIST, \ - URL_TYPES +from pyanaconda.anaconda_loggers import get_module_logger +from pyanaconda.core.constants import ( + URL_TYPE_BASEURL, + URL_TYPE_METALINK, + URL_TYPE_MIRRORLIST, + URL_TYPES, +) from pyanaconda.core.payload import ProxyString, ProxyStringError from pyanaconda.modules.common.errors.general import InvalidValueError from pyanaconda.modules.common.structures.payload import RepoConfigurationData -from pyanaconda.modules.payloads.constants import SourceType, SourceState -from pyanaconda.modules.payloads.source.source_base import PayloadSourceBase, RPMSourceMixin, \ - RepositorySourceMixin -from pyanaconda.modules.payloads.source.source_base_interface import RepositorySourceInterface +from pyanaconda.modules.payloads.constants import SourceState, SourceType +from pyanaconda.modules.payloads.source.source_base import ( + PayloadSourceBase, + RepositorySourceMixin, + RPMSourceMixin, +) +from pyanaconda.modules.payloads.source.source_base_interface import ( + RepositorySourceInterface, +) from pyanaconda.modules.payloads.source.utils import has_network_protocol -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) diff --git a/pyanaconda/modules/payloads/source/utils.py b/pyanaconda/modules/payloads/source/utils.py index 1f3a50faa57..a3ca039e57c 100644 --- a/pyanaconda/modules/payloads/source/utils.py +++ b/pyanaconda/modules/payloads/source/utils.py @@ -24,12 +24,14 @@ from blivet.util import mount from productmd import DiscInfo +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.constants import SOURCES_DIR -from pyanaconda.core.storage import device_matches from pyanaconda.core.path import join_paths -from pyanaconda.anaconda_loggers import get_module_logger -from pyanaconda.modules.payloads.payload.dnf.tree_info import TreeInfoMetadata, \ - TreeInfoMetadataError +from pyanaconda.core.storage import device_matches +from pyanaconda.modules.payloads.payload.dnf.tree_info import ( + TreeInfoMetadata, + TreeInfoMetadataError, +) log = get_module_logger(__name__) diff --git a/pyanaconda/modules/runtime/__main__.py b/pyanaconda/modules/runtime/__main__.py index c71dcad785b..29256ae45d7 100644 --- a/pyanaconda/modules/runtime/__main__.py +++ b/pyanaconda/modules/runtime/__main__.py @@ -18,8 +18,10 @@ # Red Hat, Inc. # from pyanaconda.modules.common import init + init() from pyanaconda.modules.runtime.runtime import RuntimeService + service = RuntimeService() service.run() diff --git a/pyanaconda/modules/runtime/dracut_commands/__init__.py b/pyanaconda/modules/runtime/dracut_commands/__init__.py index 1bb6d23f0c8..56e8576bba5 100644 --- a/pyanaconda/modules/runtime/dracut_commands/__init__.py +++ b/pyanaconda/modules/runtime/dracut_commands/__init__.py @@ -15,6 +15,8 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from pyanaconda.modules.runtime.dracut_commands.dracut_commands import DracutCommandsModule +from pyanaconda.modules.runtime.dracut_commands.dracut_commands import ( + DracutCommandsModule, +) __all__ = ["DracutCommandsModule"] diff --git a/pyanaconda/modules/runtime/dracut_commands/dracut_commands.py b/pyanaconda/modules/runtime/dracut_commands/dracut_commands.py index 705e33f547f..ec8e1c40cb3 100644 --- a/pyanaconda/modules/runtime/dracut_commands/dracut_commands.py +++ b/pyanaconda/modules/runtime/dracut_commands/dracut_commands.py @@ -18,6 +18,7 @@ # Red Hat, Inc. # from collections import namedtuple + from pyanaconda.modules.common.base import KickstartBaseModule __all__ = ["DracutCommandsModule"] diff --git a/pyanaconda/modules/runtime/kickstart.py b/pyanaconda/modules/runtime/kickstart.py index e18b0174768..6f6d419f825 100644 --- a/pyanaconda/modules/runtime/kickstart.py +++ b/pyanaconda/modules/runtime/kickstart.py @@ -17,10 +17,15 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from pykickstart.sections import (PreInstallScriptSection, - PostScriptSection, TracebackScriptSection, OnErrorScriptSection) +from pykickstart.sections import ( + OnErrorScriptSection, + PostScriptSection, + PreInstallScriptSection, + TracebackScriptSection, +) -from pyanaconda.core.kickstart import KickstartSpecification, commands as COMMANDS +from pyanaconda.core.kickstart import KickstartSpecification +from pyanaconda.core.kickstart import commands as COMMANDS from pyanaconda.kickstart import AnacondaKSScript diff --git a/pyanaconda/modules/runtime/runtime.py b/pyanaconda/modules/runtime/runtime.py index bcd9562d6a9..2059a34f215 100755 --- a/pyanaconda/modules/runtime/runtime.py +++ b/pyanaconda/modules/runtime/runtime.py @@ -20,17 +20,17 @@ from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.dbus import DBus from pyanaconda.core.signal import Signal +from pyanaconda.modules.common.base import KickstartService +from pyanaconda.modules.common.constants.services import RUNTIME +from pyanaconda.modules.common.containers import TaskContainer from pyanaconda.modules.common.structures.logging import LoggingData from pyanaconda.modules.common.structures.rescue import RescueData -from pyanaconda.modules.runtime.runtime_interface import RuntimeInterface -from pyanaconda.modules.runtime.kickstart import RuntimeKickstartSpecification +from pyanaconda.modules.common.submodule_manager import SubmoduleManager from pyanaconda.modules.runtime.dracut_commands import DracutCommandsModule +from pyanaconda.modules.runtime.kickstart import RuntimeKickstartSpecification +from pyanaconda.modules.runtime.runtime_interface import RuntimeInterface from pyanaconda.modules.runtime.scripts import ScriptsModule from pyanaconda.modules.runtime.user_interface import UIModule -from pyanaconda.modules.common.base import KickstartService -from pyanaconda.modules.common.constants.services import RUNTIME -from pyanaconda.modules.common.containers import TaskContainer -from pyanaconda.modules.common.submodule_manager import SubmoduleManager log = get_module_logger(__name__) diff --git a/pyanaconda/modules/runtime/runtime_interface.py b/pyanaconda/modules/runtime/runtime_interface.py index 3b69c6a8c67..a4b405c17ca 100644 --- a/pyanaconda/modules/runtime/runtime_interface.py +++ b/pyanaconda/modules/runtime/runtime_interface.py @@ -21,8 +21,8 @@ from dasbus.server.property import emits_properties_changed from dasbus.typing import * # pylint: disable=wildcard-import -from pyanaconda.modules.common.constants.services import RUNTIME from pyanaconda.modules.common.base import KickstartModuleInterface +from pyanaconda.modules.common.constants.services import RUNTIME __all__ = ["RuntimeInterface"] diff --git a/pyanaconda/modules/runtime/scripts/runtime.py b/pyanaconda/modules/runtime/scripts/runtime.py index c0df36a5f47..c584ffda968 100644 --- a/pyanaconda/modules/runtime/scripts/runtime.py +++ b/pyanaconda/modules/runtime/scripts/runtime.py @@ -15,12 +15,12 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # +from pykickstart.constants import KS_SCRIPT_POST + +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.configuration.anaconda import conf from pyanaconda.modules.common.errors.runtime import ScriptError from pyanaconda.modules.common.task import Task -from pyanaconda.anaconda_loggers import get_module_logger - -from pykickstart.constants import KS_SCRIPT_POST log = get_module_logger(__name__) diff --git a/pyanaconda/modules/runtime/user_interface/ui.py b/pyanaconda/modules/runtime/user_interface/ui.py index 82da6a31a58..299c0d724c9 100644 --- a/pyanaconda/modules/runtime/user_interface/ui.py +++ b/pyanaconda/modules/runtime/user_interface/ui.py @@ -17,19 +17,23 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # +from pykickstart.commands.displaymode import DISPLAY_MODE_TEXT + from pyanaconda.anaconda_loggers import get_module_logger -from pyanaconda.core.constants import PASSWORD_POLICY_LUKS, PASSWORD_POLICY_ROOT, \ - PASSWORD_POLICY_USER, DisplayModes +from pyanaconda.core.constants import ( + PASSWORD_POLICY_LUKS, + PASSWORD_POLICY_ROOT, + PASSWORD_POLICY_USER, + DisplayModes, +) from pyanaconda.core.dbus import DBus from pyanaconda.core.product import get_product_is_final_release from pyanaconda.core.signal import Signal -from pyanaconda.modules.common.structures.vnc import VncData -from pyanaconda.modules.runtime.user_interface.ui_interface import UIInterface from pyanaconda.modules.common.base import KickstartBaseModule from pyanaconda.modules.common.constants.objects import USER_INTERFACE from pyanaconda.modules.common.structures.policy import PasswordPolicy - -from pykickstart.commands.displaymode import DISPLAY_MODE_TEXT +from pyanaconda.modules.common.structures.vnc import VncData +from pyanaconda.modules.runtime.user_interface.ui_interface import UIInterface log = get_module_logger(__name__) diff --git a/pyanaconda/modules/security/__main__.py b/pyanaconda/modules/security/__main__.py index 333457ffcce..0005cd27658 100644 --- a/pyanaconda/modules/security/__main__.py +++ b/pyanaconda/modules/security/__main__.py @@ -18,8 +18,10 @@ # Red Hat, Inc. # from pyanaconda.modules.common import init + init() from pyanaconda.modules.security.security import SecurityService + service = SecurityService() service.run() diff --git a/pyanaconda/modules/security/constants.py b/pyanaconda/modules/security/constants.py index b48f9d72200..49cc126c176 100644 --- a/pyanaconda/modules/security/constants.py +++ b/pyanaconda/modules/security/constants.py @@ -19,7 +19,12 @@ # from enum import Enum, unique -from pykickstart.constants import SELINUX_DISABLED, SELINUX_ENFORCING, SELINUX_PERMISSIVE +from pykickstart.constants import ( + SELINUX_DISABLED, + SELINUX_ENFORCING, + SELINUX_PERMISSIVE, +) + from pyanaconda.core.constants import SELINUX_DEFAULT diff --git a/pyanaconda/modules/security/installation.py b/pyanaconda/modules/security/installation.py index 82eae14896c..e947733735d 100644 --- a/pyanaconda/modules/security/installation.py +++ b/pyanaconda/modules/security/installation.py @@ -15,15 +15,15 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -import os import copy +import os import shutil from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core import util from pyanaconda.core.configuration.anaconda import conf from pyanaconda.core.constants import PAYLOAD_TYPE_DNF -from pyanaconda.core.path import make_directories, join_paths +from pyanaconda.core.path import join_paths, make_directories from pyanaconda.modules.common.errors.installation import SecurityInstallationError from pyanaconda.modules.common.task import Task from pyanaconda.modules.security.constants import SELinuxMode diff --git a/pyanaconda/modules/security/kickstart.py b/pyanaconda/modules/security/kickstart.py index 24cbb03253f..915d1a5340f 100644 --- a/pyanaconda/modules/security/kickstart.py +++ b/pyanaconda/modules/security/kickstart.py @@ -17,7 +17,8 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from pyanaconda.core.kickstart import KickstartSpecification, commands as COMMANDS +from pyanaconda.core.kickstart import KickstartSpecification +from pyanaconda.core.kickstart import commands as COMMANDS class SecurityKickstartSpecification(KickstartSpecification): diff --git a/pyanaconda/modules/security/security.py b/pyanaconda/modules/security/security.py index a931ab2c7b0..2f68e77ebae 100644 --- a/pyanaconda/modules/security/security.py +++ b/pyanaconda/modules/security/security.py @@ -19,6 +19,7 @@ # import shlex +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.configuration.anaconda import conf from pyanaconda.core.dbus import DBus from pyanaconda.core.kernel import kernel_arguments @@ -29,13 +30,18 @@ from pyanaconda.modules.common.structures.realm import RealmData from pyanaconda.modules.common.structures.requirement import Requirement from pyanaconda.modules.security.constants import SELinuxMode +from pyanaconda.modules.security.installation import ( + ConfigureAuthselectTask, + ConfigureFingerprintAuthTask, + ConfigureFIPSTask, + ConfigureSELinuxTask, + PreconfigureFIPSTask, + RealmDiscoverTask, + RealmJoinTask, +) from pyanaconda.modules.security.kickstart import SecurityKickstartSpecification from pyanaconda.modules.security.security_interface import SecurityInterface -from pyanaconda.modules.security.installation import ConfigureSELinuxTask, \ - RealmDiscoverTask, RealmJoinTask, ConfigureAuthselectTask, \ - ConfigureFingerprintAuthTask, PreconfigureFIPSTask, ConfigureFIPSTask -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) diff --git a/pyanaconda/modules/security/security_interface.py b/pyanaconda/modules/security/security_interface.py index c4251cdb3d8..256bf9068a0 100644 --- a/pyanaconda/modules/security/security_interface.py +++ b/pyanaconda/modules/security/security_interface.py @@ -17,11 +17,12 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from pyanaconda.modules.common.constants.services import SECURITY +from dasbus.server.interface import dbus_interface from dasbus.server.property import emits_properties_changed from dasbus.typing import * # pylint: disable=wildcard-import + from pyanaconda.modules.common.base import KickstartModuleInterface -from dasbus.server.interface import dbus_interface +from pyanaconda.modules.common.constants.services import SECURITY from pyanaconda.modules.common.containers import TaskContainer from pyanaconda.modules.common.structures.realm import RealmData from pyanaconda.modules.security.constants import SELinuxMode diff --git a/pyanaconda/modules/services/__main__.py b/pyanaconda/modules/services/__main__.py index d4b0879ad8f..9a5c6308733 100644 --- a/pyanaconda/modules/services/__main__.py +++ b/pyanaconda/modules/services/__main__.py @@ -18,8 +18,10 @@ # Red Hat, Inc. # from pyanaconda.modules.common import init + init() from pyanaconda.modules.services.services import ServicesService + service = ServicesService() service.run() diff --git a/pyanaconda/modules/services/constants.py b/pyanaconda/modules/services/constants.py index c0cc4d1d1b8..07c5dd4aff1 100644 --- a/pyanaconda/modules/services/constants.py +++ b/pyanaconda/modules/services/constants.py @@ -19,8 +19,12 @@ # from enum import Enum, unique -from pyanaconda.core.constants import SETUP_ON_BOOT_DEFAULT, SETUP_ON_BOOT_DISABLED,\ - SETUP_ON_BOOT_ENABLED, SETUP_ON_BOOT_RECONFIG +from pyanaconda.core.constants import ( + SETUP_ON_BOOT_DEFAULT, + SETUP_ON_BOOT_DISABLED, + SETUP_ON_BOOT_ENABLED, + SETUP_ON_BOOT_RECONFIG, +) @unique diff --git a/pyanaconda/modules/services/installation.py b/pyanaconda/modules/services/installation.py index 3c90379ebcb..a76f84d25ae 100644 --- a/pyanaconda/modules/services/installation.py +++ b/pyanaconda/modules/services/installation.py @@ -18,15 +18,19 @@ import os from configparser import ConfigParser -from pyanaconda.core.service import enable_service, disable_service, is_service_installed +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.configuration.anaconda import conf +from pyanaconda.core.constants import GRAPHICAL_TARGET, TEXT_ONLY_TARGET from pyanaconda.core.path import touch +from pyanaconda.core.service import ( + disable_service, + enable_service, + is_service_installed, +) from pyanaconda.core.util import get_anaconda_version_string -from pyanaconda.core.constants import TEXT_ONLY_TARGET, GRAPHICAL_TARGET from pyanaconda.modules.common.task import Task from pyanaconda.modules.services.constants import SetupOnBootAction -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) __all__ = [ diff --git a/pyanaconda/modules/services/kickstart.py b/pyanaconda/modules/services/kickstart.py index b3b88eea0f2..c131d722eac 100644 --- a/pyanaconda/modules/services/kickstart.py +++ b/pyanaconda/modules/services/kickstart.py @@ -17,7 +17,8 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from pyanaconda.core.kickstart import KickstartSpecification, commands as COMMANDS +from pyanaconda.core.kickstart import KickstartSpecification +from pyanaconda.core.kickstart import commands as COMMANDS class ServicesKickstartSpecification(KickstartSpecification): diff --git a/pyanaconda/modules/services/services.py b/pyanaconda/modules/services/services.py index 98af6162929..cef5e97ef92 100644 --- a/pyanaconda/modules/services/services.py +++ b/pyanaconda/modules/services/services.py @@ -17,23 +17,27 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from pykickstart.constants import FIRSTBOOT_DEFAULT, FIRSTBOOT_SKIP, FIRSTBOOT_RECONFIG +from pykickstart.constants import FIRSTBOOT_DEFAULT, FIRSTBOOT_RECONFIG, FIRSTBOOT_SKIP +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.configuration.anaconda import conf -from pyanaconda.core.constants import TEXT_ONLY_TARGET, GRAPHICAL_TARGET +from pyanaconda.core.constants import GRAPHICAL_TARGET, TEXT_ONLY_TARGET from pyanaconda.core.dbus import DBus from pyanaconda.core.signal import Signal from pyanaconda.modules.common.base import KickstartService from pyanaconda.modules.common.constants.services import SERVICES from pyanaconda.modules.common.containers import TaskContainer from pyanaconda.modules.services.constants import SetupOnBootAction +from pyanaconda.modules.services.installation import ( + ConfigureDefaultDesktopTask, + ConfigureInitialSetupTask, + ConfigurePostInstallationToolsTask, + ConfigureServicesTask, + ConfigureSystemdDefaultTargetTask, +) from pyanaconda.modules.services.kickstart import ServicesKickstartSpecification from pyanaconda.modules.services.services_interface import ServicesInterface -from pyanaconda.modules.services.installation import ConfigureInitialSetupTask, \ - ConfigurePostInstallationToolsTask, ConfigureServicesTask, ConfigureSystemdDefaultTargetTask, \ - ConfigureDefaultDesktopTask -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) diff --git a/pyanaconda/modules/services/services_interface.py b/pyanaconda/modules/services/services_interface.py index 1165e9de5d4..a0d10d31ea7 100644 --- a/pyanaconda/modules/services/services_interface.py +++ b/pyanaconda/modules/services/services_interface.py @@ -17,9 +17,10 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # +from dasbus.server.interface import dbus_interface from dasbus.server.property import emits_properties_changed from dasbus.typing import * # pylint: disable=wildcard-import -from dasbus.server.interface import dbus_interface + from pyanaconda.modules.common.base import KickstartModuleInterface from pyanaconda.modules.common.constants.services import SERVICES from pyanaconda.modules.services.constants import SetupOnBootAction diff --git a/pyanaconda/modules/storage/__main__.py b/pyanaconda/modules/storage/__main__.py index 327a1295554..3db9bd78a7e 100644 --- a/pyanaconda/modules/storage/__main__.py +++ b/pyanaconda/modules/storage/__main__.py @@ -18,13 +18,16 @@ # Red Hat, Inc. # from pyanaconda.modules.common import init + init("/tmp/storage.log") # Initialize Blivet. from pyanaconda.modules.storage.initialization import enable_installer_mode + enable_installer_mode() # Start the module. from pyanaconda.modules.storage.storage import StorageService + service = StorageService() service.run() diff --git a/pyanaconda/modules/storage/bootloader/__init__.py b/pyanaconda/modules/storage/bootloader/__init__.py index f214ad49597..026da705118 100644 --- a/pyanaconda/modules/storage/bootloader/__init__.py +++ b/pyanaconda/modules/storage/bootloader/__init__.py @@ -16,7 +16,7 @@ # Red Hat, Inc. # from pyanaconda.modules.storage.bootloader.base import BootLoaderError -from pyanaconda.modules.storage.bootloader.factory import BootLoaderFactory from pyanaconda.modules.storage.bootloader.bootloader import BootloaderModule +from pyanaconda.modules.storage.bootloader.factory import BootLoaderFactory __all__ = ["BootLoaderError", "BootLoaderFactory", "BootloaderModule"] diff --git a/pyanaconda/modules/storage/bootloader/base.py b/pyanaconda/modules/storage/bootloader/base.py index eba1c27f9ec..fdb699b9c15 100644 --- a/pyanaconda/modules/storage/bootloader/base.py +++ b/pyanaconda/modules/storage/bootloader/base.py @@ -24,25 +24,31 @@ from blivet.formats.disklabel import DiskLabel from blivet.iscsi import iscsi from blivet.size import Size +from pykickstart.constants import SELINUX_DISABLED -from pyanaconda.core.constants import BOOTLOADER_TIMEOUT_UNSET -from pyanaconda.modules.common.util import is_module_available -from pyanaconda.network import iface_for_host_ip -from pyanaconda.modules.storage.platform import platform, PLATFORM_DEVICE_TYPES, \ - PLATFORM_FORMAT_TYPES, PLATFORM_MOUNT_POINTS, PLATFORM_MAX_END, PLATFORM_RAID_LEVELS, \ - PLATFORM_RAID_METADATA from pyanaconda.anaconda_loggers import get_module_logger -from pyanaconda.modules.storage.bootloader.image import LinuxBootLoaderImage from pyanaconda.core import util -from pyanaconda.core.kernel import kernel_arguments from pyanaconda.core.configuration.anaconda import conf +from pyanaconda.core.constants import BOOTLOADER_TIMEOUT_UNSET from pyanaconda.core.i18n import N_, _ +from pyanaconda.core.kernel import kernel_arguments from pyanaconda.core.path import open_with_perm -from pyanaconda.modules.common.constants.objects import FCOE, ISCSI, BOOTLOADER +from pyanaconda.modules.common.constants.objects import BOOTLOADER, FCOE, ISCSI +from pyanaconda.modules.common.constants.services import NETWORK, SECURITY, STORAGE from pyanaconda.modules.common.structures.iscsi import Node -from pyanaconda.modules.common.constants.services import STORAGE, NETWORK, SECURITY from pyanaconda.modules.common.structures.network import NetworkDeviceInfo -from pykickstart.constants import SELINUX_DISABLED +from pyanaconda.modules.common.util import is_module_available +from pyanaconda.modules.storage.bootloader.image import LinuxBootLoaderImage +from pyanaconda.modules.storage.platform import ( + PLATFORM_DEVICE_TYPES, + PLATFORM_FORMAT_TYPES, + PLATFORM_MAX_END, + PLATFORM_MOUNT_POINTS, + PLATFORM_RAID_LEVELS, + PLATFORM_RAID_METADATA, + platform, +) +from pyanaconda.network import iface_for_host_ip log = get_module_logger(__name__) diff --git a/pyanaconda/modules/storage/bootloader/bootloader.py b/pyanaconda/modules/storage/bootloader/bootloader.py index b8d41416dd7..9ac64f559b7 100644 --- a/pyanaconda/modules/storage/bootloader/bootloader.py +++ b/pyanaconda/modules/storage/bootloader/bootloader.py @@ -17,26 +17,43 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # +from pykickstart.constants import ( + SECURE_BOOT_AUTO, + SECURE_BOOT_DISABLED, + SECURE_BOOT_ENABLED, +) from pykickstart.errors import KickstartParseError -from pykickstart.constants import SECURE_BOOT_AUTO, SECURE_BOOT_ENABLED, SECURE_BOOT_DISABLED from pyanaconda.anaconda_loggers import get_module_logger -from pyanaconda.modules.storage.bootloader import BootLoaderFactory -from pyanaconda.modules.storage.bootloader.efi import EFIBase -from pyanaconda.modules.storage.bootloader.grub2 import GRUB2 from pyanaconda.core.configuration.anaconda import conf from pyanaconda.core.configuration.bootloader import BootloaderType -from pyanaconda.core.constants import BOOTLOADER_LOCATION_DEFAULT, BOOTLOADER_TIMEOUT_UNSET, \ - BOOTLOADER_LOCATION_MBR, BOOTLOADER_LOCATION_PARTITION -from pyanaconda.core.i18n import _ +from pyanaconda.core.constants import ( + BOOTLOADER_LOCATION_DEFAULT, + BOOTLOADER_LOCATION_MBR, + BOOTLOADER_LOCATION_PARTITION, + BOOTLOADER_TIMEOUT_UNSET, +) from pyanaconda.core.dbus import DBus +from pyanaconda.core.i18n import _ from pyanaconda.core.signal import Signal from pyanaconda.modules.common.constants.objects import BOOTLOADER from pyanaconda.modules.common.structures.requirement import Requirement -from pyanaconda.modules.storage.bootloader.bootloader_interface import BootloaderInterface -from pyanaconda.modules.storage.bootloader.installation import ConfigureBootloaderTask, \ - InstallBootloaderTask, FixZIPLBootloaderTask, FixBTRFSBootloaderTask, RecreateInitrdsTask, \ - CreateRescueImagesTask, CreateBLSEntriesTask, CollectKernelArgumentsTask +from pyanaconda.modules.storage.bootloader.bootloader_interface import ( + BootloaderInterface, +) +from pyanaconda.modules.storage.bootloader.efi import EFIBase +from pyanaconda.modules.storage.bootloader.factory import BootLoaderFactory +from pyanaconda.modules.storage.bootloader.grub2 import GRUB2 +from pyanaconda.modules.storage.bootloader.installation import ( + CollectKernelArgumentsTask, + ConfigureBootloaderTask, + CreateBLSEntriesTask, + CreateRescueImagesTask, + FixBTRFSBootloaderTask, + FixZIPLBootloaderTask, + InstallBootloaderTask, + RecreateInitrdsTask, +) from pyanaconda.modules.storage.constants import BootloaderMode, ZIPLSecureBoot from pyanaconda.modules.storage.storage_subscriber import StorageSubscriberModule diff --git a/pyanaconda/modules/storage/bootloader/bootloader_interface.py b/pyanaconda/modules/storage/bootloader/bootloader_interface.py index f35625adffe..4dc5c9a953a 100644 --- a/pyanaconda/modules/storage/bootloader/bootloader_interface.py +++ b/pyanaconda/modules/storage/bootloader/bootloader_interface.py @@ -20,6 +20,7 @@ from dasbus.server.interface import dbus_interface from dasbus.server.property import emits_properties_changed from dasbus.typing import * # pylint: disable=wildcard-import + from pyanaconda.modules.common.base import KickstartModuleInterfaceTemplate from pyanaconda.modules.common.constants.objects import BOOTLOADER from pyanaconda.modules.common.containers import TaskContainer diff --git a/pyanaconda/modules/storage/bootloader/efi.py b/pyanaconda/modules/storage/bootloader/efi.py index 19daa64e8ec..a42af0f04cf 100644 --- a/pyanaconda/modules/storage/bootloader/efi.py +++ b/pyanaconda/modules/storage/bootloader/efi.py @@ -18,17 +18,17 @@ import os import re -from pyanaconda.modules.storage.bootloader.base import BootLoaderError -from pyanaconda.modules.storage.bootloader.grub2 import GRUB2 -from pyanaconda.modules.storage.bootloader.systemd import SystemdBoot +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core import util -from pyanaconda.core.i18n import _ from pyanaconda.core.configuration.anaconda import conf +from pyanaconda.core.i18n import _ from pyanaconda.core.kernel import kernel_arguments from pyanaconda.core.path import join_paths from pyanaconda.core.product import get_product_name +from pyanaconda.modules.storage.bootloader.base import BootLoaderError +from pyanaconda.modules.storage.bootloader.grub2 import GRUB2 +from pyanaconda.modules.storage.bootloader.systemd import SystemdBoot -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) __all__ = [ diff --git a/pyanaconda/modules/storage/bootloader/execution.py b/pyanaconda/modules/storage/bootloader/execution.py index 1b1468ac0e6..605374e3576 100644 --- a/pyanaconda/modules/storage/bootloader/execution.py +++ b/pyanaconda/modules/storage/bootloader/execution.py @@ -18,17 +18,22 @@ import blivet.arch from blivet.devices import iScsiDiskDevice -from pyanaconda.modules.storage.bootloader.base import BootLoaderError, \ - is_on_non_ibft_sw_iscsi +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.configuration.anaconda import conf -from pyanaconda.core.constants import BOOTLOADER_ENABLED, BOOTLOADER_SKIPPED, \ - BOOTLOADER_LOCATION_PARTITION +from pyanaconda.core.constants import ( + BOOTLOADER_ENABLED, + BOOTLOADER_LOCATION_PARTITION, + BOOTLOADER_SKIPPED, +) from pyanaconda.core.i18n import _ +from pyanaconda.core.storage import device_matches from pyanaconda.modules.common.constants.objects import BOOTLOADER from pyanaconda.modules.common.constants.services import STORAGE -from pyanaconda.core.storage import device_matches +from pyanaconda.modules.storage.bootloader.base import ( + BootLoaderError, + is_on_non_ibft_sw_iscsi, +) -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) __all__ = ["setup_bootloader"] diff --git a/pyanaconda/modules/storage/bootloader/extlinux.py b/pyanaconda/modules/storage/bootloader/extlinux.py index d78a95e8f74..4e163f7952f 100644 --- a/pyanaconda/modules/storage/bootloader/extlinux.py +++ b/pyanaconda/modules/storage/bootloader/extlinux.py @@ -17,13 +17,16 @@ # import os -from pyanaconda.modules.storage.bootloader.base import BootLoader, BootLoaderArguments,\ - BootLoaderError -from pyanaconda.core.util import execWithRedirect +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.configuration.anaconda import conf from pyanaconda.core.product import get_product_name +from pyanaconda.core.util import execWithRedirect +from pyanaconda.modules.storage.bootloader.base import ( + BootLoader, + BootLoaderArguments, + BootLoaderError, +) -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) __all__ = ["EXTLINUX"] diff --git a/pyanaconda/modules/storage/bootloader/factory.py b/pyanaconda/modules/storage/bootloader/factory.py index f5c2d1f5e70..7c18df7b02b 100644 --- a/pyanaconda/modules/storage/bootloader/factory.py +++ b/pyanaconda/modules/storage/bootloader/factory.py @@ -15,9 +15,9 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.modules.storage import platform -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) __all__ = ["BootLoaderFactory"] @@ -94,7 +94,9 @@ def get_class_by_name(cls, name): if name == "SDBOOT": platform_class = platform.platform.__class__ if platform_class is platform.Aarch64EFI: - from pyanaconda.modules.storage.bootloader.efi import Aarch64EFISystemdBoot + from pyanaconda.modules.storage.bootloader.efi import ( + Aarch64EFISystemdBoot, + ) return Aarch64EFISystemdBoot if platform_class is platform.EFI: from pyanaconda.modules.storage.bootloader.efi import X64EFISystemdBoot diff --git a/pyanaconda/modules/storage/bootloader/grub2.py b/pyanaconda/modules/storage/bootloader/grub2.py index d351b8947c7..c713006376e 100644 --- a/pyanaconda/modules/storage/bootloader/grub2.py +++ b/pyanaconda/modules/storage/bootloader/grub2.py @@ -17,18 +17,18 @@ # import os import re -from _ped import PARTITION_BIOS_GRUB # pylint: disable=no-name-in-module +from _ped import PARTITION_BIOS_GRUB # pylint: disable=no-name-in-module from blivet.devicelibs import raid -from pyanaconda.modules.storage.bootloader.base import BootLoader, BootLoaderError +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core import util from pyanaconda.core.configuration.anaconda import conf from pyanaconda.core.i18n import _ from pyanaconda.core.path import open_with_perm from pyanaconda.core.product import get_product_name +from pyanaconda.modules.storage.bootloader.base import BootLoader, BootLoaderError -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) __all__ = ["GRUB2", "IPSeriesGRUB2"] diff --git a/pyanaconda/modules/storage/bootloader/installation.py b/pyanaconda/modules/storage/bootloader/installation.py index cd831496908..8de594f7255 100644 --- a/pyanaconda/modules/storage/bootloader/installation.py +++ b/pyanaconda/modules/storage/bootloader/installation.py @@ -19,19 +19,23 @@ # from blivet import arch from blivet.devices import BTRFSDevice -from pyanaconda.core.constants import PAYLOAD_TYPE_RPM_OSTREE, PAYLOAD_LIVE_TYPES -from pyanaconda.modules.payloads.payload.rpm_ostree.util import have_bootupd -from pyanaconda.modules.storage.bootloader import BootLoaderError -from pyanaconda.modules.storage.bootloader.systemd import SystemdBoot -from pyanaconda.core.util import execWithRedirect -from pyanaconda.modules.common.errors.installation import BootloaderInstallationError -from pyanaconda.modules.storage.constants import BootloaderMode from pyanaconda.anaconda_loggers import get_module_logger -from pyanaconda.modules.storage.bootloader.utils import configure_boot_loader, \ - recreate_initrds, create_rescue_images, create_bls_entries from pyanaconda.core.configuration.anaconda import conf +from pyanaconda.core.constants import PAYLOAD_LIVE_TYPES, PAYLOAD_TYPE_RPM_OSTREE +from pyanaconda.core.util import execWithRedirect +from pyanaconda.modules.common.errors.installation import BootloaderInstallationError from pyanaconda.modules.common.task import Task +from pyanaconda.modules.payloads.payload.rpm_ostree.util import have_bootupd +from pyanaconda.modules.storage.bootloader import BootLoaderError +from pyanaconda.modules.storage.bootloader.systemd import SystemdBoot +from pyanaconda.modules.storage.bootloader.utils import ( + configure_boot_loader, + create_bls_entries, + create_rescue_images, + recreate_initrds, +) +from pyanaconda.modules.storage.constants import BootloaderMode log = get_module_logger(__name__) diff --git a/pyanaconda/modules/storage/bootloader/systemd.py b/pyanaconda/modules/storage/bootloader/systemd.py index 69551bf5a53..c3e207dd59a 100644 --- a/pyanaconda/modules/storage/bootloader/systemd.py +++ b/pyanaconda/modules/storage/bootloader/systemd.py @@ -15,16 +15,16 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from pyanaconda.core.constants import PAYLOAD_TYPE_DNF -from pyanaconda.modules.common.constants.services import PAYLOADS -from pyanaconda.modules.storage.bootloader.base import BootLoader, BootLoaderError +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core import util from pyanaconda.core.configuration.anaconda import conf +from pyanaconda.core.constants import PAYLOAD_TYPE_DNF from pyanaconda.core.i18n import _ from pyanaconda.core.path import join_paths from pyanaconda.core.product import get_product_name +from pyanaconda.modules.common.constants.services import PAYLOADS +from pyanaconda.modules.storage.bootloader.base import BootLoader, BootLoaderError -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) __all__ = ["SystemdBoot"] diff --git a/pyanaconda/modules/storage/bootloader/utils.py b/pyanaconda/modules/storage/bootloader/utils.py index a33e59689a7..352edd67eac 100644 --- a/pyanaconda/modules/storage/bootloader/utils.py +++ b/pyanaconda/modules/storage/bootloader/utils.py @@ -18,13 +18,13 @@ import os from glob import glob -from pyanaconda.modules.common.errors.installation import BootloaderInstallationError -from pyanaconda.modules.storage.bootloader.image import LinuxBootLoaderImage +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.configuration.anaconda import conf -from pyanaconda.core.util import execWithRedirect from pyanaconda.core.product import get_product_name +from pyanaconda.core.util import execWithRedirect +from pyanaconda.modules.common.errors.installation import BootloaderInstallationError +from pyanaconda.modules.storage.bootloader.image import LinuxBootLoaderImage -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) __all__ = ["configure_boot_loader", "create_rescue_images", "recreate_initrds"] diff --git a/pyanaconda/modules/storage/bootloader/zipl.py b/pyanaconda/modules/storage/bootloader/zipl.py index 1b1bd04162e..ed92cd2c1f4 100644 --- a/pyanaconda/modules/storage/bootloader/zipl.py +++ b/pyanaconda/modules/storage/bootloader/zipl.py @@ -18,13 +18,16 @@ import os import re -from pyanaconda.modules.storage.bootloader.base import BootLoader, BootLoaderArguments,\ - BootLoaderError +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core import util from pyanaconda.core.configuration.anaconda import conf from pyanaconda.core.product import get_product_name +from pyanaconda.modules.storage.bootloader.base import ( + BootLoader, + BootLoaderArguments, + BootLoaderError, +) -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) __all__ = ["ZIPL"] diff --git a/pyanaconda/modules/storage/checker/checker.py b/pyanaconda/modules/storage/checker/checker.py index 17550447f85..5ac5657993a 100644 --- a/pyanaconda/modules/storage/checker/checker.py +++ b/pyanaconda/modules/storage/checker/checker.py @@ -20,7 +20,7 @@ from blivet.size import Size from pyanaconda.anaconda_loggers import get_module_logger -from pyanaconda.core.constants import STORAGE_SWAP_IS_RECOMMENDED, STORAGE_MIN_RAM +from pyanaconda.core.constants import STORAGE_MIN_RAM, STORAGE_SWAP_IS_RECOMMENDED from pyanaconda.core.dbus import DBus from pyanaconda.modules.common.base import KickstartBaseModule from pyanaconda.modules.common.constants.objects import STORAGE_CHECKER diff --git a/pyanaconda/modules/storage/checker/checker_interface.py b/pyanaconda/modules/storage/checker/checker_interface.py index a43db0d623e..d8762397be5 100644 --- a/pyanaconda/modules/storage/checker/checker_interface.py +++ b/pyanaconda/modules/storage/checker/checker_interface.py @@ -19,6 +19,7 @@ # from dasbus.server.interface import dbus_interface from dasbus.typing import * # pylint: disable=wildcard-import + from pyanaconda.modules.common.base.base_template import InterfaceTemplate from pyanaconda.modules.common.constants.objects import STORAGE_CHECKER diff --git a/pyanaconda/modules/storage/checker/utils.py b/pyanaconda/modules/storage/checker/utils.py index e665c5ce7ef..c0ce4459b88 100644 --- a/pyanaconda/modules/storage/checker/utils.py +++ b/pyanaconda/modules/storage/checker/utils.py @@ -21,20 +21,28 @@ from blivet.devicefactory import get_device_type from blivet.size import Size -from pyanaconda.core.hw import NO_SWAP_EXTRA_RAM +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.configuration.anaconda import conf -from pyanaconda.core.constants import STORAGE_REFORMAT_BLOCKLIST, \ - STORAGE_REFORMAT_ALLOWLIST, STORAGE_MIN_PARTITION_SIZES, STORAGE_MIN_RAM, \ - STORAGE_SWAP_IS_RECOMMENDED, STORAGE_MUST_BE_ON_ROOT, STORAGE_MUST_BE_ON_LINUXFS, \ - STORAGE_LUKS2_MIN_RAM, STORAGE_ROOT_DEVICE_TYPES, STORAGE_REQ_PARTITION_SIZES, \ - STORAGE_MUST_NOT_BE_ON_ROOT +from pyanaconda.core.constants import ( + STORAGE_LUKS2_MIN_RAM, + STORAGE_MIN_PARTITION_SIZES, + STORAGE_MIN_RAM, + STORAGE_MUST_BE_ON_LINUXFS, + STORAGE_MUST_BE_ON_ROOT, + STORAGE_MUST_NOT_BE_ON_ROOT, + STORAGE_REFORMAT_ALLOWLIST, + STORAGE_REFORMAT_BLOCKLIST, + STORAGE_REQ_PARTITION_SIZES, + STORAGE_ROOT_DEVICE_TYPES, + STORAGE_SWAP_IS_RECOMMENDED, +) +from pyanaconda.core.hw import NO_SWAP_EXTRA_RAM from pyanaconda.core.i18n import _ from pyanaconda.core.payload import rpm_version_key from pyanaconda.core.product import get_product_name from pyanaconda.core.storage import DEVICE_TEXT_MAP from pyanaconda.modules.storage.platform import platform -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) diff --git a/pyanaconda/modules/storage/constants.py b/pyanaconda/modules/storage/constants.py index cde2afee1f2..d2431227246 100644 --- a/pyanaconda/modules/storage/constants.py +++ b/pyanaconda/modules/storage/constants.py @@ -19,13 +19,21 @@ # from enum import Enum, unique -from pyanaconda.core.constants import CLEAR_PARTITIONS_NONE, CLEAR_PARTITIONS_ALL, \ - CLEAR_PARTITIONS_LIST, CLEAR_PARTITIONS_LINUX, CLEAR_PARTITIONS_DEFAULT, BOOTLOADER_DISABLED, \ - BOOTLOADER_ENABLED, BOOTLOADER_SKIPPED, ISCSI_INTERFACE_UNSET, ISCSI_INTERFACE_DEFAULT,\ - ISCSI_INTERFACE_IFACENAME +from pyanaconda.core.constants import ( + BOOTLOADER_DISABLED, + BOOTLOADER_ENABLED, + BOOTLOADER_SKIPPED, + CLEAR_PARTITIONS_ALL, + CLEAR_PARTITIONS_DEFAULT, + CLEAR_PARTITIONS_LINUX, + CLEAR_PARTITIONS_LIST, + CLEAR_PARTITIONS_NONE, + ISCSI_INTERFACE_DEFAULT, + ISCSI_INTERFACE_IFACENAME, + ISCSI_INTERFACE_UNSET, +) from pyanaconda.core.i18n import N_ - INCONSISTENT_SECTOR_SIZES_SUGGESTIONS = N_( "Workarounds for manual installations:\n" "* Select only the disks with the same sector size during manual " diff --git a/pyanaconda/modules/storage/dasd/dasd.py b/pyanaconda/modules/storage/dasd/dasd.py index 5d52d8d1acd..c9a68678c6c 100644 --- a/pyanaconda/modules/storage/dasd/dasd.py +++ b/pyanaconda/modules/storage/dasd/dasd.py @@ -25,7 +25,10 @@ from pyanaconda.modules.common.errors.storage import UnknownDeviceError from pyanaconda.modules.storage.dasd.dasd_interface import DASDInterface from pyanaconda.modules.storage.dasd.discover import DASDDiscoverTask -from pyanaconda.modules.storage.dasd.format import DASDFormatTask, FindFormattableDASDTask +from pyanaconda.modules.storage.dasd.format import ( + DASDFormatTask, + FindFormattableDASDTask, +) from pyanaconda.modules.storage.storage_subscriber import StorageSubscriberModule log = get_module_logger(__name__) diff --git a/pyanaconda/modules/storage/dasd/dasd_interface.py b/pyanaconda/modules/storage/dasd/dasd_interface.py index e2ce0e78bcd..4e84863ed0b 100644 --- a/pyanaconda/modules/storage/dasd/dasd_interface.py +++ b/pyanaconda/modules/storage/dasd/dasd_interface.py @@ -19,6 +19,7 @@ # from dasbus.server.interface import dbus_interface from dasbus.typing import * # pylint: disable=wildcard-import + from pyanaconda.modules.common.base import KickstartModuleInterfaceTemplate from pyanaconda.modules.common.constants.objects import DASD from pyanaconda.modules.common.containers import TaskContainer diff --git a/pyanaconda/modules/storage/dasd/discover.py b/pyanaconda/modules/storage/dasd/discover.py index e848da99bc0..f7f2b242691 100644 --- a/pyanaconda/modules/storage/dasd/discover.py +++ b/pyanaconda/modules/storage/dasd/discover.py @@ -20,9 +20,9 @@ from blivet import blockdev from pyanaconda.core.regexes import DASD_DEVICE_NUMBER -from pyanaconda.modules.common.task import Task -from pyanaconda.modules.common.errors.configuration import StorageDiscoveryError from pyanaconda.core.util import execWithRedirect +from pyanaconda.modules.common.errors.configuration import StorageDiscoveryError +from pyanaconda.modules.common.task import Task class DASDDiscoverTask(Task): diff --git a/pyanaconda/modules/storage/dasd/format.py b/pyanaconda/modules/storage/dasd/format.py index 9538a7217c8..8afd8183f8b 100644 --- a/pyanaconda/modules/storage/dasd/format.py +++ b/pyanaconda/modules/storage/dasd/format.py @@ -17,11 +17,11 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from pyanaconda.modules.common.task import Task -from pyanaconda.anaconda_loggers import get_module_logger - from blivet import blockdev +from pyanaconda.anaconda_loggers import get_module_logger +from pyanaconda.modules.common.task import Task + log = get_module_logger(__name__) __all__ = ["DASDFormatTask", "FindFormattableDASDTask"] diff --git a/pyanaconda/modules/storage/devicetree/__init__.py b/pyanaconda/modules/storage/devicetree/__init__.py index c61cd31fa91..716c3ab1466 100644 --- a/pyanaconda/modules/storage/devicetree/__init__.py +++ b/pyanaconda/modules/storage/devicetree/__init__.py @@ -15,7 +15,7 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from pyanaconda.modules.storage.devicetree.model import create_storage from pyanaconda.modules.storage.devicetree.devicetree import DeviceTreeModule +from pyanaconda.modules.storage.devicetree.model import create_storage __all__ = ["DeviceTreeModule", "create_storage"] diff --git a/pyanaconda/modules/storage/devicetree/devicetree.py b/pyanaconda/modules/storage/devicetree/devicetree.py index 1d30bcee533..2f7cf35ab8b 100644 --- a/pyanaconda/modules/storage/devicetree/devicetree.py +++ b/pyanaconda/modules/storage/devicetree/devicetree.py @@ -17,12 +17,14 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from pyanaconda.core.dbus import DBus +from dasbus.server.publishable import Publishable from pyanaconda.anaconda_loggers import get_module_logger -from dasbus.server.publishable import Publishable +from pyanaconda.core.dbus import DBus from pyanaconda.modules.common.constants.objects import DEVICE_TREE -from pyanaconda.modules.storage.devicetree.devicetree_interface import DeviceTreeInterface +from pyanaconda.modules.storage.devicetree.devicetree_interface import ( + DeviceTreeInterface, +) from pyanaconda.modules.storage.devicetree.handler import DeviceTreeHandler from pyanaconda.modules.storage.devicetree.viewer import DeviceTreeViewer from pyanaconda.modules.storage.storage_subscriber import StorageSubscriberModule diff --git a/pyanaconda/modules/storage/devicetree/devicetree_interface.py b/pyanaconda/modules/storage/devicetree/devicetree_interface.py index 11673d0cb4c..0214ba05a79 100644 --- a/pyanaconda/modules/storage/devicetree/devicetree_interface.py +++ b/pyanaconda/modules/storage/devicetree/devicetree_interface.py @@ -18,8 +18,13 @@ # Red Hat, Inc. # from dasbus.server.interface import dbus_class -from pyanaconda.modules.storage.devicetree.handler_interface import DeviceTreeHandlerInterface -from pyanaconda.modules.storage.devicetree.viewer_interface import DeviceTreeViewerInterface + +from pyanaconda.modules.storage.devicetree.handler_interface import ( + DeviceTreeHandlerInterface, +) +from pyanaconda.modules.storage.devicetree.viewer_interface import ( + DeviceTreeViewerInterface, +) __all__ = ["DeviceTreeInterface"] diff --git a/pyanaconda/modules/storage/devicetree/fsset.py b/pyanaconda/modules/storage/devicetree/fsset.py index bdde10e52a8..0107d0e23a6 100644 --- a/pyanaconda/modules/storage/devicetree/fsset.py +++ b/pyanaconda/modules/storage/devicetree/fsset.py @@ -20,18 +20,29 @@ import time from blivet import blockdev -from blivet.devices import NoDevice, DirectoryDevice, NFSDevice, FileDevice, MDRaidArrayDevice, \ - NetworkStorageDevice, OpticalDevice -from blivet.errors import UnrecognizedFSTabEntryError, FSTabTypeMismatchError, SwapSpaceError, \ - StorageError -from blivet.formats import get_format, get_device_format_class +from blivet.devices import ( + DirectoryDevice, + FileDevice, + MDRaidArrayDevice, + NetworkStorageDevice, + NFSDevice, + NoDevice, + OpticalDevice, +) +from blivet.errors import ( + FSTabTypeMismatchError, + StorageError, + SwapSpaceError, + UnrecognizedFSTabEntryError, +) +from blivet.formats import get_device_format_class, get_format from blivet.storage_log import log_exception_info +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.configuration.anaconda import conf from pyanaconda.core.i18n import _ -from pyanaconda.modules.storage.platform import platform, EFI +from pyanaconda.modules.storage.platform import EFI, platform -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) __all__ = ["BlkidTab", "CryptTab", "FSSet"] diff --git a/pyanaconda/modules/storage/devicetree/handler.py b/pyanaconda/modules/storage/devicetree/handler.py index 25427d555f4..eff3d696a59 100644 --- a/pyanaconda/modules/storage/devicetree/handler.py +++ b/pyanaconda/modules/storage/devicetree/handler.py @@ -17,16 +17,26 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from abc import abstractmethod, ABC +from abc import ABC, abstractmethod from blivet.errors import FSError + from pyanaconda.anaconda_loggers import get_module_logger -from pyanaconda.modules.common.errors.storage import UnknownDeviceError, MountFilesystemError +from pyanaconda.modules.common.errors.storage import ( + MountFilesystemError, + UnknownDeviceError, +) from pyanaconda.modules.storage.devicetree.populate import FindDevicesTask -from pyanaconda.modules.storage.devicetree.rescue import FindExistingSystemsTask, \ - MountExistingSystemTask -from pyanaconda.modules.storage.devicetree.utils import find_optical_media, \ - find_mountable_partitions, unlock_device, find_unconfigured_luks +from pyanaconda.modules.storage.devicetree.rescue import ( + FindExistingSystemsTask, + MountExistingSystemTask, +) +from pyanaconda.modules.storage.devicetree.utils import ( + find_mountable_partitions, + find_optical_media, + find_unconfigured_luks, + unlock_device, +) log = get_module_logger(__name__) diff --git a/pyanaconda/modules/storage/devicetree/handler_interface.py b/pyanaconda/modules/storage/devicetree/handler_interface.py index 817a52a3ba1..96bb079c8ea 100644 --- a/pyanaconda/modules/storage/devicetree/handler_interface.py +++ b/pyanaconda/modules/storage/devicetree/handler_interface.py @@ -18,8 +18,9 @@ # Red Hat, Inc. # from dasbus.server.interface import dbus_interface -from pyanaconda.modules.common.base.base_template import InterfaceTemplate from dasbus.typing import * # pylint: disable=wildcard-import + +from pyanaconda.modules.common.base.base_template import InterfaceTemplate from pyanaconda.modules.common.constants.interfaces import DEVICE_TREE_HANDLER from pyanaconda.modules.common.containers import TaskContainer diff --git a/pyanaconda/modules/storage/devicetree/model.py b/pyanaconda/modules/storage/devicetree/model.py index b82bfd1f6b7..01aa58148eb 100644 --- a/pyanaconda/modules/storage/devicetree/model.py +++ b/pyanaconda/modules/storage/devicetree/model.py @@ -17,28 +17,31 @@ # # Red Hat Author(s): David Lehman # +import logging import os from blivet.blivet import Blivet -from blivet.flags import flags as blivet_flags +from blivet.devicelibs.crypto import DEFAULT_LUKS_VERSION from blivet.devices import BTRFSSubVolumeDevice +from blivet.flags import flags as blivet_flags from blivet.formats import get_format from blivet.formats.disklabel import DiskLabel from blivet.size import Size -from blivet.devicelibs.crypto import DEFAULT_LUKS_VERSION -from pyanaconda.modules.storage.bootloader import BootLoaderFactory from pyanaconda.core.configuration.anaconda import conf from pyanaconda.core.constants import DRACUT_REPO_DIR, LIVE_MOUNT_POINT from pyanaconda.core.path import set_system_root from pyanaconda.core.product import get_product_short_name +from pyanaconda.modules.common.constants.services import NETWORK +from pyanaconda.modules.storage.bootloader import BootLoaderFactory from pyanaconda.modules.storage.devicetree.fsset import FSSet -from pyanaconda.modules.storage.devicetree.utils import download_escrow_certificate, \ - find_backing_device, find_stage2_device from pyanaconda.modules.storage.devicetree.root import find_existing_installations -from pyanaconda.modules.common.constants.services import NETWORK +from pyanaconda.modules.storage.devicetree.utils import ( + download_escrow_certificate, + find_backing_device, + find_stage2_device, +) -import logging log = logging.getLogger("anaconda.storage") __all__ = ["create_storage"] diff --git a/pyanaconda/modules/storage/devicetree/rescue.py b/pyanaconda/modules/storage/devicetree/rescue.py index 2400c40d8ef..3b8d544ac62 100644 --- a/pyanaconda/modules/storage/devicetree/rescue.py +++ b/pyanaconda/modules/storage/devicetree/rescue.py @@ -21,8 +21,11 @@ from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.modules.common.errors.storage import MountFilesystemError -from pyanaconda.modules.storage.devicetree.root import find_existing_installations, mount_existing_system from pyanaconda.modules.common.task import Task +from pyanaconda.modules.storage.devicetree.root import ( + find_existing_installations, + mount_existing_system, +) log = get_module_logger(__name__) diff --git a/pyanaconda/modules/storage/devicetree/root.py b/pyanaconda/modules/storage/devicetree/root.py index 9ac073da80c..37138849219 100644 --- a/pyanaconda/modules/storage/devicetree/root.py +++ b/pyanaconda/modules/storage/devicetree/root.py @@ -23,12 +23,12 @@ from blivet.errors import StorageError from blivet.storage_log import log_exception_info +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.configuration.anaconda import conf from pyanaconda.core.i18n import _ from pyanaconda.core.path import set_system_root from pyanaconda.modules.storage.devicetree.fsset import BlkidTab, CryptTab -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) __all__ = ["Root", "find_existing_installations", "mount_existing_system"] diff --git a/pyanaconda/modules/storage/devicetree/utils.py b/pyanaconda/modules/storage/devicetree/utils.py index e279ea8fd4e..f8e99aa9cda 100644 --- a/pyanaconda/modules/storage/devicetree/utils.py +++ b/pyanaconda/modules/storage/devicetree/utils.py @@ -16,20 +16,20 @@ # Red Hat, Inc. # import time -import requests +import requests from blivet import udev from blivet.errors import StorageError from blivet.formats import device_formats, get_format from blivet.formats.fs import FS -from bytesize.bytesize import MiB, ROUND_UP +from bytesize.bytesize import ROUND_UP, MiB +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core import util from pyanaconda.core.i18n import _ from pyanaconda.core.kernel import kernel_arguments from pyanaconda.core.payload import parse_hdd_url from pyanaconda.modules.common.constants.services import NETWORK -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) diff --git a/pyanaconda/modules/storage/devicetree/viewer.py b/pyanaconda/modules/storage/devicetree/viewer.py index f1ca031c64a..636fafabf8a 100644 --- a/pyanaconda/modules/storage/devicetree/viewer.py +++ b/pyanaconda/modules/storage/devicetree/viewer.py @@ -17,23 +17,33 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from abc import abstractmethod, ABC +from abc import ABC, abstractmethod from functools import partial -from blivet.formats import get_format from blivet.devices import PartitionDevice +from blivet.formats import get_format from blivet.size import Size from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.i18n import _ from pyanaconda.modules.common.errors.storage import UnknownDeviceError -from pyanaconda.modules.common.structures.storage import DeviceData, DeviceActionData, \ - DeviceFormatData, OSData, MountPointConstraintsData -from pyanaconda.modules.storage.devicetree.utils import get_required_device_size, \ - get_supported_filesystems -from pyanaconda.modules.storage.platform import platform -from pyanaconda.modules.storage.constants import EFI_PARTITION_TYPE, WINDOWS_PARTITION_TYPES +from pyanaconda.modules.common.structures.storage import ( + DeviceActionData, + DeviceData, + DeviceFormatData, + MountPointConstraintsData, + OSData, +) +from pyanaconda.modules.storage.constants import ( + EFI_PARTITION_TYPE, + WINDOWS_PARTITION_TYPES, +) +from pyanaconda.modules.storage.devicetree.utils import ( + get_required_device_size, + get_supported_filesystems, +) from pyanaconda.modules.storage.partitioning.specification import PartSpec +from pyanaconda.modules.storage.platform import platform log = get_module_logger(__name__) diff --git a/pyanaconda/modules/storage/devicetree/viewer_interface.py b/pyanaconda/modules/storage/devicetree/viewer_interface.py index 7c7126a9a60..c0bf33c0709 100644 --- a/pyanaconda/modules/storage/devicetree/viewer_interface.py +++ b/pyanaconda/modules/storage/devicetree/viewer_interface.py @@ -18,11 +18,17 @@ # Red Hat, Inc. # from dasbus.server.interface import dbus_interface -from pyanaconda.modules.common.base.base_template import InterfaceTemplate from dasbus.typing import * # pylint: disable=wildcard-import + +from pyanaconda.modules.common.base.base_template import InterfaceTemplate from pyanaconda.modules.common.constants.interfaces import DEVICE_TREE_VIEWER -from pyanaconda.modules.common.structures.storage import DeviceData, DeviceActionData, \ - DeviceFormatData, OSData, MountPointConstraintsData +from pyanaconda.modules.common.structures.storage import ( + DeviceActionData, + DeviceData, + DeviceFormatData, + MountPointConstraintsData, + OSData, +) __all__ = ["DeviceTreeViewerInterface"] diff --git a/pyanaconda/modules/storage/disk_initialization/__init__.py b/pyanaconda/modules/storage/disk_initialization/__init__.py index 40bf21b8ae7..f1d59fc6fe4 100644 --- a/pyanaconda/modules/storage/disk_initialization/__init__.py +++ b/pyanaconda/modules/storage/disk_initialization/__init__.py @@ -15,7 +15,11 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from pyanaconda.modules.storage.disk_initialization.configuration import DiskInitializationConfig -from pyanaconda.modules.storage.disk_initialization.initialization import DiskInitializationModule +from pyanaconda.modules.storage.disk_initialization.configuration import ( + DiskInitializationConfig, +) +from pyanaconda.modules.storage.disk_initialization.initialization import ( + DiskInitializationModule, +) __all__ = ["DiskInitializationConfig", "DiskInitializationModule"] diff --git a/pyanaconda/modules/storage/disk_initialization/configuration.py b/pyanaconda/modules/storage/disk_initialization/configuration.py index eca15111401..90b57f6efd1 100644 --- a/pyanaconda/modules/storage/disk_initialization/configuration.py +++ b/pyanaconda/modules/storage/disk_initialization/configuration.py @@ -21,8 +21,13 @@ from blivet.devices import PartitionDevice from pyanaconda.anaconda_loggers import get_module_logger -from pyanaconda.core.constants import CLEAR_PARTITIONS_DEFAULT, CLEAR_PARTITIONS_NONE, \ - CLEAR_PARTITIONS_LINUX, CLEAR_PARTITIONS_ALL, CLEAR_PARTITIONS_LIST +from pyanaconda.core.constants import ( + CLEAR_PARTITIONS_ALL, + CLEAR_PARTITIONS_DEFAULT, + CLEAR_PARTITIONS_LINUX, + CLEAR_PARTITIONS_LIST, + CLEAR_PARTITIONS_NONE, +) log = get_module_logger(__name__) diff --git a/pyanaconda/modules/storage/disk_initialization/initialization.py b/pyanaconda/modules/storage/disk_initialization/initialization.py index 766aa605fd4..ca75f7da715 100644 --- a/pyanaconda/modules/storage/disk_initialization/initialization.py +++ b/pyanaconda/modules/storage/disk_initialization/initialization.py @@ -17,18 +17,23 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from pykickstart.constants import CLEARPART_TYPE_ALL, CLEARPART_TYPE_NONE, CLEARPART_TYPE_LIST, \ - CLEARPART_TYPE_LINUX +from pykickstart.constants import ( + CLEARPART_TYPE_ALL, + CLEARPART_TYPE_LINUX, + CLEARPART_TYPE_LIST, + CLEARPART_TYPE_NONE, +) -from pyanaconda.core.signal import Signal +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.dbus import DBus +from pyanaconda.core.signal import Signal from pyanaconda.modules.common.constants.objects import DISK_INITIALIZATION from pyanaconda.modules.storage.constants import InitializationMode -from pyanaconda.modules.storage.disk_initialization.initialization_interface import \ - DiskInitializationInterface +from pyanaconda.modules.storage.disk_initialization.initialization_interface import ( + DiskInitializationInterface, +) from pyanaconda.modules.storage.storage_subscriber import StorageSubscriberModule -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) diff --git a/pyanaconda/modules/storage/disk_initialization/initialization_interface.py b/pyanaconda/modules/storage/disk_initialization/initialization_interface.py index 4f47be1b016..a268378eb96 100644 --- a/pyanaconda/modules/storage/disk_initialization/initialization_interface.py +++ b/pyanaconda/modules/storage/disk_initialization/initialization_interface.py @@ -20,6 +20,7 @@ from dasbus.server.interface import dbus_interface from dasbus.server.property import emits_properties_changed from dasbus.typing import * # pylint: disable=wildcard-import + from pyanaconda.modules.common.base import KickstartModuleInterfaceTemplate from pyanaconda.modules.common.constants.objects import DISK_INITIALIZATION from pyanaconda.modules.storage.constants import InitializationMode diff --git a/pyanaconda/modules/storage/disk_selection/selection.py b/pyanaconda/modules/storage/disk_selection/selection.py index 64e1997da3b..ea9dff5bdb6 100644 --- a/pyanaconda/modules/storage/disk_selection/selection.py +++ b/pyanaconda/modules/storage/disk_selection/selection.py @@ -18,11 +18,13 @@ # Red Hat, Inc. # from pyanaconda.anaconda_loggers import get_module_logger -from pyanaconda.core.signal import Signal from pyanaconda.core.dbus import DBus +from pyanaconda.core.signal import Signal from pyanaconda.modules.common.constants.objects import DISK_SELECTION from pyanaconda.modules.common.structures.validation import ValidationReport -from pyanaconda.modules.storage.disk_selection.selection_interface import DiskSelectionInterface +from pyanaconda.modules.storage.disk_selection.selection_interface import ( + DiskSelectionInterface, +) from pyanaconda.modules.storage.disk_selection.utils import check_disk_selection from pyanaconda.modules.storage.storage_subscriber import StorageSubscriberModule diff --git a/pyanaconda/modules/storage/disk_selection/selection_interface.py b/pyanaconda/modules/storage/disk_selection/selection_interface.py index c3c9f1e7aa9..acb45d52b10 100644 --- a/pyanaconda/modules/storage/disk_selection/selection_interface.py +++ b/pyanaconda/modules/storage/disk_selection/selection_interface.py @@ -20,6 +20,7 @@ from dasbus.server.interface import dbus_interface from dasbus.server.property import emits_properties_changed from dasbus.typing import * # pylint: disable=wildcard-import + from pyanaconda.modules.common.base import KickstartModuleInterfaceTemplate from pyanaconda.modules.common.constants.objects import DISK_SELECTION from pyanaconda.modules.common.structures.validation import ValidationReport diff --git a/pyanaconda/modules/storage/disk_selection/utils.py b/pyanaconda/modules/storage/disk_selection/utils.py index 4a7f801f11b..0b9f842b72c 100644 --- a/pyanaconda/modules/storage/disk_selection/utils.py +++ b/pyanaconda/modules/storage/disk_selection/utils.py @@ -15,7 +15,7 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from pyanaconda.core.i18n import _, P_ +from pyanaconda.core.i18n import P_, _ def check_disk_selection(storage, selected_disks): diff --git a/pyanaconda/modules/storage/fcoe/discover.py b/pyanaconda/modules/storage/fcoe/discover.py index 3fdbaf7ef42..44cd6e7463b 100644 --- a/pyanaconda/modules/storage/fcoe/discover.py +++ b/pyanaconda/modules/storage/fcoe/discover.py @@ -18,8 +18,9 @@ # Red Hat, Inc. # from blivet.fcoe import fcoe -from pyanaconda.modules.common.task import Task + from pyanaconda.modules.common.errors.configuration import StorageDiscoveryError +from pyanaconda.modules.common.task import Task class FCOEDiscoverTask(Task): diff --git a/pyanaconda/modules/storage/fcoe/fcoe.py b/pyanaconda/modules/storage/fcoe/fcoe.py index 27158fec55b..2bcf0ef127e 100644 --- a/pyanaconda/modules/storage/fcoe/fcoe.py +++ b/pyanaconda/modules/storage/fcoe/fcoe.py @@ -17,12 +17,12 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from blivet.fcoe import has_fcoe, fcoe +from blivet.fcoe import fcoe, has_fcoe +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.configuration.anaconda import conf from pyanaconda.core.dbus import DBus from pyanaconda.modules.common.base import KickstartBaseModule -from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.modules.common.constants.objects import FCOE from pyanaconda.modules.storage.fcoe.discover import FCOEDiscoverTask from pyanaconda.modules.storage.fcoe.fcoe_interface import FCOEInterface diff --git a/pyanaconda/modules/storage/fcoe/fcoe_interface.py b/pyanaconda/modules/storage/fcoe/fcoe_interface.py index 0ca61a78c49..ba55099c3bf 100644 --- a/pyanaconda/modules/storage/fcoe/fcoe_interface.py +++ b/pyanaconda/modules/storage/fcoe/fcoe_interface.py @@ -19,6 +19,7 @@ # from dasbus.server.interface import dbus_interface from dasbus.typing import * # pylint: disable=wildcard-import + from pyanaconda.modules.common.base import KickstartModuleInterfaceTemplate from pyanaconda.modules.common.constants.objects import FCOE from pyanaconda.modules.common.containers import TaskContainer diff --git a/pyanaconda/modules/storage/initialization.py b/pyanaconda/modules/storage/initialization.py index 312302aa7df..595f379dcda 100644 --- a/pyanaconda/modules/storage/initialization.py +++ b/pyanaconda/modules/storage/initialization.py @@ -15,8 +15,8 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from blivet import blockdev -from blivet import util as blivet_util, udev, arch +from blivet import arch, blockdev, udev +from blivet import util as blivet_util from blivet.devicelibs import crypto from blivet.flags import flags as blivet_flags from blivet.formats import get_device_format_class diff --git a/pyanaconda/modules/storage/installation.py b/pyanaconda/modules/storage/installation.py index 9889589e7a8..61200b22d96 100644 --- a/pyanaconda/modules/storage/installation.py +++ b/pyanaconda/modules/storage/installation.py @@ -20,22 +20,23 @@ import itertools import os import shutil -import parted - from datetime import timedelta from time import sleep -from blivet import callbacks as blivet_callbacks, util as blivet_util, arch, blockdev -from blivet.errors import FSResizeError, FormatResizeError, StorageError -from blivet.util import get_current_entropy +import parted +from blivet import arch, blockdev +from blivet import callbacks as blivet_callbacks +from blivet import util as blivet_util from blivet.devicelibs.lvm import HAVE_LVMDEVICES +from blivet.errors import FormatResizeError, FSResizeError, StorageError +from blivet.util import get_current_entropy from pyanaconda.anaconda_loggers import get_module_logger +from pyanaconda.core.configuration.anaconda import conf from pyanaconda.core.i18n import _ -from pyanaconda.core.util import join_paths, execWithRedirect from pyanaconda.core.path import make_directories -from pyanaconda.core.configuration.anaconda import conf -from pyanaconda.modules.common.constants.objects import ISCSI, FCOE, NVME +from pyanaconda.core.util import execWithRedirect, join_paths +from pyanaconda.modules.common.constants.objects import FCOE, ISCSI, NVME from pyanaconda.modules.common.constants.services import STORAGE from pyanaconda.modules.common.errors.installation import StorageInstallationError from pyanaconda.modules.common.task import Task diff --git a/pyanaconda/modules/storage/iscsi/discover.py b/pyanaconda/modules/storage/iscsi/discover.py index 6f62f4e516f..844f5f92628 100644 --- a/pyanaconda/modules/storage/iscsi/discover.py +++ b/pyanaconda/modules/storage/iscsi/discover.py @@ -17,15 +17,15 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from blivet.iscsi import iscsi, TargetInfo +from blivet.iscsi import TargetInfo, iscsi from blivet.safe_dbus import SafeDBusError from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.modules.common.constants.services import NETWORK -from pyanaconda.modules.storage.constants import IscsiInterfacesMode from pyanaconda.modules.common.errors.configuration import StorageDiscoveryError -from pyanaconda.modules.common.structures.iscsi import Portal, Credentials, Node +from pyanaconda.modules.common.structures.iscsi import Credentials, Node, Portal from pyanaconda.modules.common.task import Task +from pyanaconda.modules.storage.constants import IscsiInterfacesMode from pyanaconda.modules.storage.iscsi.iscsi_interface import ISCSIDiscoverTaskInterface log = get_module_logger(__name__) diff --git a/pyanaconda/modules/storage/iscsi/iscsi.py b/pyanaconda/modules/storage/iscsi/iscsi.py index 10c676e133b..bd9a848a3a7 100644 --- a/pyanaconda/modules/storage/iscsi/iscsi.py +++ b/pyanaconda/modules/storage/iscsi/iscsi.py @@ -21,8 +21,8 @@ from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.configuration.anaconda import conf -from pyanaconda.core.signal import Signal from pyanaconda.core.dbus import DBus +from pyanaconda.core.signal import Signal from pyanaconda.modules.common.base import KickstartBaseModule from pyanaconda.modules.common.constants.objects import ISCSI from pyanaconda.modules.storage.constants import IscsiInterfacesMode diff --git a/pyanaconda/modules/storage/iscsi/iscsi_interface.py b/pyanaconda/modules/storage/iscsi/iscsi_interface.py index 23758134a57..886235976f5 100644 --- a/pyanaconda/modules/storage/iscsi/iscsi_interface.py +++ b/pyanaconda/modules/storage/iscsi/iscsi_interface.py @@ -17,15 +17,16 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from dasbus.server.interface import dbus_interface, dbus_class -from dasbus.typing import * # pylint: disable=wildcard-import +from dasbus.server.interface import dbus_class, dbus_interface from dasbus.server.property import emits_properties_changed +from dasbus.typing import * # pylint: disable=wildcard-import + from pyanaconda.modules.common.base import KickstartModuleInterfaceTemplate from pyanaconda.modules.common.constants.objects import ISCSI from pyanaconda.modules.common.containers import TaskContainer -from pyanaconda.modules.storage.constants import IscsiInterfacesMode -from pyanaconda.modules.common.structures.iscsi import Portal, Credentials, Node +from pyanaconda.modules.common.structures.iscsi import Credentials, Node, Portal from pyanaconda.modules.common.task import TaskInterface +from pyanaconda.modules.storage.constants import IscsiInterfacesMode @dbus_class diff --git a/pyanaconda/modules/storage/kickstart.py b/pyanaconda/modules/storage/kickstart.py index c252f26da03..e154c79a799 100644 --- a/pyanaconda/modules/storage/kickstart.py +++ b/pyanaconda/modules/storage/kickstart.py @@ -18,22 +18,23 @@ # Red Hat, Inc. # from blivet.fcoe import fcoe -from blivet.iscsi import iscsi -from blivet.zfcp import zfcp from blivet.formats import get_format from blivet.formats.disklabel import DiskLabel +from blivet.iscsi import iscsi +from blivet.zfcp import zfcp from pykickstart.constants import CLEARPART_TYPE_NONE from pykickstart.errors import KickstartParseError -from pyanaconda.network import get_supported_devices, wait_for_network_devices -from pyanaconda.modules.common.constants.services import NETWORK +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.constants import FIPS_PASSPHRASE_MIN_LENGTH from pyanaconda.core.i18n import _ from pyanaconda.core.kernel import kernel_arguments -from pyanaconda.core.kickstart import KickstartSpecification, commands as COMMANDS +from pyanaconda.core.kickstart import KickstartSpecification +from pyanaconda.core.kickstart import commands as COMMANDS from pyanaconda.core.storage import device_matches +from pyanaconda.modules.common.constants.services import NETWORK +from pyanaconda.network import get_supported_devices, wait_for_network_devices -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) __all__ = ["StorageKickstartSpecification"] diff --git a/pyanaconda/modules/storage/nvme/nvme.py b/pyanaconda/modules/storage/nvme/nvme.py index 5338892193d..20e187670ff 100644 --- a/pyanaconda/modules/storage/nvme/nvme.py +++ b/pyanaconda/modules/storage/nvme/nvme.py @@ -21,8 +21,8 @@ from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.configuration.anaconda import conf -from pyanaconda.core.signal import Signal from pyanaconda.core.dbus import DBus +from pyanaconda.core.signal import Signal from pyanaconda.modules.common.base import KickstartBaseModule from pyanaconda.modules.common.constants.objects import NVME from pyanaconda.modules.storage.nvme.nvme_interface import NVMEInterface diff --git a/pyanaconda/modules/storage/nvme/nvme_interface.py b/pyanaconda/modules/storage/nvme/nvme_interface.py index f64b5973819..5f5ec5efc5c 100644 --- a/pyanaconda/modules/storage/nvme/nvme_interface.py +++ b/pyanaconda/modules/storage/nvme/nvme_interface.py @@ -19,6 +19,7 @@ # from dasbus.server.interface import dbus_interface from dasbus.typing import * # pylint: disable=wildcard-import + from pyanaconda.modules.common.base import KickstartModuleInterfaceTemplate from pyanaconda.modules.common.constants.objects import NVME diff --git a/pyanaconda/modules/storage/partitioning/automatic/automatic_interface.py b/pyanaconda/modules/storage/partitioning/automatic/automatic_interface.py index a20a16fe989..c071cf1e72f 100644 --- a/pyanaconda/modules/storage/partitioning/automatic/automatic_interface.py +++ b/pyanaconda/modules/storage/partitioning/automatic/automatic_interface.py @@ -20,6 +20,7 @@ from dasbus.server.interface import dbus_interface from dasbus.server.property import emits_properties_changed from dasbus.typing import * # pylint: disable=wildcard-import + from pyanaconda.modules.common.constants.objects import AUTO_PARTITIONING from pyanaconda.modules.common.structures.partitioning import PartitioningRequest from pyanaconda.modules.storage.partitioning.base_interface import PartitioningInterface diff --git a/pyanaconda/modules/storage/partitioning/automatic/automatic_module.py b/pyanaconda/modules/storage/partitioning/automatic/automatic_module.py index 4e3c7363851..4f38a37c94d 100644 --- a/pyanaconda/modules/storage/partitioning/automatic/automatic_module.py +++ b/pyanaconda/modules/storage/partitioning/automatic/automatic_module.py @@ -23,14 +23,17 @@ from pyanaconda.core.configuration.anaconda import conf from pyanaconda.core.signal import Signal from pyanaconda.modules.common.structures.partitioning import PartitioningRequest -from pyanaconda.modules.storage.partitioning.automatic.resizable_module import \ - ResizableDeviceTreeModule +from pyanaconda.modules.storage.partitioning.automatic.automatic_interface import ( + AutoPartitioningInterface, +) +from pyanaconda.modules.storage.partitioning.automatic.automatic_partitioning import ( + AutomaticPartitioningTask, +) +from pyanaconda.modules.storage.partitioning.automatic.resizable_module import ( + ResizableDeviceTreeModule, +) from pyanaconda.modules.storage.partitioning.base import PartitioningModule -from pyanaconda.modules.storage.partitioning.automatic.automatic_interface import \ - AutoPartitioningInterface from pyanaconda.modules.storage.partitioning.constants import PartitioningMethod -from pyanaconda.modules.storage.partitioning.automatic.automatic_partitioning import \ - AutomaticPartitioningTask log = get_module_logger(__name__) diff --git a/pyanaconda/modules/storage/partitioning/automatic/automatic_partitioning.py b/pyanaconda/modules/storage/partitioning/automatic/automatic_partitioning.py index 5b12686b143..daf78548fff 100644 --- a/pyanaconda/modules/storage/partitioning/automatic/automatic_partitioning.py +++ b/pyanaconda/modules/storage/partitioning/automatic/automatic_partitioning.py @@ -15,27 +15,37 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # +from blivet.errors import StorageError from blivet.partitioning import do_partitioning, grow_lvm from blivet.static_data import luks_data -from blivet.errors import StorageError +from pykickstart.constants import ( + AUTOPART_TYPE_BTRFS, + AUTOPART_TYPE_LVM, + AUTOPART_TYPE_LVM_THINP, + AUTOPART_TYPE_PLAIN, +) from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.i18n import _ +from pyanaconda.core.storage import suggest_swap_size from pyanaconda.modules.common.structures.partitioning import PartitioningRequest -from pyanaconda.modules.storage.partitioning.automatic.noninteractive_partitioning import \ - NonInteractivePartitioningTask -from pyanaconda.modules.storage.partitioning.manual.utils import \ - reformat_device from pyanaconda.modules.storage.devicetree.root import find_existing_installations +from pyanaconda.modules.storage.partitioning.automatic.noninteractive_partitioning import ( + NonInteractivePartitioningTask, +) +from pyanaconda.modules.storage.partitioning.automatic.utils import ( + get_candidate_disks, + get_default_partitioning, + get_disks_for_implicit_partitions, + get_part_spec, + get_pbkdf_args, + schedule_implicit_partitions, + schedule_partitions, + schedule_volumes, +) from pyanaconda.modules.storage.partitioning.interactive.utils import destroy_device -from pyanaconda.modules.storage.partitioning.automatic.utils import get_candidate_disks, \ - schedule_implicit_partitions, schedule_volumes, schedule_partitions, get_pbkdf_args, \ - get_default_partitioning, get_part_spec, get_disks_for_implicit_partitions +from pyanaconda.modules.storage.partitioning.manual.utils import reformat_device from pyanaconda.modules.storage.platform import platform -from pyanaconda.core.storage import suggest_swap_size -from pykickstart.constants import AUTOPART_TYPE_BTRFS, AUTOPART_TYPE_LVM, \ - AUTOPART_TYPE_LVM_THINP, AUTOPART_TYPE_PLAIN - log = get_module_logger(__name__) diff --git a/pyanaconda/modules/storage/partitioning/automatic/noninteractive_partitioning.py b/pyanaconda/modules/storage/partitioning/automatic/noninteractive_partitioning.py index 0a042f56c01..aef7c05644d 100644 --- a/pyanaconda/modules/storage/partitioning/automatic/noninteractive_partitioning.py +++ b/pyanaconda/modules/storage/partitioning/automatic/noninteractive_partitioning.py @@ -19,12 +19,12 @@ from blivet.errors import NoDisksError from blivet.formats.disklabel import DiskLabel -from pyanaconda.anaconda_loggers import get_module_logger +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.i18n import _ -from pyanaconda.modules.storage.bootloader.execution import setup_bootloader from pyanaconda.modules.common.constants.objects import DISK_INITIALIZATION from pyanaconda.modules.common.constants.services import STORAGE +from pyanaconda.modules.storage.bootloader.execution import setup_bootloader from pyanaconda.modules.storage.disk_initialization import DiskInitializationConfig from pyanaconda.modules.storage.partitioning.base_partitioning import PartitioningTask diff --git a/pyanaconda/modules/storage/partitioning/automatic/resizable_interface.py b/pyanaconda/modules/storage/partitioning/automatic/resizable_interface.py index 6640cba41ad..9a63ccdc491 100644 --- a/pyanaconda/modules/storage/partitioning/automatic/resizable_interface.py +++ b/pyanaconda/modules/storage/partitioning/automatic/resizable_interface.py @@ -19,8 +19,11 @@ # from dasbus.server.interface import dbus_interface from dasbus.typing import * # pylint: disable=wildcard-import + from pyanaconda.modules.common.constants.interfaces import DEVICE_TREE_RESIZABLE -from pyanaconda.modules.storage.devicetree.devicetree_interface import DeviceTreeInterface +from pyanaconda.modules.storage.devicetree.devicetree_interface import ( + DeviceTreeInterface, +) __all__ = ["ResizableDeviceTreeInterface"] diff --git a/pyanaconda/modules/storage/partitioning/automatic/resizable_module.py b/pyanaconda/modules/storage/partitioning/automatic/resizable_module.py index 38706a54bc3..18f36096078 100644 --- a/pyanaconda/modules/storage/partitioning/automatic/resizable_module.py +++ b/pyanaconda/modules/storage/partitioning/automatic/resizable_module.py @@ -22,9 +22,13 @@ from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.modules.storage.devicetree import DeviceTreeModule -from pyanaconda.modules.storage.partitioning.automatic.resizable_interface import \ - ResizableDeviceTreeInterface -from pyanaconda.modules.storage.partitioning.automatic.utils import shrink_device, remove_device +from pyanaconda.modules.storage.partitioning.automatic.resizable_interface import ( + ResizableDeviceTreeInterface, +) +from pyanaconda.modules.storage.partitioning.automatic.utils import ( + remove_device, + shrink_device, +) log = get_module_logger(__name__) diff --git a/pyanaconda/modules/storage/partitioning/automatic/utils.py b/pyanaconda/modules/storage/partitioning/automatic/utils.py index 99c06f75f4c..7d6b17f86b7 100644 --- a/pyanaconda/modules/storage/partitioning/automatic/utils.py +++ b/pyanaconda/modules/storage/partitioning/automatic/utils.py @@ -18,18 +18,20 @@ # Red Hat Author(s): Dave Lehman # import parted - -from blivet.size import Size -from blivet.devices.partition import PartitionDevice, FALLBACK_DEFAULT_PART_SIZE from blivet.devices.luks import LUKSDevice from blivet.devices.lvm import DEFAULT_THPOOL_RESERVE -from blivet.errors import NotEnoughFreeSpaceError, NoDisksError +from blivet.devices.partition import FALLBACK_DEFAULT_PART_SIZE, PartitionDevice +from blivet.errors import NoDisksError, NotEnoughFreeSpaceError from blivet.formats import get_format from blivet.formats.luks import LUKS2PBKDFArgs from blivet.partitioning import get_free_regions, get_next_partition_type - -from pykickstart.constants import AUTOPART_TYPE_BTRFS, AUTOPART_TYPE_LVM, \ - AUTOPART_TYPE_LVM_THINP, AUTOPART_TYPE_PLAIN +from blivet.size import Size +from pykickstart.constants import ( + AUTOPART_TYPE_BTRFS, + AUTOPART_TYPE_LVM, + AUTOPART_TYPE_LVM_THINP, + AUTOPART_TYPE_PLAIN, +) from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.configuration.anaconda import conf diff --git a/pyanaconda/modules/storage/partitioning/base.py b/pyanaconda/modules/storage/partitioning/base.py index c8b4b95acf5..1bc4e5ab606 100644 --- a/pyanaconda/modules/storage/partitioning/base.py +++ b/pyanaconda/modules/storage/partitioning/base.py @@ -19,14 +19,20 @@ # from abc import abstractmethod -from blivet.devices import PartitionDevice, TmpFSDevice, LVMLogicalVolumeDevice, \ - LVMVolumeGroupDevice, MDRaidArrayDevice, BTRFSDevice - +from blivet.devices import ( + BTRFSDevice, + LVMLogicalVolumeDevice, + LVMVolumeGroupDevice, + MDRaidArrayDevice, + PartitionDevice, + TmpFSDevice, +) from dasbus.server.publishable import Publishable + +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.util import LazyObject from pyanaconda.modules.common.base.base import KickstartBaseModule from pyanaconda.modules.common.errors.storage import UnavailableStorageError -from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.modules.storage.devicetree import DeviceTreeModule from pyanaconda.modules.storage.partitioning.validate import StorageValidateTask diff --git a/pyanaconda/modules/storage/partitioning/base_interface.py b/pyanaconda/modules/storage/partitioning/base_interface.py index 31a7bd02c1b..a18f6f03a7c 100644 --- a/pyanaconda/modules/storage/partitioning/base_interface.py +++ b/pyanaconda/modules/storage/partitioning/base_interface.py @@ -17,9 +17,10 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from pyanaconda.modules.common.base.base_template import ModuleInterfaceTemplate from dasbus.server.interface import dbus_interface from dasbus.typing import * # pylint: disable=wildcard-import + +from pyanaconda.modules.common.base.base_template import ModuleInterfaceTemplate from pyanaconda.modules.common.constants.interfaces import PARTITIONING from pyanaconda.modules.common.containers import DeviceTreeContainer, TaskContainer diff --git a/pyanaconda/modules/storage/partitioning/base_partitioning.py b/pyanaconda/modules/storage/partitioning/base_partitioning.py index 80775a5d066..f95d5ef4ef6 100644 --- a/pyanaconda/modules/storage/partitioning/base_partitioning.py +++ b/pyanaconda/modules/storage/partitioning/base_partitioning.py @@ -15,15 +15,18 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from abc import abstractmethod, ABCMeta -from blivet.errors import StorageError, InconsistentParentSectorSize +from abc import ABCMeta, abstractmethod + +from blivet.errors import InconsistentParentSectorSize, StorageError from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.i18n import _ -from pyanaconda.modules.storage.bootloader import BootLoaderError -from pyanaconda.modules.common.errors.configuration import StorageConfigurationError, \ - BootloaderConfigurationError +from pyanaconda.modules.common.errors.configuration import ( + BootloaderConfigurationError, + StorageConfigurationError, +) from pyanaconda.modules.common.task.task import Task +from pyanaconda.modules.storage.bootloader import BootLoaderError from pyanaconda.modules.storage.constants import INCONSISTENT_SECTOR_SIZES_SUGGESTIONS log = get_module_logger(__name__) diff --git a/pyanaconda/modules/storage/partitioning/blivet/blivet_handler.py b/pyanaconda/modules/storage/partitioning/blivet/blivet_handler.py index 8b633bc413f..4b76dcd0dc2 100644 --- a/pyanaconda/modules/storage/partitioning/blivet/blivet_handler.py +++ b/pyanaconda/modules/storage/partitioning/blivet/blivet_handler.py @@ -18,6 +18,7 @@ # Red Hat, Inc. # import pickle + from pyanaconda.modules.common.errors.storage import UnsupportedPartitioningError try: diff --git a/pyanaconda/modules/storage/partitioning/blivet/blivet_interface.py b/pyanaconda/modules/storage/partitioning/blivet/blivet_interface.py index 429c6ce8e9d..3d31f037a85 100644 --- a/pyanaconda/modules/storage/partitioning/blivet/blivet_interface.py +++ b/pyanaconda/modules/storage/partitioning/blivet/blivet_interface.py @@ -20,6 +20,7 @@ from dasbus.server.interface import dbus_interface from dasbus.typing import * # pylint: disable=wildcard-import + from pyanaconda.modules.common.constants.objects import BLIVET_PARTITIONING from pyanaconda.modules.storage.partitioning.base_interface import PartitioningInterface diff --git a/pyanaconda/modules/storage/partitioning/blivet/blivet_module.py b/pyanaconda/modules/storage/partitioning/blivet/blivet_module.py index c6808811c44..386246236bc 100644 --- a/pyanaconda/modules/storage/partitioning/blivet/blivet_module.py +++ b/pyanaconda/modules/storage/partitioning/blivet/blivet_module.py @@ -17,15 +17,18 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from pyanaconda.modules.storage.disk_initialization.configuration import DiskInitializationConfig - from pyanaconda.anaconda_loggers import get_module_logger +from pyanaconda.modules.storage.disk_initialization.configuration import ( + DiskInitializationConfig, +) from pyanaconda.modules.storage.partitioning.base import PartitioningModule -from pyanaconda.modules.storage.partitioning.blivet.blivet_interface import \ - BlivetPartitioningInterface +from pyanaconda.modules.storage.partitioning.blivet.blivet_interface import ( + BlivetPartitioningInterface, +) from pyanaconda.modules.storage.partitioning.constants import PartitioningMethod -from pyanaconda.modules.storage.partitioning.interactive.interactive_partitioning import \ - InteractivePartitioningTask +from pyanaconda.modules.storage.partitioning.interactive.interactive_partitioning import ( + InteractivePartitioningTask, +) log = get_module_logger(__name__) @@ -69,8 +72,9 @@ def storage_handler(self): :raises UnsupportedPartitioningError: if the handler cannot be created """ if not self._storage_handler: - from pyanaconda.modules.storage.partitioning.blivet.blivet_handler import \ - BlivetStorageHandler + from pyanaconda.modules.storage.partitioning.blivet.blivet_handler import ( + BlivetStorageHandler, + ) self._storage_handler = BlivetStorageHandler() # Make sure that the handler always uses the current storage. @@ -85,8 +89,9 @@ def request_handler(self): :raises UnsupportedPartitioningError: if the handler cannot be created """ if not self._request_handler: - from pyanaconda.modules.storage.partitioning.blivet.blivet_handler import \ - BlivetRequestHandler + from pyanaconda.modules.storage.partitioning.blivet.blivet_handler import ( + BlivetRequestHandler, + ) self._request_handler = BlivetRequestHandler() # Make sure that the handler always uses the current storage handler. diff --git a/pyanaconda/modules/storage/partitioning/constants.py b/pyanaconda/modules/storage/partitioning/constants.py index 3d217188f28..a5ce6e611e0 100644 --- a/pyanaconda/modules/storage/partitioning/constants.py +++ b/pyanaconda/modules/storage/partitioning/constants.py @@ -19,8 +19,13 @@ # from enum import Enum -from pyanaconda.core.constants import PARTITIONING_METHOD_AUTOMATIC, PARTITIONING_METHOD_CUSTOM, \ - PARTITIONING_METHOD_MANUAL, PARTITIONING_METHOD_INTERACTIVE, PARTITIONING_METHOD_BLIVET +from pyanaconda.core.constants import ( + PARTITIONING_METHOD_AUTOMATIC, + PARTITIONING_METHOD_BLIVET, + PARTITIONING_METHOD_CUSTOM, + PARTITIONING_METHOD_INTERACTIVE, + PARTITIONING_METHOD_MANUAL, +) class PartitioningMethod(Enum): diff --git a/pyanaconda/modules/storage/partitioning/custom/custom_interface.py b/pyanaconda/modules/storage/partitioning/custom/custom_interface.py index 005eb823c13..b44ad7f801b 100644 --- a/pyanaconda/modules/storage/partitioning/custom/custom_interface.py +++ b/pyanaconda/modules/storage/partitioning/custom/custom_interface.py @@ -19,6 +19,7 @@ # from dasbus.server.interface import dbus_interface from dasbus.typing import * # pylint: disable=wildcard-import + from pyanaconda.modules.common.constants.objects import CUSTOM_PARTITIONING from pyanaconda.modules.storage.partitioning.base_interface import PartitioningInterface diff --git a/pyanaconda/modules/storage/partitioning/custom/custom_module.py b/pyanaconda/modules/storage/partitioning/custom/custom_module.py index 402a9e59565..28cc30f6407 100644 --- a/pyanaconda/modules/storage/partitioning/custom/custom_module.py +++ b/pyanaconda/modules/storage/partitioning/custom/custom_module.py @@ -21,10 +21,12 @@ from pyanaconda.modules.common.errors.storage import UnavailableDataError from pyanaconda.modules.storage.partitioning.base import PartitioningModule from pyanaconda.modules.storage.partitioning.constants import PartitioningMethod -from pyanaconda.modules.storage.partitioning.custom.custom_interface import \ - CustomPartitioningInterface -from pyanaconda.modules.storage.partitioning.custom.custom_partitioning import \ - CustomPartitioningTask +from pyanaconda.modules.storage.partitioning.custom.custom_interface import ( + CustomPartitioningInterface, +) +from pyanaconda.modules.storage.partitioning.custom.custom_partitioning import ( + CustomPartitioningTask, +) log = get_module_logger(__name__) diff --git a/pyanaconda/modules/storage/partitioning/custom/custom_partitioning.py b/pyanaconda/modules/storage/partitioning/custom/custom_partitioning.py index 4cf899c8ca9..986c427cdb6 100644 --- a/pyanaconda/modules/storage/partitioning/custom/custom_partitioning.py +++ b/pyanaconda/modules/storage/partitioning/custom/custom_partitioning.py @@ -16,8 +16,12 @@ # Red Hat, Inc. # import blivet -from blivet.deviceaction import ActionResizeFormat, ActionResizeDevice, ActionCreateFormat -from blivet.devicelibs.lvm import LVM_PE_SIZE, KNOWN_THPOOL_PROFILES +from blivet.deviceaction import ( + ActionCreateFormat, + ActionResizeDevice, + ActionResizeFormat, +) +from blivet.devicelibs.lvm import KNOWN_THPOOL_PROFILES, LVM_PE_SIZE from blivet.devices import LUKSDevice, LVMVolumeGroupDevice from blivet.devices.lvm import LVMCacheRequest from blivet.errors import StorageError @@ -31,12 +35,17 @@ from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.i18n import _ -from pyanaconda.modules.storage.partitioning.automatic.noninteractive_partitioning import \ - NonInteractivePartitioningTask -from pyanaconda.modules.storage.partitioning.automatic.utils import get_candidate_disks, \ - schedule_partitions, get_pbkdf_args, lookup_alias -from pyanaconda.modules.storage.platform import platform from pyanaconda.core.storage import suggest_swap_size +from pyanaconda.modules.storage.partitioning.automatic.noninteractive_partitioning import ( + NonInteractivePartitioningTask, +) +from pyanaconda.modules.storage.partitioning.automatic.utils import ( + get_candidate_disks, + get_pbkdf_args, + lookup_alias, + schedule_partitions, +) +from pyanaconda.modules.storage.platform import platform log = get_module_logger(__name__) diff --git a/pyanaconda/modules/storage/partitioning/factory.py b/pyanaconda/modules/storage/partitioning/factory.py index 74c19d3855c..8435ee998e1 100644 --- a/pyanaconda/modules/storage/partitioning/factory.py +++ b/pyanaconda/modules/storage/partitioning/factory.py @@ -33,28 +33,33 @@ def create_partitioning(method: PartitioningMethod): :return: a partitioning module """ if method is PartitioningMethod.AUTOMATIC: - from pyanaconda.modules.storage.partitioning.automatic.automatic_module import \ - AutoPartitioningModule + from pyanaconda.modules.storage.partitioning.automatic.automatic_module import ( + AutoPartitioningModule, + ) return AutoPartitioningModule() if method is PartitioningMethod.MANUAL: - from pyanaconda.modules.storage.partitioning.manual.manual_module import \ - ManualPartitioningModule + from pyanaconda.modules.storage.partitioning.manual.manual_module import ( + ManualPartitioningModule, + ) return ManualPartitioningModule() if method is PartitioningMethod.CUSTOM: - from pyanaconda.modules.storage.partitioning.custom.custom_module import \ - CustomPartitioningModule + from pyanaconda.modules.storage.partitioning.custom.custom_module import ( + CustomPartitioningModule, + ) return CustomPartitioningModule() if method is PartitioningMethod.INTERACTIVE: - from pyanaconda.modules.storage.partitioning.interactive.interactive_module import \ - InteractivePartitioningModule + from pyanaconda.modules.storage.partitioning.interactive.interactive_module import ( + InteractivePartitioningModule, + ) return InteractivePartitioningModule() if method is PartitioningMethod.BLIVET: - from pyanaconda.modules.storage.partitioning.blivet.blivet_module import \ - BlivetPartitioningModule + from pyanaconda.modules.storage.partitioning.blivet.blivet_module import ( + BlivetPartitioningModule, + ) return BlivetPartitioningModule() raise ValueError("Unknown partitioning method: {}".format(method)) diff --git a/pyanaconda/modules/storage/partitioning/interactive/add_device.py b/pyanaconda/modules/storage/partitioning/interactive/add_device.py index 8211ec15051..2ebdc29de92 100644 --- a/pyanaconda/modules/storage/partitioning/interactive/add_device.py +++ b/pyanaconda/modules/storage/partitioning/interactive/add_device.py @@ -16,18 +16,22 @@ # Red Hat, Inc. # from blivet import devicefactory -from blivet.errors import StorageError, InconsistentParentSectorSize +from blivet.errors import InconsistentParentSectorSize, StorageError from blivet.size import Size + from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.i18n import _ +from pyanaconda.core.storage import PARTITION_ONLY_FORMAT_TYPES from pyanaconda.core.string import lower_ascii from pyanaconda.modules.common.errors.configuration import StorageConfigurationError from pyanaconda.modules.common.structures.device_factory import DeviceFactoryRequest from pyanaconda.modules.common.task import Task from pyanaconda.modules.storage.constants import INCONSISTENT_SECTOR_SIZES_SUGGESTIONS -from pyanaconda.modules.storage.partitioning.interactive.utils import \ - get_container_raid_level_name, get_container_size_policy, get_device_factory_arguments -from pyanaconda.core.storage import PARTITION_ONLY_FORMAT_TYPES +from pyanaconda.modules.storage.partitioning.interactive.utils import ( + get_container_raid_level_name, + get_container_size_policy, + get_device_factory_arguments, +) log = get_module_logger(__name__) diff --git a/pyanaconda/modules/storage/partitioning/interactive/change_device.py b/pyanaconda/modules/storage/partitioning/interactive/change_device.py index a16928193e1..60c91435eb4 100644 --- a/pyanaconda/modules/storage/partitioning/interactive/change_device.py +++ b/pyanaconda/modules/storage/partitioning/interactive/change_device.py @@ -15,9 +15,8 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from blivet.errors import StorageError, InconsistentParentSectorSize +from blivet.errors import InconsistentParentSectorSize, StorageError from blivet.size import Size - from dasbus.structure import compare_data from pyanaconda.anaconda_loggers import get_module_logger @@ -26,9 +25,16 @@ from pyanaconda.modules.common.structures.device_factory import DeviceFactoryRequest from pyanaconda.modules.common.task import Task from pyanaconda.modules.storage.constants import INCONSISTENT_SECTOR_SIZES_SUGGESTIONS -from pyanaconda.modules.storage.partitioning.interactive.utils import destroy_device, \ - get_device_factory_arguments, revert_reformat, resize_device, reformat_device, \ - validate_label, change_encryption, rename_container +from pyanaconda.modules.storage.partitioning.interactive.utils import ( + change_encryption, + destroy_device, + get_device_factory_arguments, + reformat_device, + rename_container, + resize_device, + revert_reformat, + validate_label, +) log = get_module_logger(__name__) diff --git a/pyanaconda/modules/storage/partitioning/interactive/interactive_interface.py b/pyanaconda/modules/storage/partitioning/interactive/interactive_interface.py index d2a3426f52f..9f33ab5ca44 100644 --- a/pyanaconda/modules/storage/partitioning/interactive/interactive_interface.py +++ b/pyanaconda/modules/storage/partitioning/interactive/interactive_interface.py @@ -18,6 +18,7 @@ # Red Hat, Inc. # from dasbus.server.interface import dbus_interface + from pyanaconda.modules.common.constants.objects import INTERACTIVE_PARTITIONING from pyanaconda.modules.storage.partitioning.base_interface import PartitioningInterface diff --git a/pyanaconda/modules/storage/partitioning/interactive/interactive_module.py b/pyanaconda/modules/storage/partitioning/interactive/interactive_module.py index b27d9fa9330..8b4bb1a03de 100644 --- a/pyanaconda/modules/storage/partitioning/interactive/interactive_module.py +++ b/pyanaconda/modules/storage/partitioning/interactive/interactive_module.py @@ -17,17 +17,21 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from pyanaconda.modules.storage.disk_initialization.configuration import DiskInitializationConfig - from pyanaconda.anaconda_loggers import get_module_logger +from pyanaconda.modules.storage.disk_initialization.configuration import ( + DiskInitializationConfig, +) from pyanaconda.modules.storage.partitioning.base import PartitioningModule from pyanaconda.modules.storage.partitioning.constants import PartitioningMethod -from pyanaconda.modules.storage.partitioning.interactive.interactive_interface import \ - InteractivePartitioningInterface -from pyanaconda.modules.storage.partitioning.interactive.interactive_partitioning import \ - InteractivePartitioningTask -from pyanaconda.modules.storage.partitioning.interactive.scheduler_module import \ - DeviceTreeSchedulerModule +from pyanaconda.modules.storage.partitioning.interactive.interactive_interface import ( + InteractivePartitioningInterface, +) +from pyanaconda.modules.storage.partitioning.interactive.interactive_partitioning import ( + InteractivePartitioningTask, +) +from pyanaconda.modules.storage.partitioning.interactive.scheduler_module import ( + DeviceTreeSchedulerModule, +) log = get_module_logger(__name__) diff --git a/pyanaconda/modules/storage/partitioning/interactive/interactive_partitioning.py b/pyanaconda/modules/storage/partitioning/interactive/interactive_partitioning.py index 13b8e6e4faa..60d0ac0af75 100644 --- a/pyanaconda/modules/storage/partitioning/interactive/interactive_partitioning.py +++ b/pyanaconda/modules/storage/partitioning/interactive/interactive_partitioning.py @@ -20,10 +20,14 @@ from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.modules.storage.bootloader.execution import setup_bootloader -from pyanaconda.modules.storage.partitioning.automatic.automatic_partitioning import \ - AutomaticPartitioningTask +from pyanaconda.modules.storage.checker.utils import ( + storage_checker, + verify_luks_devices_have_key, +) +from pyanaconda.modules.storage.partitioning.automatic.automatic_partitioning import ( + AutomaticPartitioningTask, +) from pyanaconda.modules.storage.partitioning.base_partitioning import PartitioningTask -from pyanaconda.modules.storage.checker.utils import storage_checker, verify_luks_devices_have_key log = get_module_logger(__name__) diff --git a/pyanaconda/modules/storage/partitioning/interactive/scheduler_interface.py b/pyanaconda/modules/storage/partitioning/interactive/scheduler_interface.py index a0414a94ff3..91d89ee6452 100644 --- a/pyanaconda/modules/storage/partitioning/interactive/scheduler_interface.py +++ b/pyanaconda/modules/storage/partitioning/interactive/scheduler_interface.py @@ -19,14 +19,19 @@ # from dasbus.server.interface import dbus_interface from dasbus.typing import * # pylint: disable=wildcard-import + from pyanaconda.modules.common.constants.interfaces import DEVICE_TREE_SCHEDULER from pyanaconda.modules.common.containers import TaskContainer -from pyanaconda.modules.common.structures.device_factory import DeviceFactoryRequest, \ - DeviceFactoryPermissions +from pyanaconda.modules.common.structures.device_factory import ( + DeviceFactoryPermissions, + DeviceFactoryRequest, +) from pyanaconda.modules.common.structures.partitioning import PartitioningRequest from pyanaconda.modules.common.structures.storage import OSData from pyanaconda.modules.common.structures.validation import ValidationReport -from pyanaconda.modules.storage.devicetree.devicetree_interface import DeviceTreeInterface +from pyanaconda.modules.storage.devicetree.devicetree_interface import ( + DeviceTreeInterface, +) __all__ = ["DeviceTreeSchedulerInterface"] diff --git a/pyanaconda/modules/storage/partitioning/interactive/scheduler_module.py b/pyanaconda/modules/storage/partitioning/interactive/scheduler_module.py index 6a92bf93238..166bb0f1a1f 100644 --- a/pyanaconda/modules/storage/partitioning/interactive/scheduler_module.py +++ b/pyanaconda/modules/storage/partitioning/interactive/scheduler_module.py @@ -23,13 +23,17 @@ from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.modules.common.structures.validation import ValidationReport from pyanaconda.modules.storage.devicetree import DeviceTreeModule -from pyanaconda.modules.storage.partitioning.interactive.add_device import AddDeviceTask -from pyanaconda.modules.storage.partitioning.interactive.change_device import ChangeDeviceTask -from pyanaconda.modules.storage.partitioning.interactive.interactive_partitioning import \ - InteractiveAutoPartitioningTask -from pyanaconda.modules.storage.partitioning.interactive.scheduler_interface import \ - DeviceTreeSchedulerInterface from pyanaconda.modules.storage.partitioning.interactive import utils +from pyanaconda.modules.storage.partitioning.interactive.add_device import AddDeviceTask +from pyanaconda.modules.storage.partitioning.interactive.change_device import ( + ChangeDeviceTask, +) +from pyanaconda.modules.storage.partitioning.interactive.interactive_partitioning import ( + InteractiveAutoPartitioningTask, +) +from pyanaconda.modules.storage.partitioning.interactive.scheduler_interface import ( + DeviceTreeSchedulerInterface, +) log = get_module_logger(__name__) diff --git a/pyanaconda/modules/storage/partitioning/interactive/utils.py b/pyanaconda/modules/storage/partitioning/interactive/utils.py index f4f1c24cde0..dd661f85b71 100644 --- a/pyanaconda/modules/storage/partitioning/interactive/utils.py +++ b/pyanaconda/modules/storage/partitioning/interactive/utils.py @@ -22,25 +22,37 @@ from blivet import devicefactory from blivet.devicelibs import crypto, raid -from blivet.devices import LUKSDevice, MDRaidArrayDevice, LVMVolumeGroupDevice +from blivet.devices import LUKSDevice, LVMVolumeGroupDevice, MDRaidArrayDevice from blivet.errors import StorageError from blivet.formats import get_format from blivet.size import Size from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.i18n import _ -from pyanaconda.modules.common.errors.configuration import StorageConfigurationError -from pyanaconda.modules.common.errors.storage import UnsupportedDeviceError, UnknownDeviceError -from pyanaconda.modules.common.structures.device_factory import DeviceFactoryRequest, \ - DeviceFactoryPermissions -from pyanaconda.modules.storage.disk_initialization import DiskInitializationConfig -from pyanaconda.modules.storage.platform import platform, PLATFORM_MOUNT_POINTS from pyanaconda.core.product import get_product_name, get_product_version +from pyanaconda.core.storage import ( + CONTAINER_DEVICE_TYPES, + DEVICE_TEXT_MAP, + NAMED_DEVICE_TYPES, + PARTITION_ONLY_FORMAT_TYPES, + SUPPORTED_DEVICE_TYPES, +) +from pyanaconda.modules.common.errors.configuration import StorageConfigurationError +from pyanaconda.modules.common.errors.storage import ( + UnknownDeviceError, + UnsupportedDeviceError, +) +from pyanaconda.modules.common.structures.device_factory import ( + DeviceFactoryPermissions, + DeviceFactoryRequest, +) from pyanaconda.modules.storage.devicetree.root import Root -from pyanaconda.modules.storage.devicetree.utils import get_supported_filesystems, \ - is_supported_filesystem -from pyanaconda.core.storage import DEVICE_TEXT_MAP, PARTITION_ONLY_FORMAT_TYPES, \ - NAMED_DEVICE_TYPES, CONTAINER_DEVICE_TYPES, SUPPORTED_DEVICE_TYPES +from pyanaconda.modules.storage.devicetree.utils import ( + get_supported_filesystems, + is_supported_filesystem, +) +from pyanaconda.modules.storage.disk_initialization import DiskInitializationConfig +from pyanaconda.modules.storage.platform import PLATFORM_MOUNT_POINTS, platform log = get_module_logger(__name__) diff --git a/pyanaconda/modules/storage/partitioning/manual/manual_interface.py b/pyanaconda/modules/storage/partitioning/manual/manual_interface.py index 4a93dcb0b9e..c54883aaa7b 100644 --- a/pyanaconda/modules/storage/partitioning/manual/manual_interface.py +++ b/pyanaconda/modules/storage/partitioning/manual/manual_interface.py @@ -20,6 +20,7 @@ from dasbus.server.interface import dbus_interface from dasbus.server.property import emits_properties_changed from dasbus.typing import * # pylint: disable=wildcard-import + from pyanaconda.modules.common.constants.objects import MANUAL_PARTITIONING from pyanaconda.modules.common.structures.partitioning import MountPointRequest from pyanaconda.modules.storage.partitioning.base_interface import PartitioningInterface diff --git a/pyanaconda/modules/storage/partitioning/manual/manual_module.py b/pyanaconda/modules/storage/partitioning/manual/manual_module.py index d878aeed370..d9e559a9044 100644 --- a/pyanaconda/modules/storage/partitioning/manual/manual_module.py +++ b/pyanaconda/modules/storage/partitioning/manual/manual_module.py @@ -24,10 +24,12 @@ from pyanaconda.modules.common.structures.partitioning import MountPointRequest from pyanaconda.modules.storage.partitioning.base import PartitioningModule from pyanaconda.modules.storage.partitioning.constants import PartitioningMethod -from pyanaconda.modules.storage.partitioning.manual.manual_interface import \ - ManualPartitioningInterface -from pyanaconda.modules.storage.partitioning.manual.manual_partitioning import \ - ManualPartitioningTask +from pyanaconda.modules.storage.partitioning.manual.manual_interface import ( + ManualPartitioningInterface, +) +from pyanaconda.modules.storage.partitioning.manual.manual_partitioning import ( + ManualPartitioningTask, +) log = get_module_logger(__name__) diff --git a/pyanaconda/modules/storage/partitioning/manual/manual_partitioning.py b/pyanaconda/modules/storage/partitioning/manual/manual_partitioning.py index 5f7e94e4dc0..f60f64bacf1 100644 --- a/pyanaconda/modules/storage/partitioning/manual/manual_partitioning.py +++ b/pyanaconda/modules/storage/partitioning/manual/manual_partitioning.py @@ -19,8 +19,9 @@ from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.i18n import _ -from pyanaconda.modules.storage.partitioning.automatic.noninteractive_partitioning import \ - NonInteractivePartitioningTask +from pyanaconda.modules.storage.partitioning.automatic.noninteractive_partitioning import ( + NonInteractivePartitioningTask, +) from pyanaconda.modules.storage.partitioning.manual.utils import reformat_device log = get_module_logger(__name__) diff --git a/pyanaconda/modules/storage/partitioning/specification.py b/pyanaconda/modules/storage/partitioning/specification.py index 1d7d0973ecc..5aa8f0de64c 100644 --- a/pyanaconda/modules/storage/partitioning/specification.py +++ b/pyanaconda/modules/storage/partitioning/specification.py @@ -18,8 +18,12 @@ # Red Hat Author(s): Chris Lumens # -from pykickstart.constants import AUTOPART_TYPE_PLAIN, AUTOPART_TYPE_BTRFS, AUTOPART_TYPE_LVM, \ - AUTOPART_TYPE_LVM_THINP +from pykickstart.constants import ( + AUTOPART_TYPE_BTRFS, + AUTOPART_TYPE_LVM, + AUTOPART_TYPE_LVM_THINP, + AUTOPART_TYPE_PLAIN, +) class PartSpec: diff --git a/pyanaconda/modules/storage/platform.py b/pyanaconda/modules/storage/platform.py index c1f76ea9b52..ff9ff692686 100644 --- a/pyanaconda/modules/storage/platform.py +++ b/pyanaconda/modules/storage/platform.py @@ -24,7 +24,7 @@ from blivet.size import Size from pyanaconda.anaconda_loggers import get_module_logger -from pyanaconda.core.i18n import _, N_ +from pyanaconda.core.i18n import N_, _ from pyanaconda.modules.storage.partitioning.specification import PartSpec log = get_module_logger(__name__) diff --git a/pyanaconda/modules/storage/snapshot/create.py b/pyanaconda/modules/storage/snapshot/create.py index 1ebbf24d7cb..2ac0a57ad55 100644 --- a/pyanaconda/modules/storage/snapshot/create.py +++ b/pyanaconda/modules/storage/snapshot/create.py @@ -19,6 +19,7 @@ # from blivet.formats.fs import XFS from pykickstart.constants import SNAPSHOT_WHEN_POST_INSTALL, SNAPSHOT_WHEN_PRE_INSTALL + from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.modules.common.task.task import Task from pyanaconda.modules.storage.snapshot.device import get_snapshot_device diff --git a/pyanaconda/modules/storage/snapshot/snapshot.py b/pyanaconda/modules/storage/snapshot/snapshot.py index bd96d070cea..fe3eb24a31f 100644 --- a/pyanaconda/modules/storage/snapshot/snapshot.py +++ b/pyanaconda/modules/storage/snapshot/snapshot.py @@ -18,16 +18,19 @@ # Red Hat, Inc. # from blivet.errors import StorageError -from pykickstart.constants import SNAPSHOT_WHEN_PRE_INSTALL, CLEARPART_TYPE_ALL, \ - SNAPSHOT_WHEN_POST_INSTALL +from pykickstart.constants import ( + CLEARPART_TYPE_ALL, + SNAPSHOT_WHEN_POST_INSTALL, + SNAPSHOT_WHEN_PRE_INSTALL, +) from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.dbus import DBus from pyanaconda.modules.common.constants.objects import SNAPSHOT +from pyanaconda.modules.storage.checker.utils import storage_checker from pyanaconda.modules.storage.snapshot.create import SnapshotCreateTask from pyanaconda.modules.storage.snapshot.device import get_snapshot_device from pyanaconda.modules.storage.snapshot.snapshot_interface import SnapshotInterface -from pyanaconda.modules.storage.checker.utils import storage_checker from pyanaconda.modules.storage.storage_subscriber import StorageSubscriberModule log = get_module_logger(__name__) diff --git a/pyanaconda/modules/storage/snapshot/snapshot_interface.py b/pyanaconda/modules/storage/snapshot/snapshot_interface.py index 24735cbe954..e374bcf4a44 100644 --- a/pyanaconda/modules/storage/snapshot/snapshot_interface.py +++ b/pyanaconda/modules/storage/snapshot/snapshot_interface.py @@ -19,6 +19,7 @@ # from dasbus.server.interface import dbus_interface from dasbus.typing import * # pylint: disable=wildcard-import + from pyanaconda.modules.common.base import KickstartModuleInterfaceTemplate from pyanaconda.modules.common.constants.objects import SNAPSHOT from pyanaconda.modules.common.containers import TaskContainer diff --git a/pyanaconda/modules/storage/storage.py b/pyanaconda/modules/storage/storage.py index 43d17f85698..f0815072584 100644 --- a/pyanaconda/modules/storage/storage.py +++ b/pyanaconda/modules/storage/storage.py @@ -17,9 +17,11 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from pyanaconda.core.signal import Signal -from pyanaconda.core.dbus import DBus from blivet import __version__ as blivet_version + +from pyanaconda.anaconda_loggers import get_module_logger +from pyanaconda.core.dbus import DBus +from pyanaconda.core.signal import Signal from pyanaconda.modules.common.base import KickstartService from pyanaconda.modules.common.constants.services import STORAGE from pyanaconda.modules.common.containers import TaskContainer @@ -33,8 +35,11 @@ from pyanaconda.modules.storage.disk_initialization import DiskInitializationModule from pyanaconda.modules.storage.disk_selection import DiskSelectionModule from pyanaconda.modules.storage.fcoe import FCOEModule -from pyanaconda.modules.storage.installation import MountFilesystemsTask, CreateStorageLayoutTask, \ - WriteConfigurationTask +from pyanaconda.modules.storage.installation import ( + CreateStorageLayoutTask, + MountFilesystemsTask, + WriteConfigurationTask, +) from pyanaconda.modules.storage.iscsi import ISCSIModule from pyanaconda.modules.storage.kickstart import StorageKickstartSpecification from pyanaconda.modules.storage.nvme import NVMEModule @@ -46,10 +51,12 @@ from pyanaconda.modules.storage.snapshot import SnapshotModule from pyanaconda.modules.storage.storage_interface import StorageInterface from pyanaconda.modules.storage.storage_subscriber import StorageSubscriberModule -from pyanaconda.modules.storage.teardown import UnmountFilesystemsTask, TeardownDiskImagesTask +from pyanaconda.modules.storage.teardown import ( + TeardownDiskImagesTask, + UnmountFilesystemsTask, +) from pyanaconda.modules.storage.zfcp import ZFCPModule -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) diff --git a/pyanaconda/modules/storage/storage_interface.py b/pyanaconda/modules/storage/storage_interface.py index e66ad98e26b..b2ed2c3b99a 100644 --- a/pyanaconda/modules/storage/storage_interface.py +++ b/pyanaconda/modules/storage/storage_interface.py @@ -17,11 +17,12 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from dasbus.server.property import emits_properties_changed -from pyanaconda.modules.common.constants.services import STORAGE -from pyanaconda.modules.common.base import KickstartModuleInterface from dasbus.server.interface import dbus_interface +from dasbus.server.property import emits_properties_changed from dasbus.typing import * # pylint: disable=wildcard-import + +from pyanaconda.modules.common.base import KickstartModuleInterface +from pyanaconda.modules.common.constants.services import STORAGE from pyanaconda.modules.common.containers import PartitioningContainer, TaskContainer from pyanaconda.modules.storage.partitioning.constants import PartitioningMethod diff --git a/pyanaconda/modules/storage/zfcp/discover.py b/pyanaconda/modules/storage/zfcp/discover.py index a7a922926d9..8f6680f0ee3 100644 --- a/pyanaconda/modules/storage/zfcp/discover.py +++ b/pyanaconda/modules/storage/zfcp/discover.py @@ -19,9 +19,14 @@ # from blivet import blockdev from blivet.zfcp import zfcp -from pyanaconda.core.regexes import DASD_DEVICE_NUMBER, ZFCP_WWPN_NUMBER, ZFCP_LUN_NUMBER -from pyanaconda.modules.common.task import Task + +from pyanaconda.core.regexes import ( + DASD_DEVICE_NUMBER, + ZFCP_LUN_NUMBER, + ZFCP_WWPN_NUMBER, +) from pyanaconda.modules.common.errors.configuration import StorageDiscoveryError +from pyanaconda.modules.common.task import Task class ZFCPDiscoverTask(Task): diff --git a/pyanaconda/modules/storage/zfcp/zfcp.py b/pyanaconda/modules/storage/zfcp/zfcp.py index 74018f910e6..a4c4b266bcc 100644 --- a/pyanaconda/modules/storage/zfcp/zfcp.py +++ b/pyanaconda/modules/storage/zfcp/zfcp.py @@ -20,10 +20,10 @@ from blivet import arch from blivet.zfcp import zfcp +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.configuration.anaconda import conf from pyanaconda.core.dbus import DBus from pyanaconda.modules.common.base import KickstartBaseModule -from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.modules.common.constants.objects import ZFCP from pyanaconda.modules.storage.zfcp.discover import ZFCPDiscoverTask from pyanaconda.modules.storage.zfcp.zfcp_interface import ZFCPInterface diff --git a/pyanaconda/modules/storage/zfcp/zfcp_interface.py b/pyanaconda/modules/storage/zfcp/zfcp_interface.py index ee99ff2ab35..175ca528032 100644 --- a/pyanaconda/modules/storage/zfcp/zfcp_interface.py +++ b/pyanaconda/modules/storage/zfcp/zfcp_interface.py @@ -19,6 +19,7 @@ # from dasbus.server.interface import dbus_interface from dasbus.typing import * # pylint: disable=wildcard-import + from pyanaconda.modules.common.base import KickstartModuleInterfaceTemplate from pyanaconda.modules.common.constants.objects import ZFCP from pyanaconda.modules.common.containers import TaskContainer diff --git a/pyanaconda/modules/subscription/__main__.py b/pyanaconda/modules/subscription/__main__.py index 4e065fa9ae2..d8b500656e7 100644 --- a/pyanaconda/modules/subscription/__main__.py +++ b/pyanaconda/modules/subscription/__main__.py @@ -19,13 +19,16 @@ # # Initialize the service. from pyanaconda.modules.common import init + init() # Check the initial conditions. from pyanaconda.modules.subscription.initialization import check_initial_conditions + check_initial_conditions() # Start the service. from pyanaconda.modules.subscription.subscription import SubscriptionService + service = SubscriptionService() service.run() diff --git a/pyanaconda/modules/subscription/initialization.py b/pyanaconda/modules/subscription/initialization.py index 704b287e15d..dad604150e0 100644 --- a/pyanaconda/modules/subscription/initialization.py +++ b/pyanaconda/modules/subscription/initialization.py @@ -21,20 +21,19 @@ import os import sys -from dasbus.typing import get_variant, Str -from pyanaconda.core.configuration.anaconda import conf +from dasbus.typing import Str, get_variant -from pyanaconda.core.service import is_service_installed, start_service +from pyanaconda.anaconda_loggers import get_module_logger +from pyanaconda.core.configuration.anaconda import conf from pyanaconda.core.constants import RHSM_SERVICE_TIMEOUT +from pyanaconda.core.service import is_service_installed, start_service +from pyanaconda.core.threads import thread_manager from pyanaconda.modules.common.constants.objects import RHSM_CONFIG from pyanaconda.modules.common.constants.services import RHSM -from pyanaconda.core.threads import thread_manager -from pyanaconda.modules.common.task import Task from pyanaconda.modules.common.errors.task import NoResultError - +from pyanaconda.modules.common.task import Task from pyanaconda.modules.subscription.constants import RHSM_SERVICE_NAME -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) diff --git a/pyanaconda/modules/subscription/installation.py b/pyanaconda/modules/subscription/installation.py index ca8ee177859..08dc80a2b13 100644 --- a/pyanaconda/modules/subscription/installation.py +++ b/pyanaconda/modules/subscription/installation.py @@ -15,24 +15,26 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -import os import glob +import os import shutil -from dasbus.typing import get_variant, Str +from dasbus.typing import Str, get_variant +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core import util from pyanaconda.core.constants import RHSM_SYSPURPOSE_FILE_PATH -from pyanaconda.core.path import make_directories, join_paths +from pyanaconda.core.path import join_paths, make_directories from pyanaconda.core.subscription import check_system_purpose_set - -from pyanaconda.modules.common.task import Task -from pyanaconda.modules.common.errors.installation import InsightsConnectError, \ - InsightsClientMissingError, SubscriptionTokenTransferError +from pyanaconda.modules.common.errors.installation import ( + InsightsClientMissingError, + InsightsConnectError, + SubscriptionTokenTransferError, +) from pyanaconda.modules.common.errors.subscription import SatelliteProvisioningError +from pyanaconda.modules.common.task import Task from pyanaconda.modules.subscription import satellite -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) diff --git a/pyanaconda/modules/subscription/kickstart.py b/pyanaconda/modules/subscription/kickstart.py index 509961f349e..55142379449 100644 --- a/pyanaconda/modules/subscription/kickstart.py +++ b/pyanaconda/modules/subscription/kickstart.py @@ -17,7 +17,8 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from pyanaconda.core.kickstart import KickstartSpecification, commands as COMMANDS +from pyanaconda.core.kickstart import KickstartSpecification +from pyanaconda.core.kickstart import commands as COMMANDS class SubscriptionKickstartSpecification(KickstartSpecification): diff --git a/pyanaconda/modules/subscription/rhsm_observer.py b/pyanaconda/modules/subscription/rhsm_observer.py index 27c781ec32a..845b63fb09d 100644 --- a/pyanaconda/modules/subscription/rhsm_observer.py +++ b/pyanaconda/modules/subscription/rhsm_observer.py @@ -14,12 +14,12 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -from pyanaconda.modules.common.constants.services import RHSM -from pyanaconda.core.constants import RHSM_SERVICE_TIMEOUT -from pyanaconda.anaconda_loggers import get_module_logger - from dasbus.client.observer import DBusObserver, DBusObserverError +from pyanaconda.anaconda_loggers import get_module_logger +from pyanaconda.core.constants import RHSM_SERVICE_TIMEOUT +from pyanaconda.modules.common.constants.services import RHSM + log = get_module_logger(__name__) diff --git a/pyanaconda/modules/subscription/runtime.py b/pyanaconda/modules/subscription/runtime.py index 152fd58b4e5..285bf8ceb54 100644 --- a/pyanaconda/modules/subscription/runtime.py +++ b/pyanaconda/modules/subscription/runtime.py @@ -15,36 +15,56 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -import os import json +import os from collections import namedtuple -from dasbus.typing import get_variant, Str, Bool, get_native +import gi from dasbus.connection import MessageBus from dasbus.error import DBusError +from dasbus.typing import Bool, Str, get_native, get_variant +from pyanaconda.anaconda_loggers import get_module_logger +from pyanaconda.core import service +from pyanaconda.core.constants import ( + SUBSCRIPTION_REQUEST_TYPE_ORG_KEY, + SUBSCRIPTION_REQUEST_TYPE_USERNAME_PASSWORD, +) from pyanaconda.core.i18n import _ -from pyanaconda.core.constants import SUBSCRIPTION_REQUEST_TYPE_USERNAME_PASSWORD, \ - SUBSCRIPTION_REQUEST_TYPE_ORG_KEY from pyanaconda.core.payload import ProxyString -from pyanaconda.core import service -from pyanaconda.ui.lib.subscription import username_password_sufficient, org_keys_sufficient -from pyanaconda.modules.common.task import Task +from pyanaconda.modules.common.constants.objects import ( + RHSM_CONFIG, + RHSM_REGISTER, + RHSM_REGISTER_SERVER, + RHSM_SYSPURPOSE, + RHSM_UNREGISTER, +) from pyanaconda.modules.common.constants.services import RHSM -from pyanaconda.modules.common.constants.objects import RHSM_REGISTER, RHSM_REGISTER_SERVER, \ - RHSM_UNREGISTER, RHSM_CONFIG, RHSM_SYSPURPOSE -from pyanaconda.modules.common.errors.subscription import RegistrationError, \ - UnregistrationError, SatelliteProvisioningError, MultipleOrganizationsError -from pyanaconda.modules.common.structures.subscription import SystemPurposeData, OrganizationData -from pyanaconda.modules.subscription import system_purpose, satellite -from pyanaconda.modules.subscription.constants import RHSM_SERVICE_NAME, \ - SERVER_HOSTNAME_NOT_SATELLITE_PREFIX -from pyanaconda.modules.subscription.subscription_interface import \ - RetrieveOrganizationsTaskInterface +from pyanaconda.modules.common.errors.subscription import ( + MultipleOrganizationsError, + RegistrationError, + SatelliteProvisioningError, + UnregistrationError, +) +from pyanaconda.modules.common.structures.subscription import ( + OrganizationData, + SystemPurposeData, +) +from pyanaconda.modules.common.task import Task +from pyanaconda.modules.subscription import satellite, system_purpose +from pyanaconda.modules.subscription.constants import ( + RHSM_SERVICE_NAME, + SERVER_HOSTNAME_NOT_SATELLITE_PREFIX, +) +from pyanaconda.modules.subscription.subscription_interface import ( + RetrieveOrganizationsTaskInterface, +) from pyanaconda.modules.subscription.utils import flatten_rhsm_nested_dict -from pyanaconda.anaconda_loggers import get_module_logger +from pyanaconda.ui.lib.subscription import ( + org_keys_sufficient, + username_password_sufficient, +) -import gi gi.require_version("Gio", "2.0") from gi.repository import Gio diff --git a/pyanaconda/modules/subscription/satellite.py b/pyanaconda/modules/subscription/satellite.py index e96605c998f..9bc129d215f 100644 --- a/pyanaconda/modules/subscription/satellite.py +++ b/pyanaconda/modules/subscription/satellite.py @@ -23,13 +23,12 @@ from requests import RequestException +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core import constants, util - -from pyanaconda.core.payload import ProxyString, ProxyStringError from pyanaconda.core.configuration.anaconda import conf from pyanaconda.core.path import make_directories +from pyanaconda.core.payload import ProxyString, ProxyStringError -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) # the well-known path of the Satellite instance URL where diff --git a/pyanaconda/modules/subscription/subscription.py b/pyanaconda/modules/subscription/subscription.py index 6cc9c4fe4c0..ef43ab72a7d 100644 --- a/pyanaconda/modules/subscription/subscription.py +++ b/pyanaconda/modules/subscription/subscription.py @@ -26,41 +26,51 @@ import warnings from dasbus.typing import get_native +from pykickstart.errors import KickstartParseWarning +from pyanaconda.anaconda_loggers import get_module_logger +from pyanaconda.core.configuration.anaconda import conf +from pyanaconda.core.constants import ( + SECRET_TYPE_HIDDEN, + SUBSCRIPTION_REQUEST_TYPE_ORG_KEY, +) +from pyanaconda.core.dbus import DBus from pyanaconda.core.payload import ProxyString, ProxyStringError from pyanaconda.core.signal import Signal -from pyanaconda.core.constants import SECRET_TYPE_HIDDEN, SUBSCRIPTION_REQUEST_TYPE_ORG_KEY -from pyanaconda.core.configuration.anaconda import conf - from pyanaconda.modules.common.base import KickstartService -from pyanaconda.modules.common.structures.subscription import SystemPurposeData, \ - SubscriptionRequest -from pyanaconda.modules.common.structures.secret import get_public_copy -from pyanaconda.core.dbus import DBus - +from pyanaconda.modules.common.constants.objects import ( + RHSM_CONFIG, + RHSM_REGISTER_SERVER, + RHSM_SYSPURPOSE, +) from pyanaconda.modules.common.constants.services import SUBSCRIPTION -from pyanaconda.modules.common.constants.objects import RHSM_CONFIG, RHSM_SYSPURPOSE, \ - RHSM_REGISTER_SERVER from pyanaconda.modules.common.containers import TaskContainer from pyanaconda.modules.common.structures.requirement import Requirement - +from pyanaconda.modules.common.structures.secret import get_public_copy +from pyanaconda.modules.common.structures.subscription import ( + SubscriptionRequest, + SystemPurposeData, +) from pyanaconda.modules.subscription import system_purpose -from pyanaconda.modules.subscription.kickstart import SubscriptionKickstartSpecification -from pyanaconda.modules.subscription.subscription_interface import SubscriptionInterface -from pyanaconda.modules.subscription.installation import ConnectToInsightsTask, \ - RestoreRHSMDefaultsTask, TransferSubscriptionTokensTask, \ - ProvisionTargetSystemForSatelliteTask from pyanaconda.modules.subscription.initialization import StartRHSMTask -from pyanaconda.modules.subscription.runtime import SetRHSMConfigurationTask, \ - RegisterAndSubscribeTask, UnregisterTask, SystemPurposeConfigurationTask, \ - RetrieveOrganizationsTask +from pyanaconda.modules.subscription.installation import ( + ConnectToInsightsTask, + ProvisionTargetSystemForSatelliteTask, + RestoreRHSMDefaultsTask, + TransferSubscriptionTokensTask, +) +from pyanaconda.modules.subscription.kickstart import SubscriptionKickstartSpecification from pyanaconda.modules.subscription.rhsm_observer import RHSMObserver +from pyanaconda.modules.subscription.runtime import ( + RegisterAndSubscribeTask, + RetrieveOrganizationsTask, + SetRHSMConfigurationTask, + SystemPurposeConfigurationTask, + UnregisterTask, +) +from pyanaconda.modules.subscription.subscription_interface import SubscriptionInterface from pyanaconda.modules.subscription.utils import flatten_rhsm_nested_dict - -from pykickstart.errors import KickstartParseWarning - -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) diff --git a/pyanaconda/modules/subscription/subscription_interface.py b/pyanaconda/modules/subscription/subscription_interface.py index edeb4226f6d..02cf6f5b55f 100644 --- a/pyanaconda/modules/subscription/subscription_interface.py +++ b/pyanaconda/modules/subscription/subscription_interface.py @@ -17,15 +17,19 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from pyanaconda.modules.common.constants.services import SUBSCRIPTION +from dasbus.server.interface import dbus_class, dbus_interface +from dasbus.server.property import emits_properties_changed +from dasbus.typing import * # pylint: disable=wildcard-import + from pyanaconda.modules.common.base import KickstartModuleInterface -from pyanaconda.modules.common.structures.subscription import SystemPurposeData, \ - SubscriptionRequest, OrganizationData +from pyanaconda.modules.common.constants.services import SUBSCRIPTION from pyanaconda.modules.common.containers import TaskContainer +from pyanaconda.modules.common.structures.subscription import ( + OrganizationData, + SubscriptionRequest, + SystemPurposeData, +) from pyanaconda.modules.common.task import TaskInterface -from dasbus.server.interface import dbus_interface, dbus_class -from dasbus.server.property import emits_properties_changed -from dasbus.typing import * # pylint: disable=wildcard-import @dbus_class diff --git a/pyanaconda/modules/subscription/system_purpose.py b/pyanaconda/modules/subscription/system_purpose.py index 3d5bfa904ad..45f83af9651 100644 --- a/pyanaconda/modules/subscription/system_purpose.py +++ b/pyanaconda/modules/subscription/system_purpose.py @@ -18,17 +18,17 @@ # Red Hat, Inc. # -import os import json +import os -from dasbus.typing import get_variant, Str, List from dasbus.error import DBusError +from dasbus.typing import List, Str, get_variant -from pyanaconda.core.path import join_paths +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.constants import RHSM_SYSPURPOSE_FILE_PATH +from pyanaconda.core.path import join_paths from pyanaconda.core.subscription import check_system_purpose_set -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) VALID_FIELDS_FILE_PATH = "/etc/rhsm/syspurpose/valid_fields.json" diff --git a/pyanaconda/modules/timezone/__main__.py b/pyanaconda/modules/timezone/__main__.py index ed67531238b..d3ed153576b 100644 --- a/pyanaconda/modules/timezone/__main__.py +++ b/pyanaconda/modules/timezone/__main__.py @@ -18,8 +18,10 @@ # Red Hat, Inc. # from pyanaconda.modules.common import init + init() from pyanaconda.modules.timezone.timezone import TimezoneService + service = TimezoneService() service.run() diff --git a/pyanaconda/modules/timezone/initialization.py b/pyanaconda/modules/timezone/initialization.py index 3b97a4dabfe..7e8544060e4 100644 --- a/pyanaconda/modules/timezone/initialization.py +++ b/pyanaconda/modules/timezone/initialization.py @@ -16,17 +16,18 @@ # Red Hat, Inc. # import time + import requests -from pyanaconda.timezone import get_preferred_timezone, is_valid_timezone +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.configuration.anaconda import conf from pyanaconda.core.constants import NETWORK_CONNECTION_TIMEOUT from pyanaconda.modules.common.constants.services import NETWORK from pyanaconda.modules.common.structures.timezone import GeolocationData from pyanaconda.modules.common.task import Task from pyanaconda.modules.common.util import is_module_available +from pyanaconda.timezone import get_preferred_timezone, is_valid_timezone -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) diff --git a/pyanaconda/modules/timezone/installation.py b/pyanaconda/modules/timezone/installation.py index 0cd75106c78..01d7ef11be8 100644 --- a/pyanaconda/modules/timezone/installation.py +++ b/pyanaconda/modules/timezone/installation.py @@ -18,16 +18,15 @@ import os import os.path +from blivet import arch + from pyanaconda import ntp +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core import service, util from pyanaconda.core.configuration.anaconda import conf -from pyanaconda.timezone import NTP_SERVICE -from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.modules.common.errors.installation import TimezoneConfigurationError from pyanaconda.modules.common.task import Task -from pyanaconda.timezone import is_valid_timezone - -from blivet import arch +from pyanaconda.timezone import NTP_SERVICE, is_valid_timezone __all__ = ["ConfigureHardwareClockTask", "ConfigureNTPTask", "ConfigureTimezoneTask"] diff --git a/pyanaconda/modules/timezone/kickstart.py b/pyanaconda/modules/timezone/kickstart.py index b94e4129c3a..7b04ed85581 100644 --- a/pyanaconda/modules/timezone/kickstart.py +++ b/pyanaconda/modules/timezone/kickstart.py @@ -17,7 +17,8 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from pyanaconda.core.kickstart import KickstartSpecification, commands as COMMANDS +from pyanaconda.core.kickstart import KickstartSpecification +from pyanaconda.core.kickstart import commands as COMMANDS class TimezoneKickstartSpecification(KickstartSpecification): diff --git a/pyanaconda/modules/timezone/timezone.py b/pyanaconda/modules/timezone/timezone.py index 1640d9f8b54..db0ddeb505c 100644 --- a/pyanaconda/modules/timezone/timezone.py +++ b/pyanaconda/modules/timezone/timezone.py @@ -22,26 +22,41 @@ from pykickstart.errors import KickstartParseError -from pyanaconda.core.i18n import _ +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.configuration.anaconda import conf -from pyanaconda.core.constants import TIME_SOURCE_SERVER, TIME_SOURCE_POOL, \ - TIMEZONE_PRIORITY_USER, TIMEZONE_PRIORITY_DEFAULT, TIMEZONE_PRIORITY_KICKSTART +from pyanaconda.core.constants import ( + TIME_SOURCE_POOL, + TIME_SOURCE_SERVER, + TIMEZONE_PRIORITY_DEFAULT, + TIMEZONE_PRIORITY_KICKSTART, + TIMEZONE_PRIORITY_USER, +) from pyanaconda.core.dbus import DBus +from pyanaconda.core.i18n import _ from pyanaconda.core.signal import Signal from pyanaconda.modules.common.base import KickstartService from pyanaconda.modules.common.constants.services import TIMEZONE -from pyanaconda.modules.common.structures.timezone import TimeSourceData, GeolocationData -from pyanaconda.timezone import NTP_PACKAGE from pyanaconda.modules.common.containers import TaskContainer from pyanaconda.modules.common.structures.requirement import Requirement +from pyanaconda.modules.common.structures.timezone import ( + GeolocationData, + TimeSourceData, +) from pyanaconda.modules.timezone.initialization import GeolocationTask -from pyanaconda.modules.timezone.installation import ConfigureHardwareClockTask, \ - ConfigureNTPTask, ConfigureTimezoneTask +from pyanaconda.modules.timezone.installation import ( + ConfigureHardwareClockTask, + ConfigureNTPTask, + ConfigureTimezoneTask, +) from pyanaconda.modules.timezone.kickstart import TimezoneKickstartSpecification from pyanaconda.modules.timezone.timezone_interface import TimezoneInterface -from pyanaconda.timezone import get_timezone, set_system_date_time, get_all_regions_and_timezones +from pyanaconda.timezone import ( + NTP_PACKAGE, + get_all_regions_and_timezones, + get_timezone, + set_system_date_time, +) -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) diff --git a/pyanaconda/modules/timezone/timezone_interface.py b/pyanaconda/modules/timezone/timezone_interface.py index 81f1ad0559e..c6431ae1d00 100644 --- a/pyanaconda/modules/timezone/timezone_interface.py +++ b/pyanaconda/modules/timezone/timezone_interface.py @@ -17,14 +17,17 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # +from dasbus.server.interface import dbus_interface from dasbus.server.property import emits_properties_changed from dasbus.typing import * # pylint: disable=wildcard-import -from dasbus.server.interface import dbus_interface -from pyanaconda.modules.common.containers import TaskContainer from pyanaconda.modules.common.base import KickstartModuleInterface from pyanaconda.modules.common.constants.services import TIMEZONE -from pyanaconda.modules.common.structures.timezone import TimeSourceData, GeolocationData +from pyanaconda.modules.common.containers import TaskContainer +from pyanaconda.modules.common.structures.timezone import ( + GeolocationData, + TimeSourceData, +) @dbus_interface(TIMEZONE.interface_name) diff --git a/pyanaconda/modules/users/__main__.py b/pyanaconda/modules/users/__main__.py index c09e58f3d55..8e9b3699cfb 100644 --- a/pyanaconda/modules/users/__main__.py +++ b/pyanaconda/modules/users/__main__.py @@ -18,8 +18,10 @@ # Red Hat, Inc. # from pyanaconda.modules.common import init + init() from pyanaconda.modules.users.users import UsersService + service = UsersService() service.run() diff --git a/pyanaconda/modules/users/installation.py b/pyanaconda/modules/users/installation.py index 9ccbc1b5611..3f9d6c7c063 100644 --- a/pyanaconda/modules/users/installation.py +++ b/pyanaconda/modules/users/installation.py @@ -18,11 +18,10 @@ import os +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core import users - from pyanaconda.modules.common.task import Task -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) __all__ = [ diff --git a/pyanaconda/modules/users/kickstart.py b/pyanaconda/modules/users/kickstart.py index c271ca63971..9acf7e26505 100644 --- a/pyanaconda/modules/users/kickstart.py +++ b/pyanaconda/modules/users/kickstart.py @@ -17,7 +17,8 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from pyanaconda.core.kickstart import KickstartSpecification, commands as COMMANDS +from pyanaconda.core.kickstart import KickstartSpecification +from pyanaconda.core.kickstart import commands as COMMANDS class UsersKickstartSpecification(KickstartSpecification): diff --git a/pyanaconda/modules/users/users.py b/pyanaconda/modules/users/users.py index db620542458..75a65a55e2f 100644 --- a/pyanaconda/modules/users/users.py +++ b/pyanaconda/modules/users/users.py @@ -17,21 +17,26 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.configuration.anaconda import conf from pyanaconda.core.dbus import DBus from pyanaconda.core.signal import Signal from pyanaconda.modules.common.base import KickstartService from pyanaconda.modules.common.constants.services import USERS from pyanaconda.modules.common.containers import TaskContainer -from pyanaconda.modules.common.structures.user import UserData from pyanaconda.modules.common.structures.group import GroupData from pyanaconda.modules.common.structures.sshkey import SshKeyData +from pyanaconda.modules.common.structures.user import UserData +from pyanaconda.modules.users.installation import ( + ConfigureRootPasswordSSHLoginTask, + CreateGroupsTask, + CreateUsersTask, + SetRootPasswordTask, + SetSshKeysTask, +) from pyanaconda.modules.users.kickstart import UsersKickstartSpecification from pyanaconda.modules.users.users_interface import UsersInterface -from pyanaconda.modules.users.installation import SetRootPasswordTask, CreateUsersTask, \ - CreateGroupsTask, SetSshKeysTask, ConfigureRootPasswordSSHLoginTask -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) diff --git a/pyanaconda/modules/users/users_interface.py b/pyanaconda/modules/users/users_interface.py index b2691041b13..f52becc9a9b 100644 --- a/pyanaconda/modules/users/users_interface.py +++ b/pyanaconda/modules/users/users_interface.py @@ -18,15 +18,16 @@ # Red Hat, Inc. # -from pyanaconda.modules.common.constants.services import USERS +from dasbus.server.interface import dbus_interface from dasbus.server.property import emits_properties_changed from dasbus.typing import * # pylint: disable=wildcard-import + from pyanaconda.modules.common.base import KickstartModuleInterface +from pyanaconda.modules.common.constants.services import USERS from pyanaconda.modules.common.containers import TaskContainer -from pyanaconda.modules.common.structures.user import UserData from pyanaconda.modules.common.structures.group import GroupData from pyanaconda.modules.common.structures.sshkey import SshKeyData -from dasbus.server.interface import dbus_interface +from pyanaconda.modules.common.structures.user import UserData @dbus_interface(USERS.interface_name) diff --git a/pyanaconda/mutter_display.py b/pyanaconda/mutter_display.py index b011270d352..2431135b6e9 100644 --- a/pyanaconda/mutter_display.py +++ b/pyanaconda/mutter_display.py @@ -17,10 +17,10 @@ # from dasbus.client.observer import DBusObserver + from pyanaconda.core.dbus import SessionBus -from pyanaconda.modules.common.constants.services import MUTTER_DISPLAY_CONFIG from pyanaconda.core.regexes import SCREEN_RESOLUTION_CONFIG - +from pyanaconda.modules.common.constants.services import MUTTER_DISPLAY_CONFIG __all__ = ['MutterConfigError', 'MutterDisplay'] diff --git a/pyanaconda/network.py b/pyanaconda/network.py index 3c66758461f..7ccdb3eaea8 100644 --- a/pyanaconda/network.py +++ b/pyanaconda/network.py @@ -16,34 +16,37 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import shutil -import socket +import ipaddress import itertools import os -import time -import threading import re -import ipaddress +import shutil +import socket +import threading +import time +import gi from dasbus.typing import get_native from pyanaconda.anaconda_loggers import get_module_logger -from pyanaconda.core import util, constants +from pyanaconda.core import constants, util +from pyanaconda.core.configuration.anaconda import conf +from pyanaconda.core.constants import TIME_SOURCE_SERVER from pyanaconda.core.i18n import _ from pyanaconda.core.kernel import kernel_arguments from pyanaconda.core.path import make_directories -from pyanaconda.core.regexes import HOSTNAME_PATTERN_WITHOUT_ANCHORS, \ - IPV6_ADDRESS_IN_DRACUT_IP_OPTION, MAC_OCTET -from pyanaconda.core.configuration.anaconda import conf -from pyanaconda.core.constants import TIME_SOURCE_SERVER -from pyanaconda.modules.common.constants.services import NETWORK, TIMEZONE, STORAGE +from pyanaconda.core.regexes import ( + HOSTNAME_PATTERN_WITHOUT_ANCHORS, + IPV6_ADDRESS_IN_DRACUT_IP_OPTION, + MAC_OCTET, +) from pyanaconda.modules.common.constants.objects import FCOE -from pyanaconda.modules.common.task import sync_run_task +from pyanaconda.modules.common.constants.services import NETWORK, STORAGE, TIMEZONE from pyanaconda.modules.common.structures.network import NetworkDeviceInfo from pyanaconda.modules.common.structures.timezone import TimeSourceData +from pyanaconda.modules.common.task import sync_run_task from pyanaconda.modules.common.util import is_module_available -import gi gi.require_version("NM", "1.0") from gi.repository import NM diff --git a/pyanaconda/ntp.py b/pyanaconda/ntp.py index 0b249541fb1..af7a235fa8c 100644 --- a/pyanaconda/ntp.py +++ b/pyanaconda/ntp.py @@ -21,20 +21,25 @@ """ -import re import os -import tempfile +import re import shutil +import tempfile from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.async_utils import async_action_nowait +from pyanaconda.core.constants import ( + NTP_SERVER_NOK, + NTP_SERVER_OK, + NTP_SERVER_QUERY, + NTP_SERVER_TIMEOUT, + THREAD_NTP_SERVER_CHECK, +) from pyanaconda.core.i18n import N_, _ -from pyanaconda.core.constants import NTP_SERVER_TIMEOUT, NTP_SERVER_QUERY, \ - THREAD_NTP_SERVER_CHECK, NTP_SERVER_OK, NTP_SERVER_NOK from pyanaconda.core.signal import Signal +from pyanaconda.core.threads import thread_manager from pyanaconda.core.util import execWithRedirect from pyanaconda.modules.common.structures.timezone import TimeSourceData -from pyanaconda.core.threads import thread_manager NTP_CONFIG_FILE = "/etc/chrony.conf" diff --git a/pyanaconda/payload/base.py b/pyanaconda/payload/base.py index f0a1fda4ebe..9727fc2a96c 100644 --- a/pyanaconda/payload/base.py +++ b/pyanaconda/payload/base.py @@ -123,7 +123,9 @@ def _progress_cb(self, step, message): def pre_install(self): """Perform pre-installation tasks.""" # FIXME: Merge the pre-installation tasks with the installation tasks. - from pyanaconda.modules.payloads.installation import PrepareSystemForInstallationTask + from pyanaconda.modules.payloads.installation import ( + PrepareSystemForInstallationTask, + ) PrepareSystemForInstallationTask(conf.target.system_root).run() def install(self): diff --git a/pyanaconda/payload/dnf/payload.py b/pyanaconda/payload/dnf/payload.py index 1d786f8e2f8..6063404f99f 100644 --- a/pyanaconda/payload/dnf/payload.py +++ b/pyanaconda/payload/dnf/payload.py @@ -20,22 +20,39 @@ from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.configuration.anaconda import conf -from pyanaconda.core.constants import PAYLOAD_TYPE_DNF, SOURCE_TYPE_URL, \ - SOURCE_TYPE_REPO_PATH, MULTILIB_POLICY_ALL, \ - DRACUT_REPO_DIR, \ - SOURCE_TYPE_CDROM, SOURCE_TYPE_NFS, SOURCE_TYPE_HDD, SOURCE_TYPE_HMC +from pyanaconda.core.constants import ( + DRACUT_REPO_DIR, + MULTILIB_POLICY_ALL, + PAYLOAD_TYPE_DNF, + SOURCE_TYPE_CDROM, + SOURCE_TYPE_HDD, + SOURCE_TYPE_HMC, + SOURCE_TYPE_NFS, + SOURCE_TYPE_REPO_PATH, + SOURCE_TYPE_URL, +) from pyanaconda.modules.common.constants.services import PAYLOADS from pyanaconda.modules.common.errors.payload import SourceSetupError -from pyanaconda.modules.common.structures.packages import PackagesConfigurationData, \ - PackagesSelectionData +from pyanaconda.modules.common.structures.packages import ( + PackagesConfigurationData, + PackagesSelectionData, +) from pyanaconda.modules.common.structures.payload import RepoConfigurationData from pyanaconda.modules.common.structures.validation import ValidationReport from pyanaconda.modules.common.task import sync_run_task -from pyanaconda.modules.payloads.payload.dnf.repositories import generate_driver_disk_repositories +from pyanaconda.modules.payloads.payload.dnf.repositories import ( + generate_driver_disk_repositories, +) from pyanaconda.modules.payloads.source.utils import verify_valid_repository -from pyanaconda.payload.manager import payloadMgr as payload_manager, NonCriticalSourceSetupError +from pyanaconda.payload.manager import NonCriticalSourceSetupError +from pyanaconda.payload.manager import payloadMgr as payload_manager from pyanaconda.payload.migrated import MigratedDBusPayload -from pyanaconda.ui.lib.payload import create_source, set_source, set_up_sources, tear_down_sources +from pyanaconda.ui.lib.payload import ( + create_source, + set_source, + set_up_sources, + tear_down_sources, +) __all__ = ["DNFPayload"] diff --git a/pyanaconda/payload/image.py b/pyanaconda/payload/image.py index 20bb5239073..73f32524fee 100644 --- a/pyanaconda/payload/image.py +++ b/pyanaconda/payload/image.py @@ -21,12 +21,12 @@ import os.path import tempfile +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.modules.common.constants.objects import DEVICE_TREE from pyanaconda.modules.common.constants.services import STORAGE from pyanaconda.modules.common.errors.storage import MountFilesystemError from pyanaconda.payload import utils as payload_utils -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) @@ -51,7 +51,9 @@ def find_optical_install_media(): except MountFilesystemError: continue try: - from pyanaconda.modules.payloads.source.utils import is_valid_install_disk + from pyanaconda.modules.payloads.source.utils import ( + is_valid_install_disk, + ) if not is_valid_install_disk(mountpoint): continue finally: diff --git a/pyanaconda/payload/manager.py b/pyanaconda/payload/manager.py index 6d071eafe52..ce80a23b9d9 100644 --- a/pyanaconda/payload/manager.py +++ b/pyanaconda/payload/manager.py @@ -15,17 +15,26 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from pyanaconda.core.constants import THREAD_STORAGE, THREAD_PAYLOAD, THREAD_PAYLOAD_RESTART, \ - THREAD_WAIT_FOR_CONNECTING_NM, THREAD_SUBSCRIPTION, THREAD_STORAGE_WATCHER, \ - THREAD_EXECUTE_STORAGE, PAYLOAD_STATUS_PROBING_STORAGE, PAYLOAD_STATUS_SETTING_SOURCE +from pyanaconda.anaconda_loggers import get_module_logger +from pyanaconda.core.constants import ( + PAYLOAD_STATUS_PROBING_STORAGE, + PAYLOAD_STATUS_SETTING_SOURCE, + THREAD_EXECUTE_STORAGE, + THREAD_PAYLOAD, + THREAD_PAYLOAD_RESTART, + THREAD_STORAGE, + THREAD_STORAGE_WATCHER, + THREAD_SUBSCRIPTION, + THREAD_WAIT_FOR_CONNECTING_NM, +) from pyanaconda.core.i18n import _ +from pyanaconda.core.threads import thread_manager +from pyanaconda.errors import ERROR_RAISE +from pyanaconda.errors import errorHandler as error_handler from pyanaconda.modules.common.errors.payload import SourceSetupError from pyanaconda.modules.common.structures.validation import ValidationReport from pyanaconda.modules.common.task.progress import ProgressReporter from pyanaconda.modules.common.task.runnable import Runnable -from pyanaconda.core.threads import thread_manager -from pyanaconda.errors import errorHandler as error_handler, ERROR_RAISE -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) diff --git a/pyanaconda/payload/migrated.py b/pyanaconda/payload/migrated.py index ef2255ddb7e..e72eb390246 100644 --- a/pyanaconda/payload/migrated.py +++ b/pyanaconda/payload/migrated.py @@ -16,16 +16,19 @@ # Red Hat, Inc. # from abc import ABCMeta, abstractmethod + from blivet.size import Size from pyanaconda.anaconda_loggers import get_module_logger +from pyanaconda.errors import ERROR_RAISE, errorHandler from pyanaconda.modules.common.constants.services import PAYLOADS +from pyanaconda.modules.common.errors.installation import ( + NonCriticalInstallationError, + PayloadInstallationError, +) from pyanaconda.modules.common.task import sync_run_task from pyanaconda.payload.base import Payload from pyanaconda.ui.lib.payload import get_payload, get_source, set_up_sources -from pyanaconda.errors import errorHandler, ERROR_RAISE -from pyanaconda.modules.common.errors.installation import PayloadInstallationError, \ - NonCriticalInstallationError log = get_module_logger(__name__) diff --git a/pyanaconda/queuefactory.py b/pyanaconda/queuefactory.py index 37fe76c0579..81b5aa84e48 100644 --- a/pyanaconda/queuefactory.py +++ b/pyanaconda/queuefactory.py @@ -17,7 +17,8 @@ # along with this program. If not, see . import queue -from pyanaconda.core.string import upper_ascii, lower_ascii + +from pyanaconda.core.string import lower_ascii, upper_ascii class QueueFactory: diff --git a/pyanaconda/rescue.py b/pyanaconda/rescue.py index 05869dc07d0..cd8e6191baf 100644 --- a/pyanaconda/rescue.py +++ b/pyanaconda/rescue.py @@ -16,42 +16,48 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # +import os +import shutil import sys +import time +from enum import Enum +from pykickstart.constants import KS_REBOOT, KS_SCRIPT_POST, KS_SHUTDOWN +from simpleline import App +from simpleline.render.adv_widgets import PasswordDialog, YesNoDialog +from simpleline.render.containers import ListColumnContainer +from simpleline.render.prompt import Prompt +from simpleline.render.screen import InputState +from simpleline.render.screen_handler import ScreenHandler +from simpleline.render.widgets import CheckboxWidget, TextWidget + +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core import util from pyanaconda.core.configuration.anaconda import conf -from pyanaconda.core.constants import ANACONDA_CLEANUP, THREAD_STORAGE, QUIT_MESSAGE, IPMI_ABORTED +from pyanaconda.core.constants import ( + ANACONDA_CLEANUP, + IPMI_ABORTED, + QUIT_MESSAGE, + THREAD_STORAGE, +) +from pyanaconda.core.i18n import N_, _ +from pyanaconda.core.threads import thread_manager from pyanaconda.errors import errorHandler -from pyanaconda.modules.common.errors.runtime import ScriptError +from pyanaconda.flags import flags from pyanaconda.modules.common.constants.objects import DEVICE_TREE, SCRIPTS -from pyanaconda.modules.common.constants.services import STORAGE, RUNTIME +from pyanaconda.modules.common.constants.services import RUNTIME, STORAGE +from pyanaconda.modules.common.errors.runtime import ScriptError from pyanaconda.modules.common.errors.storage import MountFilesystemError from pyanaconda.modules.common.structures.rescue import RescueData -from pyanaconda.modules.common.structures.storage import OSData, DeviceFormatData, DeviceData +from pyanaconda.modules.common.structures.storage import ( + DeviceData, + DeviceFormatData, + OSData, +) from pyanaconda.modules.common.task import sync_run_task -from pyanaconda.core.threads import thread_manager -from pyanaconda.flags import flags -from pyanaconda.core.i18n import _, N_ from pyanaconda.ui.tui import tui_quit_callback from pyanaconda.ui.tui.spokes import NormalTUISpoke -from pykickstart.constants import KS_REBOOT, KS_SHUTDOWN -from pykickstart.constants import KS_SCRIPT_POST - -from simpleline import App -from simpleline.render.adv_widgets import YesNoDialog, PasswordDialog -from simpleline.render.containers import ListColumnContainer -from simpleline.render.prompt import Prompt -from simpleline.render.screen import InputState -from simpleline.render.screen_handler import ScreenHandler -from simpleline.render.widgets import TextWidget, CheckboxWidget - -import os -import shutil -import time -from enum import Enum - -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) __all__ = ["RescueModeSpoke", "RescueStatusAndShellSpoke", "RootSelectionSpoke"] diff --git a/pyanaconda/screensaver.py b/pyanaconda/screensaver.py index 20d0264a1f6..4842015c908 100644 --- a/pyanaconda/screensaver.py +++ b/pyanaconda/screensaver.py @@ -47,10 +47,13 @@ the proxy object must exist as long as we want the inhibition to be in effect. """ import os + from dasbus.connection import SessionMessageBus from dasbus.error import DBusError from dasbus.identifier import DBusServiceIdentifier + from pyanaconda.anaconda_loggers import get_module_logger + log = get_module_logger(__name__) __all__ = ["inhibit_screensaver", "uninhibit_screensaver"] diff --git a/pyanaconda/startup_utils.py b/pyanaconda/startup_utils.py index fa98f0baa46..c3d20aa416e 100644 --- a/pyanaconda/startup_utils.py +++ b/pyanaconda/startup_utils.py @@ -17,42 +17,70 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -import sys -import time import os import pkgutil +import sys +import time + from blivet.arch import is_s390 from blivet.util import total_memory -from dasbus.typing import get_variant, Int - -from pyanaconda import ntp -from pyanaconda import anaconda_logging -from pyanaconda import network -from pyanaconda import kickstart -from pyanaconda.anaconda_loggers import get_stdout_logger, get_module_logger -from pyanaconda.core.util import persistent_root_image, ipmi_report, setenv, \ - get_anaconda_version_string -from pyanaconda.core.hw import minimal_memory_needed +from dasbus.typing import Int, get_variant + +from pyanaconda import anaconda_logging, kickstart, network, ntp +from pyanaconda.anaconda_loggers import get_module_logger, get_stdout_logger from pyanaconda.core.configuration.anaconda import conf -from pyanaconda.core.constants import TEXT_ONLY_TARGET, SETUP_ON_BOOT_DEFAULT, \ - SETUP_ON_BOOT_ENABLED, DRACUT_ERRORS_PATH, IPMI_ABORTED, STORAGE_MIN_RAM, SELINUX_DEFAULT, \ - THREAD_TIME_INIT, DisplayModes, GEOLOC_CONNECTION_TIMEOUT, TIMEZONE_PRIORITY_GEOLOCATION +from pyanaconda.core.constants import ( + DRACUT_ERRORS_PATH, + GEOLOC_CONNECTION_TIMEOUT, + IPMI_ABORTED, + SELINUX_DEFAULT, + SETUP_ON_BOOT_DEFAULT, + SETUP_ON_BOOT_ENABLED, + STORAGE_MIN_RAM, + TEXT_ONLY_TARGET, + THREAD_TIME_INIT, + TIMEZONE_PRIORITY_GEOLOCATION, + DisplayModes, +) +from pyanaconda.core.hw import minimal_memory_needed from pyanaconda.core.i18n import _ from pyanaconda.core.payload import ProxyString, ProxyStringError -from pyanaconda.core.product import get_product_is_final_release, get_product_name, \ - get_product_version +from pyanaconda.core.product import ( + get_product_is_final_release, + get_product_name, + get_product_version, +) from pyanaconda.core.service import start_service +from pyanaconda.core.threads import thread_manager +from pyanaconda.core.util import ( + get_anaconda_version_string, + ipmi_report, + persistent_root_image, + setenv, +) from pyanaconda.flags import flags -from pyanaconda.localization import get_territory_locales, setup_locale, locale_has_translation +from pyanaconda.localization import ( + get_territory_locales, + locale_has_translation, + setup_locale, +) +from pyanaconda.modules.common.constants.objects import STORAGE_CHECKER +from pyanaconda.modules.common.constants.services import ( + LOCALIZATION, + RUNTIME, + SECURITY, + SERVICES, + STORAGE, + TIMEZONE, +) from pyanaconda.modules.common.structures.logging import LoggingData -from pyanaconda.screensaver import inhibit_screensaver +from pyanaconda.modules.common.structures.timezone import ( + GeolocationData, + TimeSourceData, +) from pyanaconda.modules.common.task import wait_for_task -from pyanaconda.modules.common.structures.timezone import TimeSourceData, GeolocationData -from pyanaconda.modules.common.constants.objects import STORAGE_CHECKER -from pyanaconda.modules.common.constants.services import TIMEZONE, LOCALIZATION, SERVICES, \ - SECURITY, STORAGE, RUNTIME from pyanaconda.modules.common.util import is_module_available -from pyanaconda.core.threads import thread_manager +from pyanaconda.screensaver import inhibit_screensaver stdout_log = get_stdout_logger() log = get_module_logger(__name__) diff --git a/pyanaconda/timezone.py b/pyanaconda/timezone.py index e31fb3d4b36..779016a592d 100644 --- a/pyanaconda/timezone.py +++ b/pyanaconda/timezone.py @@ -22,22 +22,23 @@ """ -import langtable -import zoneinfo -import time import datetime +import time +import zoneinfo from collections import OrderedDict from functools import cache -from pyanaconda.core.util import execWithRedirect +import langtable +from blivet import arch + +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.constants import THREAD_STORAGE +from pyanaconda.core.threads import thread_manager +from pyanaconda.core.util import execWithRedirect from pyanaconda.flags import flags from pyanaconda.modules.common.constants.objects import BOOTLOADER from pyanaconda.modules.common.constants.services import STORAGE -from pyanaconda.core.threads import thread_manager -from blivet import arch -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) # The Etc category in zoneinfo.available_timezones() includes some more, diff --git a/pyanaconda/ui/__init__.py b/pyanaconda/ui/__init__.py index 36a44868311..91cf9344366 100644 --- a/pyanaconda/ui/__init__.py +++ b/pyanaconda/ui/__init__.py @@ -20,6 +20,7 @@ __all__ = ["UserInterface"] import copy + from pyanaconda.core.util import collect diff --git a/pyanaconda/ui/common.py b/pyanaconda/ui/common.py index 907c17520b4..ccf5da31359 100644 --- a/pyanaconda/ui/common.py +++ b/pyanaconda/ui/common.py @@ -16,16 +16,16 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from abc import abstractmethod, ABC +from abc import ABC, abstractmethod +from pyanaconda import lifecycle +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.configuration.anaconda import conf from pyanaconda.core.constants import ANACONDA_ENVIRON, FIRSTBOOT_ENVIRON -from pyanaconda.core.util import collect from pyanaconda.core.signal import Signal +from pyanaconda.core.util import collect from pyanaconda.ui.categories import SpokeCategory from pyanaconda.ui.lib.services import is_reconfiguration_mode -from pyanaconda import lifecycle -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) diff --git a/pyanaconda/ui/gui/__init__.py b/pyanaconda/ui/gui/__init__.py index 95db7106c31..1b8124aec72 100644 --- a/pyanaconda/ui/gui/__init__.py +++ b/pyanaconda/ui/gui/__init__.py @@ -18,13 +18,13 @@ # import inspect import os -import sys import site -import meh.ui.gui - +import sys from contextlib import contextmanager import gi +import meh.ui.gui + gi.require_version("Gdk", "3.0") gi.require_version("Gtk", "3.0") gi.require_version("AnacondaWidgets", "3.4") @@ -32,27 +32,31 @@ gi.require_version("GObject", "2.0") gi.require_version("GLib", "2.0") -from gi.repository import Gdk, Gtk, AnacondaWidgets, GdkPixbuf, GObject, GLib +import os.path -from pyanaconda.flags import flags -from pyanaconda.core.i18n import _, C_ -from pyanaconda.core.constants import WINDOW_TITLE_TEXT +from gi.repository import AnacondaWidgets, Gdk, GdkPixbuf, GLib, GObject, Gtk + +from pyanaconda.anaconda_loggers import get_module_logger +from pyanaconda.core import constants, util +from pyanaconda.core.async_utils import async_action_wait from pyanaconda.core.configuration.anaconda import conf -from pyanaconda.core import util, constants +from pyanaconda.core.constants import WINDOW_TITLE_TEXT +from pyanaconda.core.glib import Bytes, GError +from pyanaconda.core.i18n import C_, _ from pyanaconda.core.product import get_product_is_final_release from pyanaconda.core.threads import thread_manager - -from pyanaconda.core.glib import Bytes, GError +from pyanaconda.flags import flags from pyanaconda.keyboard import can_configure_keyboard from pyanaconda.ui import UserInterface, common -from pyanaconda.ui.helpers import get_distribution_text -from pyanaconda.ui.gui.utils import unbusyCursor, really_hide -from pyanaconda.core.async_utils import async_action_wait -from pyanaconda.ui.gui.utils import watch_children, unwatch_children from pyanaconda.ui.gui.helpers import autoinstall_stopped -import os.path +from pyanaconda.ui.gui.utils import ( + really_hide, + unbusyCursor, + unwatch_children, + watch_children, +) +from pyanaconda.ui.helpers import get_distribution_text -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) __all__ = ["GraphicalUserInterface", "QuitDialog"] diff --git a/pyanaconda/ui/gui/helpers.py b/pyanaconda/ui/gui/helpers.py index 583a89842c7..8829c76276a 100644 --- a/pyanaconda/ui/gui/helpers.py +++ b/pyanaconda/ui/gui/helpers.py @@ -21,21 +21,23 @@ # functionality. See also pyanaconda.ui.helpers. from pyanaconda.anaconda_loggers import get_module_logger + log = get_module_logger(__name__) from abc import ABCMeta, abstractmethod import gi + gi.require_version("Gtk", "3.0") from gi.repository import Gtk -from pyanaconda.flags import flags -from pyanaconda.ui.helpers import InputCheck, InputCheckHandler -from pyanaconda.ui.gui.utils import timed_action +from pyanaconda.core import constants from pyanaconda.core.i18n import _ from pyanaconda.errors import NonInteractiveError -from pyanaconda.core import constants +from pyanaconda.flags import flags +from pyanaconda.ui.gui.utils import timed_action +from pyanaconda.ui.helpers import InputCheck, InputCheckHandler def autoinstall_stopped(reason): diff --git a/pyanaconda/ui/gui/hubs/__init__.py b/pyanaconda/ui/gui/hubs/__init__.py index 343ac395d27..396496f6113 100644 --- a/pyanaconda/ui/gui/hubs/__init__.py +++ b/pyanaconda/ui/gui/hubs/__init__.py @@ -17,18 +17,17 @@ # Red Hat, Inc. # -from pyanaconda.flags import flags -from pyanaconda.core.i18n import _, C_ from pyanaconda import lifecycle +from pyanaconda.anaconda_loggers import get_module_logger +from pyanaconda.core.i18n import C_, _ from pyanaconda.core.timer import Timer - +from pyanaconda.flags import flags from pyanaconda.ui import common -from pyanaconda.ui.helpers import get_distribution_text from pyanaconda.ui.gui import GUIObject from pyanaconda.ui.gui.helpers import autoinstall_stopped -from pyanaconda.ui.gui.utils import gtk_call_once, escape_markup +from pyanaconda.ui.gui.utils import escape_markup, gtk_call_once +from pyanaconda.ui.helpers import get_distribution_text -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) @@ -117,7 +116,7 @@ def _createBox(self): gi.require_version("Gtk", "3.0") gi.require_version("AnacondaWidgets", "3.4") - from gi.repository import Gtk, AnacondaWidgets + from gi.repository import AnacondaWidgets, Gtk cats_and_spokes = self._collectCategoriesAndSpokes() categories = cats_and_spokes.keys() @@ -285,9 +284,10 @@ def _updateContinueButton(self): self.window.set_may_continue(self.continuePossible) def _update_spokes(self): - from pyanaconda.ui.communication import hubQ import queue + from pyanaconda.ui.communication import hubQ + q = hubQ.q if not self._spokes and self.window.get_may_continue() and self.continue_if_empty: diff --git a/pyanaconda/ui/gui/hubs/summary.py b/pyanaconda/ui/gui/hubs/summary.py index e3e0b11c247..9541d4956b6 100644 --- a/pyanaconda/ui/gui/hubs/summary.py +++ b/pyanaconda/ui/gui/hubs/summary.py @@ -16,13 +16,13 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # +from pyanaconda.core.configuration.anaconda import conf from pyanaconda.core.constants import WARNING_SMT_ENABLED_GUI -from pyanaconda.core.i18n import _, C_ from pyanaconda.core.hw import is_smt_enabled +from pyanaconda.core.i18n import C_, _ from pyanaconda.ui.gui.hubs import Hub from pyanaconda.ui.gui.spokes.lib.detailederror import DetailedErrorDialog -from pyanaconda.ui.lib.space import FileSystemSpaceChecker, DirInstallSpaceChecker -from pyanaconda.core.configuration.anaconda import conf +from pyanaconda.ui.lib.space import DirInstallSpaceChecker, FileSystemSpaceChecker __all__ = ["SummaryHub"] diff --git a/pyanaconda/ui/gui/spokes/__init__.py b/pyanaconda/ui/gui/spokes/__init__.py index c83faf4616f..196f0fcc25c 100644 --- a/pyanaconda/ui/gui/spokes/__init__.py +++ b/pyanaconda/ui/gui/spokes/__init__.py @@ -16,10 +16,10 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.ui import common from pyanaconda.ui.gui import GUIObject -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) __all__ = ["NormalSpoke", "StandaloneSpoke"] diff --git a/pyanaconda/ui/gui/spokes/advanced_storage.py b/pyanaconda/ui/gui/spokes/advanced_storage.py index 3bf55a5a2ed..af57064014c 100644 --- a/pyanaconda/ui/gui/spokes/advanced_storage.py +++ b/pyanaconda/ui/gui/spokes/advanced_storage.py @@ -18,27 +18,34 @@ # from collections import namedtuple +import gi from blivet.size import Size from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.i18n import CN_, CP_ -from pyanaconda.modules.common.structures.storage import DeviceData -from pyanaconda.ui.lib.storage import apply_disk_selection, try_populate_devicetree, \ - filter_disks_by_names -from pyanaconda.modules.common.constants.objects import DISK_SELECTION, FCOE, ISCSI, DASD, \ - DEVICE_TREE +from pyanaconda.modules.common.constants.objects import ( + DASD, + DEVICE_TREE, + DISK_SELECTION, + FCOE, + ISCSI, +) from pyanaconda.modules.common.constants.services import STORAGE - -from pyanaconda.ui.gui.utils import timed_action, really_show, really_hide +from pyanaconda.modules.common.structures.storage import DeviceData +from pyanaconda.ui.categories.system import SystemCategory from pyanaconda.ui.gui.spokes import NormalSpoke +from pyanaconda.ui.gui.spokes.advstorage.dasd import DASDDialog from pyanaconda.ui.gui.spokes.advstorage.fcoe import FCoEDialog from pyanaconda.ui.gui.spokes.advstorage.iscsi import ISCSIDialog from pyanaconda.ui.gui.spokes.advstorage.zfcp import ZFCPDialog -from pyanaconda.ui.gui.spokes.advstorage.dasd import DASDDialog from pyanaconda.ui.gui.spokes.lib.cart import SelectedDisksDialog -from pyanaconda.ui.categories.system import SystemCategory +from pyanaconda.ui.gui.utils import really_hide, really_show, timed_action +from pyanaconda.ui.lib.storage import ( + apply_disk_selection, + filter_disks_by_names, + try_populate_devicetree, +) -import gi gi.require_version("Gtk", "3.0") from gi.repository import Gtk diff --git a/pyanaconda/ui/gui/spokes/advstorage/fcoe.py b/pyanaconda/ui/gui/spokes/advstorage/fcoe.py index 38569b8daef..fb055d67e77 100644 --- a/pyanaconda/ui/gui/spokes/advstorage/fcoe.py +++ b/pyanaconda/ui/gui/spokes/advstorage/fcoe.py @@ -16,15 +16,16 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # +import gi + from pyanaconda.modules.common.constants.objects import FCOE -from pyanaconda.modules.common.constants.services import STORAGE, NETWORK -from pyanaconda.modules.common.structures.network import NetworkDeviceInfo +from pyanaconda.modules.common.constants.services import NETWORK, STORAGE from pyanaconda.modules.common.errors.configuration import StorageDiscoveryError +from pyanaconda.modules.common.structures.network import NetworkDeviceInfo from pyanaconda.modules.common.task import async_run_task from pyanaconda.ui.gui import GUIObject from pyanaconda.ui.lib.storage import try_populate_devicetree -import gi gi.require_version("NM", "1.0") from gi.repository import NM diff --git a/pyanaconda/ui/gui/spokes/advstorage/iscsi.py b/pyanaconda/ui/gui/spokes/advstorage/iscsi.py index a6d661baaba..69f77c8e35d 100644 --- a/pyanaconda/ui/gui/spokes/advstorage/iscsi.py +++ b/pyanaconda/ui/gui/spokes/advstorage/iscsi.py @@ -18,21 +18,25 @@ # from collections import namedtuple + from dasbus.typing import unwrap_variant +from pyanaconda.core.constants import ( + ISCSI_INTERFACE_DEFAULT, + ISCSI_INTERFACE_IFACENAME, + ISCSI_INTERFACE_UNSET, +) +from pyanaconda.core.i18n import _ +from pyanaconda.core.regexes import ISCSI_EUI_NAME_REGEX, ISCSI_IQN_NAME_REGEX +from pyanaconda.modules.common.constants.objects import ISCSI +from pyanaconda.modules.common.constants.services import STORAGE from pyanaconda.modules.common.errors.configuration import StorageDiscoveryError +from pyanaconda.modules.common.structures.iscsi import Credentials, Node, Portal from pyanaconda.modules.common.task import async_run_task -from pyanaconda.modules.common.structures.iscsi import Credentials, Portal, Node -from pyanaconda.modules.common.constants.services import STORAGE -from pyanaconda.modules.common.constants.objects import ISCSI -from pyanaconda.core.constants import ISCSI_INTERFACE_UNSET, ISCSI_INTERFACE_DEFAULT, \ - ISCSI_INTERFACE_IFACENAME +from pyanaconda.network import check_ip_address from pyanaconda.ui.gui import GUIObject from pyanaconda.ui.gui.utils import escape_markup from pyanaconda.ui.lib.storage import try_populate_devicetree -from pyanaconda.core.i18n import _ -from pyanaconda.core.regexes import ISCSI_IQN_NAME_REGEX, ISCSI_EUI_NAME_REGEX -from pyanaconda.network import check_ip_address __all__ = ["ISCSIDialog"] diff --git a/pyanaconda/ui/gui/spokes/advstorage/zfcp.py b/pyanaconda/ui/gui/spokes/advstorage/zfcp.py index 2434c001bff..b052eb09b59 100644 --- a/pyanaconda/ui/gui/spokes/advstorage/zfcp.py +++ b/pyanaconda/ui/gui/spokes/advstorage/zfcp.py @@ -20,8 +20,8 @@ from pyanaconda.modules.common.constants.services import STORAGE from pyanaconda.modules.common.errors.configuration import StorageDiscoveryError from pyanaconda.modules.common.task import async_run_task -from pyanaconda.ui.lib.storage import try_populate_devicetree from pyanaconda.ui.gui import GUIObject +from pyanaconda.ui.lib.storage import try_populate_devicetree __all__ = ["ZFCPDialog"] diff --git a/pyanaconda/ui/gui/spokes/blivet_gui.py b/pyanaconda/ui/gui/spokes/blivet_gui.py index 0230538a857..36d100c85c9 100644 --- a/pyanaconda/ui/gui/spokes/blivet_gui.py +++ b/pyanaconda/ui/gui/spokes/blivet_gui.py @@ -21,28 +21,35 @@ """Module with the BlivetGuiSpoke class.""" from threading import Lock + from pyanaconda.errors import RemovedModuleError try: - from blivetgui.osinstall import BlivetGUIAnaconda # pylint: disable=import-error - from blivetgui.communication.client import BlivetGUIClient # pylint: disable=import-error + from blivetgui.communication.client import ( + BlivetGUIClient, # pylint: disable=import-error + ) from blivetgui.config import config # pylint: disable=import-error + from blivetgui.osinstall import BlivetGUIAnaconda # pylint: disable=import-error except ImportError as e: raise RemovedModuleError("This module is not supported: {}".format(e)) from None +import gi + from pyanaconda.anaconda_loggers import get_module_logger -from pyanaconda.ui.gui.spokes import NormalSpoke -from pyanaconda.ui.helpers import StorageCheckHandler -from pyanaconda.ui.categories.system import SystemCategory -from pyanaconda.ui.gui.spokes.lib.summary import ActionSummaryDialog -from pyanaconda.core.constants import THREAD_EXECUTE_STORAGE, THREAD_STORAGE, \ - PARTITIONING_METHOD_BLIVET -from pyanaconda.core.i18n import _, CN_, C_ -from pyanaconda.ui.lib.storage import create_partitioning, apply_partitioning +from pyanaconda.core.constants import ( + PARTITIONING_METHOD_BLIVET, + THREAD_EXECUTE_STORAGE, + THREAD_STORAGE, +) +from pyanaconda.core.i18n import C_, CN_, _ from pyanaconda.core.threads import thread_manager from pyanaconda.modules.common.constants.services import STORAGE +from pyanaconda.ui.categories.system import SystemCategory +from pyanaconda.ui.gui.spokes import NormalSpoke +from pyanaconda.ui.gui.spokes.lib.summary import ActionSummaryDialog +from pyanaconda.ui.helpers import StorageCheckHandler +from pyanaconda.ui.lib.storage import apply_partitioning, create_partitioning -import gi gi.require_version("Gtk", "3.0") from gi.repository import Gtk diff --git a/pyanaconda/ui/gui/spokes/custom_storage.py b/pyanaconda/ui/gui/spokes/custom_storage.py index 948299d215a..50e3858e9f4 100644 --- a/pyanaconda/ui/gui/spokes/custom_storage.py +++ b/pyanaconda/ui/gui/spokes/custom_storage.py @@ -27,51 +27,100 @@ # - Activating reformat should always enable resize for existing devices. import copy +import gi from dasbus.structure import compare_data from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.configuration.anaconda import conf -from pyanaconda.core.constants import THREAD_EXECUTE_STORAGE, THREAD_STORAGE, \ - PARTITIONING_METHOD_INTERACTIVE -from pyanaconda.core.i18n import _, N_, CP_, C_ +from pyanaconda.core.constants import ( + PARTITIONING_METHOD_INTERACTIVE, + THREAD_EXECUTE_STORAGE, + THREAD_STORAGE, +) +from pyanaconda.core.i18n import C_, CP_, N_, _ +from pyanaconda.core.product import get_product_name, get_product_version +from pyanaconda.core.storage import ( + CONTAINER_DEVICE_TYPES, + DEVICE_TEXT_MAP, + DEVICE_TYPE_BTRFS, + DEVICE_TYPE_MD, + DEVICE_TYPE_UNSUPPORTED, + MOUNTPOINT_DESCRIPTIONS, + NAMED_DEVICE_TYPES, + PROTECTED_FORMAT_TYPES, + Size, + device_type_from_autopart, +) +from pyanaconda.core.threads import thread_manager from pyanaconda.modules.common.constants.objects import BOOTLOADER, DISK_SELECTION from pyanaconda.modules.common.constants.services import STORAGE -from pyanaconda.modules.common.structures.storage import OSData, DeviceFormatData, DeviceData +from pyanaconda.modules.common.errors.configuration import ( + BootloaderConfigurationError, + StorageConfigurationError, +) +from pyanaconda.modules.common.structures.device_factory import ( + DeviceFactoryPermissions, + DeviceFactoryRequest, +) +from pyanaconda.modules.common.structures.partitioning import PartitioningRequest +from pyanaconda.modules.common.structures.storage import ( + DeviceData, + DeviceFormatData, + OSData, +) from pyanaconda.modules.common.structures.validation import ValidationReport from pyanaconda.modules.common.task import sync_run_task -from pyanaconda.modules.common.errors.configuration import BootloaderConfigurationError, \ - StorageConfigurationError -from pyanaconda.modules.common.structures.partitioning import PartitioningRequest -from pyanaconda.modules.common.structures.device_factory import DeviceFactoryRequest, \ - DeviceFactoryPermissions -from pyanaconda.core.product import get_product_name, get_product_version -from pyanaconda.ui.lib.storage import create_partitioning, apply_partitioning, \ - filter_disks_by_names -from pyanaconda.core.storage import DEVICE_TYPE_UNSUPPORTED, DEVICE_TEXT_MAP, \ - MOUNTPOINT_DESCRIPTIONS, NAMED_DEVICE_TYPES, CONTAINER_DEVICE_TYPES, device_type_from_autopart, \ - PROTECTED_FORMAT_TYPES, DEVICE_TYPE_BTRFS, DEVICE_TYPE_MD, Size - -from pyanaconda.core.threads import thread_manager from pyanaconda.ui.categories.system import SystemCategory from pyanaconda.ui.communication import hubQ from pyanaconda.ui.gui.spokes import NormalSpoke -from pyanaconda.ui.gui.spokes.lib.accordion import MountPointSelector, Accordion, Page, \ - CreateNewPage, UnknownPage +from pyanaconda.ui.gui.spokes.lib.accordion import ( + Accordion, + CreateNewPage, + MountPointSelector, + Page, + UnknownPage, +) from pyanaconda.ui.gui.spokes.lib.cart import SelectedDisksDialog -from pyanaconda.ui.gui.spokes.lib.custom_storage_helpers import get_size_from_entry, \ - get_selected_raid_level, get_default_raid_level, get_container_type, AddDialog,\ - ConfirmDeleteDialog, DisksDialog, ContainerDialog, NOTEBOOK_LABEL_PAGE, NOTEBOOK_DETAILS_PAGE,\ - NOTEBOOK_LUKS_PAGE, NOTEBOOK_UNEDITABLE_PAGE, NOTEBOOK_INCOMPLETE_PAGE, NEW_CONTAINER_TEXT,\ - CONTAINER_TOOLTIP, DESIRED_CAPACITY_ERROR, get_supported_device_raid_levels, \ - generate_request_description +from pyanaconda.ui.gui.spokes.lib.custom_storage_helpers import ( + CONTAINER_TOOLTIP, + DESIRED_CAPACITY_ERROR, + NEW_CONTAINER_TEXT, + NOTEBOOK_DETAILS_PAGE, + NOTEBOOK_INCOMPLETE_PAGE, + NOTEBOOK_LABEL_PAGE, + NOTEBOOK_LUKS_PAGE, + NOTEBOOK_UNEDITABLE_PAGE, + AddDialog, + ConfirmDeleteDialog, + ContainerDialog, + DisksDialog, + generate_request_description, + get_container_type, + get_default_raid_level, + get_selected_raid_level, + get_size_from_entry, + get_supported_device_raid_levels, +) from pyanaconda.ui.gui.spokes.lib.passphrase import PassphraseDialog from pyanaconda.ui.gui.spokes.lib.refresh import RefreshDialog from pyanaconda.ui.gui.spokes.lib.summary import ActionSummaryDialog -from pyanaconda.ui.gui.utils import setViewportBackground, fancy_set_sensitive, ignoreEscape, \ - really_hide, really_show, timed_action, escape_markup, set_password_visibility +from pyanaconda.ui.gui.utils import ( + escape_markup, + fancy_set_sensitive, + ignoreEscape, + really_hide, + really_show, + set_password_visibility, + setViewportBackground, + timed_action, +) from pyanaconda.ui.helpers import StorageCheckHandler +from pyanaconda.ui.lib.storage import ( + apply_partitioning, + create_partitioning, + filter_disks_by_names, +) -import gi gi.require_version("Gtk", "3.0") gi.require_version("Gdk", "3.0") from gi.repository import Gdk, Gtk diff --git a/pyanaconda/ui/gui/spokes/datetime_spoke.py b/pyanaconda/ui/gui/spokes/datetime_spoke.py index c379b391f70..cae76905894 100644 --- a/pyanaconda/ui/gui/spokes/datetime_spoke.py +++ b/pyanaconda/ui/gui/spokes/datetime_spoke.py @@ -16,38 +16,44 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # +import copy import datetime +import functools +import locale as locale_mod import re import time -import locale as locale_mod -import functools -import copy -from pyanaconda import ntp -from pyanaconda import flags +import gi + +from pyanaconda import flags, ntp from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core import constants from pyanaconda.core.async_utils import async_action_nowait from pyanaconda.core.configuration.anaconda import conf -from pyanaconda.core.i18n import _, CN_ +from pyanaconda.core.i18n import CN_, _ from pyanaconda.core.service import is_service_running, start_service, stop_service +from pyanaconda.core.threads import thread_manager from pyanaconda.core.timer import Timer from pyanaconda.localization import get_xlated_timezone, resolve_date_format +from pyanaconda.modules.common.constants.services import NETWORK, TIMEZONE from pyanaconda.modules.common.structures.timezone import TimeSourceData -from pyanaconda.modules.common.constants.services import TIMEZONE, NETWORK from pyanaconda.modules.common.util import is_module_available from pyanaconda.ntp import NTPServerStatusCache -from pyanaconda.ui.communication import hubQ +from pyanaconda.timezone import ( + NTP_SERVICE, + get_all_regions_and_timezones, + get_timezone, + is_valid_timezone, + parse_timezone, + set_system_date_time, +) +from pyanaconda.ui.categories.localization import LocalizationCategory from pyanaconda.ui.common import FirstbootSpokeMixIn +from pyanaconda.ui.communication import hubQ from pyanaconda.ui.gui.spokes import NormalSpoke -from pyanaconda.ui.categories.localization import LocalizationCategory -from pyanaconda.ui.gui.utils import blockedHandler as blocked_handler from pyanaconda.ui.gui.spokes.lib.ntp_dialog import NTPConfigDialog -from pyanaconda.timezone import NTP_SERVICE, get_all_regions_and_timezones, get_timezone, \ - is_valid_timezone, set_system_date_time, parse_timezone -from pyanaconda.core.threads import thread_manager +from pyanaconda.ui.gui.utils import blockedHandler as blocked_handler -import gi gi.require_version("Gdk", "3.0") gi.require_version("Gtk", "3.0") diff --git a/pyanaconda/ui/gui/spokes/installation_progress.py b/pyanaconda/ui/gui/spokes/installation_progress.py index 7cd1cd257d1..f85db083147 100644 --- a/pyanaconda/ui/gui/spokes/installation_progress.py +++ b/pyanaconda/ui/gui/spokes/installation_progress.py @@ -14,14 +14,15 @@ # source code or documentation are not subject to the GNU General Public # License and may only be used or replicated with the express permission of # Red Hat, Inc. +from pykickstart.constants import KS_REBOOT, KS_SHUTDOWN + from pyanaconda.anaconda_loggers import get_module_logger -from pyanaconda.core.i18n import _, C_ -from pyanaconda.core.product import get_product_name -from pyanaconda.flags import flags from pyanaconda.core import util from pyanaconda.core.configuration.anaconda import conf from pyanaconda.core.constants import IPMI_FINISHED -from pykickstart.constants import KS_SHUTDOWN, KS_REBOOT +from pyanaconda.core.i18n import C_, _ +from pyanaconda.core.product import get_product_name +from pyanaconda.flags import flags from pyanaconda.ui.gui.hubs.summary import SummaryHub from pyanaconda.ui.gui.spokes import StandaloneSpoke from pyanaconda.ui.gui.utils import gtk_call_once diff --git a/pyanaconda/ui/gui/spokes/installation_source.py b/pyanaconda/ui/gui/spokes/installation_source.py index 6c1334c1c13..b9d9f92a77b 100644 --- a/pyanaconda/ui/gui/spokes/installation_source.py +++ b/pyanaconda/ui/gui/spokes/installation_source.py @@ -23,46 +23,75 @@ from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core import constants from pyanaconda.core.configuration.anaconda import conf -from pyanaconda.core.constants import PAYLOAD_TYPE_DNF, SOURCE_TYPE_HDD, SOURCE_TYPE_URL, \ - SOURCE_TYPE_CDROM, SOURCE_TYPE_NFS, SOURCE_TYPE_HMC, URL_TYPE_BASEURL, \ - SOURCE_TYPE_CLOSEST_MIRROR, SOURCE_TYPE_CDN, PAYLOAD_STATUS_SETTING_SOURCE, \ - PAYLOAD_STATUS_INVALID_SOURCE, PAYLOAD_STATUS_CHECKING_SOFTWARE, SOURCE_TYPE_REPO_PATH, \ - DRACUT_REPO_DIR -from pyanaconda.core.i18n import _, CN_, C_ +from pyanaconda.core.constants import ( + DRACUT_REPO_DIR, + PAYLOAD_STATUS_CHECKING_SOFTWARE, + PAYLOAD_STATUS_INVALID_SOURCE, + PAYLOAD_STATUS_SETTING_SOURCE, + PAYLOAD_TYPE_DNF, + SOURCE_TYPE_CDN, + SOURCE_TYPE_CDROM, + SOURCE_TYPE_CLOSEST_MIRROR, + SOURCE_TYPE_HDD, + SOURCE_TYPE_HMC, + SOURCE_TYPE_NFS, + SOURCE_TYPE_REPO_PATH, + SOURCE_TYPE_URL, + URL_TYPE_BASEURL, +) +from pyanaconda.core.i18n import C_, CN_, _ from pyanaconda.core.path import join_paths -from pyanaconda.core.payload import parse_nfs_url, create_nfs_url, parse_hdd_url -from pyanaconda.core.regexes import URL_PARSE, HOSTNAME_PATTERN_WITHOUT_ANCHORS +from pyanaconda.core.payload import create_nfs_url, parse_hdd_url, parse_nfs_url +from pyanaconda.core.regexes import HOSTNAME_PATTERN_WITHOUT_ANCHORS, URL_PARSE +from pyanaconda.core.threads import thread_manager from pyanaconda.flags import flags from pyanaconda.modules.common.constants.objects import DEVICE_TREE -from pyanaconda.modules.common.constants.services import NETWORK, STORAGE -from pyanaconda.modules.common.constants.services import SUBSCRIPTION +from pyanaconda.modules.common.constants.services import NETWORK, STORAGE, SUBSCRIPTION from pyanaconda.modules.common.structures.payload import RepoConfigurationData -from pyanaconda.modules.common.structures.storage import DeviceFormatData, DeviceData +from pyanaconda.modules.common.structures.storage import DeviceData, DeviceFormatData from pyanaconda.modules.common.util import is_module_available from pyanaconda.modules.payloads.source.utils import verify_valid_repository from pyanaconda.payload import utils as payload_utils from pyanaconda.payload.image import find_optical_install_media from pyanaconda.payload.manager import payloadMgr -from pyanaconda.core.threads import thread_manager from pyanaconda.ui.categories.software import SoftwareCategory from pyanaconda.ui.communication import hubQ from pyanaconda.ui.context import context from pyanaconda.ui.gui.helpers import GUISpokeInputCheckHandler from pyanaconda.ui.gui.spokes import NormalSpoke -from pyanaconda.ui.gui.spokes.lib.additional_repositories import AdditionalRepositoriesSection -from pyanaconda.ui.gui.spokes.lib.installation_source_helpers import ProxyDialog, \ - MediaCheckDialog, IsoChooser, PROTOCOL_HTTP, PROTOCOL_HTTPS, PROTOCOL_FTP, PROTOCOL_NFS, \ - PROTOCOL_MIRROR, CLICK_FOR_DETAILS -from pyanaconda.ui.gui.utils import blockedHandler, fire_gtk_action -from pyanaconda.ui.gui.utils import gtk_call_once, really_hide, really_show +from pyanaconda.ui.gui.spokes.lib.additional_repositories import ( + AdditionalRepositoriesSection, +) +from pyanaconda.ui.gui.spokes.lib.installation_source_helpers import ( + CLICK_FOR_DETAILS, + PROTOCOL_FTP, + PROTOCOL_HTTP, + PROTOCOL_HTTPS, + PROTOCOL_MIRROR, + PROTOCOL_NFS, + IsoChooser, + MediaCheckDialog, + ProxyDialog, +) +from pyanaconda.ui.gui.utils import ( + blockedHandler, + fire_gtk_action, + gtk_call_once, + really_hide, + really_show, +) from pyanaconda.ui.helpers import InputCheck, SourceSwitchHandler -from pyanaconda.ui.lib.payload import find_potential_hdiso_sources, get_hdiso_source_info, \ - get_hdiso_source_description +from pyanaconda.ui.lib.payload import ( + find_potential_hdiso_sources, + get_hdiso_source_description, + get_hdiso_source_info, +) from pyanaconda.ui.lib.subscription import switch_source log = get_module_logger(__name__) import gi + gi.require_version("Gtk", "3.0") from gi.repository import Gtk diff --git a/pyanaconda/ui/gui/spokes/keyboard.py b/pyanaconda/ui/gui/spokes/keyboard.py index 2af9f448117..367f03d059c 100644 --- a/pyanaconda/ui/gui/spokes/keyboard.py +++ b/pyanaconda/ui/gui/spokes/keyboard.py @@ -19,25 +19,33 @@ import locale as locale_mod +from pyanaconda import flags, keyboard +from pyanaconda.anaconda_loggers import get_module_logger +from pyanaconda.core.constants import ( + DEFAULT_KEYBOARD, + THREAD_ADD_LAYOUTS_INIT, + THREAD_KEYBOARD_INIT, +) +from pyanaconda.core.i18n import CN_, N_, _ +from pyanaconda.core.process_watchers import PidWatcher +from pyanaconda.core.string import have_word_match, strip_accents +from pyanaconda.core.threads import thread_manager +from pyanaconda.core.util import startProgram +from pyanaconda.modules.common.constants.services import LOCALIZATION +from pyanaconda.modules.common.util import is_module_available +from pyanaconda.ui.categories.localization import LocalizationCategory +from pyanaconda.ui.communication import hubQ from pyanaconda.ui.gui import GUIObject from pyanaconda.ui.gui.spokes import NormalSpoke -from pyanaconda.ui.categories.localization import LocalizationCategory -from pyanaconda.ui.gui.utils import gtk_call_once, escape_markup, gtk_batch_map, timed_action -from pyanaconda.ui.gui.utils import override_cell_property +from pyanaconda.ui.gui.utils import ( + escape_markup, + gtk_batch_map, + gtk_call_once, + override_cell_property, + timed_action, +) from pyanaconda.ui.gui.xkl_wrapper import XklWrapper -from pyanaconda import keyboard -from pyanaconda import flags -from pyanaconda.core.i18n import _, N_, CN_ -from pyanaconda.core.constants import DEFAULT_KEYBOARD, THREAD_KEYBOARD_INIT, THREAD_ADD_LAYOUTS_INIT -from pyanaconda.ui.communication import hubQ -from pyanaconda.core.string import strip_accents, have_word_match -from pyanaconda.modules.common.constants.services import LOCALIZATION -from pyanaconda.modules.common.util import is_module_available -from pyanaconda.core.threads import thread_manager -from pyanaconda.core.process_watchers import PidWatcher -from pyanaconda.core.util import startProgram -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) __all__ = ["KeyboardSpoke"] diff --git a/pyanaconda/ui/gui/spokes/language_support.py b/pyanaconda/ui/gui/spokes/language_support.py index 7fadf50a308..d23201ad7bd 100644 --- a/pyanaconda/ui/gui/spokes/language_support.py +++ b/pyanaconda/ui/gui/spokes/language_support.py @@ -18,25 +18,26 @@ # import gi + gi.require_version("Pango", "1.0") gi.require_version("Gdk", "3.0") -from gi.repository import Pango, Gdk +import re + +from gi.repository import Gdk, Pango +from pyanaconda import localization +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.constants import PAYLOAD_LIVE_TYPES +from pyanaconda.core.i18n import CN_ from pyanaconda.modules.common.constants.services import LOCALIZATION from pyanaconda.modules.common.util import is_module_available -from pyanaconda.core.i18n import CN_ +from pyanaconda.ui.categories.localization import LocalizationCategory from pyanaconda.ui.context import context from pyanaconda.ui.gui.spokes import NormalSpoke -from pyanaconda.ui.gui.utils import escape_markup, override_cell_property -from pyanaconda.ui.categories.localization import LocalizationCategory from pyanaconda.ui.gui.spokes.lib.lang_locale_handler import LangLocaleHandler -from pyanaconda import localization - -import re +from pyanaconda.ui.gui.utils import escape_markup, override_cell_property -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) __all__ = ["LangsupportSpoke"] diff --git a/pyanaconda/ui/gui/spokes/lib/accordion.py b/pyanaconda/ui/gui/spokes/lib/accordion.py index a5819ed2d75..3574f38216e 100644 --- a/pyanaconda/ui/gui/spokes/lib/accordion.py +++ b/pyanaconda/ui/gui/spokes/lib/accordion.py @@ -17,16 +17,17 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # +import gi + from pyanaconda.anaconda_loggers import get_module_logger -from pyanaconda.core.i18n import _, C_ +from pyanaconda.core.i18n import C_, _ from pyanaconda.core.product import get_product_name, get_product_version from pyanaconda.core.storage import get_supported_autopart_choices from pyanaconda.ui.gui.utils import escape_markup, really_hide, really_show -import gi gi.require_version("AnacondaWidgets", "3.4") gi.require_version("Gtk", "3.0") -from gi.repository import Gtk, AnacondaWidgets +from gi.repository import AnacondaWidgets, Gtk log = get_module_logger(__name__) diff --git a/pyanaconda/ui/gui/spokes/lib/additional_repositories.py b/pyanaconda/ui/gui/spokes/lib/additional_repositories.py index cb849621bc4..dff2c1e1d40 100644 --- a/pyanaconda/ui/gui/spokes/lib/additional_repositories.py +++ b/pyanaconda/ui/gui/spokes/lib/additional_repositories.py @@ -20,9 +20,11 @@ from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.constants import REPO_ORIGIN_TREEINFO from pyanaconda.modules.common.structures.payload import RepoConfigurationData -from pyanaconda.ui.gui.spokes.lib.installation_source_helpers import \ - validate_additional_repositories, collect_conflicting_repo_names, \ - generate_repository_description +from pyanaconda.ui.gui.spokes.lib.installation_source_helpers import ( + collect_conflicting_repo_names, + generate_repository_description, + validate_additional_repositories, +) log = get_module_logger(__name__) diff --git a/pyanaconda/ui/gui/spokes/lib/cart.py b/pyanaconda/ui/gui/spokes/lib/cart.py index ed0bbc86f39..3d10ace7dc5 100644 --- a/pyanaconda/ui/gui/spokes/lib/cart.py +++ b/pyanaconda/ui/gui/spokes/lib/cart.py @@ -17,16 +17,20 @@ # Red Hat, Inc. # from blivet import arch +from blivet.size import Size -from pyanaconda.modules.common.structures.storage import DeviceData -from pyanaconda.core.constants import BOOTLOADER_ENABLED, BOOTLOADER_LOCATION_MBR, \ - BOOTLOADER_DRIVE_UNSET, BOOTLOADER_SKIPPED +from pyanaconda.core.constants import ( + BOOTLOADER_DRIVE_UNSET, + BOOTLOADER_ENABLED, + BOOTLOADER_LOCATION_MBR, + BOOTLOADER_SKIPPED, +) from pyanaconda.core.i18n import C_ from pyanaconda.modules.common.constants.objects import BOOTLOADER, DEVICE_TREE from pyanaconda.modules.common.constants.services import STORAGE +from pyanaconda.modules.common.structures.storage import DeviceData from pyanaconda.ui.gui import GUIObject from pyanaconda.ui.lib.storage import get_disks_summary -from blivet.size import Size __all__ = ["SelectedDisksDialog"] diff --git a/pyanaconda/ui/gui/spokes/lib/custom_storage_helpers.py b/pyanaconda/ui/gui/spokes/lib/custom_storage_helpers.py index 6296236c4b0..0a20b0fbfce 100644 --- a/pyanaconda/ui/gui/spokes/lib/custom_storage_helpers.py +++ b/pyanaconda/ui/gui/spokes/lib/custom_storage_helpers.py @@ -21,19 +21,29 @@ from dasbus.structure import get_fields from pyanaconda.anaconda_loggers import get_module_logger -from pyanaconda.core.i18n import _, N_, CN_, C_ -from pyanaconda.core.storage import PROTECTED_FORMAT_TYPES, SIZE_POLICY_AUTO, SIZE_POLICY_MAX, \ - DEVICE_TYPE_LVM, DEVICE_TYPE_BTRFS, DEVICE_TYPE_LVM_THINP, DEVICE_TYPE_MD, Size +from pyanaconda.core.i18n import C_, CN_, N_, _ +from pyanaconda.core.storage import ( + DEVICE_TYPE_BTRFS, + DEVICE_TYPE_LVM, + DEVICE_TYPE_LVM_THINP, + DEVICE_TYPE_MD, + PROTECTED_FORMAT_TYPES, + SIZE_POLICY_AUTO, + SIZE_POLICY_MAX, + Size, +) from pyanaconda.core.string import lower_ascii -from pyanaconda.modules.common.structures.device_factory import DeviceFactoryRequest, \ - DeviceFactoryPermissions -from pyanaconda.modules.common.structures.storage import DeviceFormatData, DeviceData +from pyanaconda.modules.common.structures.device_factory import ( + DeviceFactoryPermissions, + DeviceFactoryRequest, +) +from pyanaconda.modules.common.structures.storage import DeviceData, DeviceFormatData from pyanaconda.modules.common.structures.validation import ValidationReport -from pyanaconda.ui.lib.storage import size_from_input -from pyanaconda.ui.helpers import InputCheck from pyanaconda.ui.gui import GUIObject from pyanaconda.ui.gui.helpers import GUIDialogInputCheckHandler from pyanaconda.ui.gui.utils import fancy_set_sensitive, really_hide, really_show +from pyanaconda.ui.helpers import InputCheck +from pyanaconda.ui.lib.storage import size_from_input log = get_module_logger(__name__) diff --git a/pyanaconda/ui/gui/spokes/lib/dasdfmt.py b/pyanaconda/ui/gui/spokes/lib/dasdfmt.py index 7abb51da574..0710ac25509 100644 --- a/pyanaconda/ui/gui/spokes/lib/dasdfmt.py +++ b/pyanaconda/ui/gui/spokes/lib/dasdfmt.py @@ -16,14 +16,15 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # +import threading + +from pyanaconda.anaconda_loggers import get_module_logger +from pyanaconda.core import constants +from pyanaconda.core.async_utils import async_action_wait from pyanaconda.core.threads import thread_manager from pyanaconda.ui.gui import GUIObject from pyanaconda.ui.gui.utils import gtk_call_once -from pyanaconda.core.async_utils import async_action_wait -from pyanaconda.core import constants -import threading -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) __all__ = ["DasdFormatDialog"] diff --git a/pyanaconda/ui/gui/spokes/lib/installation_source_helpers.py b/pyanaconda/ui/gui/spokes/lib/installation_source_helpers.py index 2e30f5d41ca..58d7d8b812f 100644 --- a/pyanaconda/ui/gui/spokes/lib/installation_source_helpers.py +++ b/pyanaconda/ui/gui/spokes/lib/installation_source_helpers.py @@ -20,16 +20,21 @@ import signal from functools import partial +import gi from dasbus.structure import get_fields from pyanaconda.anaconda_loggers import get_module_logger -from pyanaconda.core import glib, constants +from pyanaconda.core import constants, glib from pyanaconda.core.constants import REPO_ORIGIN_USER -from pyanaconda.core.i18n import _, N_, C_ +from pyanaconda.core.i18n import C_, N_, _ from pyanaconda.core.path import join_paths from pyanaconda.core.payload import ProxyString, ProxyStringError, parse_nfs_url from pyanaconda.core.process_watchers import PidWatcher -from pyanaconda.core.regexes import URL_PARSE, REPO_NAME_VALID, HOSTNAME_PATTERN_WITHOUT_ANCHORS +from pyanaconda.core.regexes import ( + HOSTNAME_PATTERN_WITHOUT_ANCHORS, + REPO_NAME_VALID, + URL_PARSE, +) from pyanaconda.modules.common.structures.payload import RepoConfigurationData from pyanaconda.modules.common.structures.validation import ValidationReport from pyanaconda.payload import utils as payload_utils @@ -38,7 +43,6 @@ from pyanaconda.ui.gui.utils import find_first_child, set_password_visibility from pyanaconda.ui.helpers import InputCheck -import gi gi.require_version("Gtk", "3.0") from gi.repository import Gtk diff --git a/pyanaconda/ui/gui/spokes/lib/lang_locale_handler.py b/pyanaconda/ui/gui/spokes/lib/lang_locale_handler.py index a4c990fcc70..c7e7a5790ac 100644 --- a/pyanaconda/ui/gui/spokes/lib/lang_locale_handler.py +++ b/pyanaconda/ui/gui/spokes/lib/lang_locale_handler.py @@ -24,15 +24,20 @@ from abc import ABCMeta, abstractmethod +import gi + from pyanaconda import localization from pyanaconda.core.string import strip_accents -from pyanaconda.ui.gui.utils import set_treeview_selection, timed_action, override_cell_property +from pyanaconda.ui.gui.utils import ( + override_cell_property, + set_treeview_selection, + timed_action, +) -import gi gi.require_version("Gtk", "3.0") gi.require_version("Pango", "1.0") gi.require_version("GdkPixbuf", "2.0") -from gi.repository import Gtk, Pango, GdkPixbuf +from gi.repository import GdkPixbuf, Gtk, Pango class LangLocaleHandler(metaclass=ABCMeta): diff --git a/pyanaconda/ui/gui/spokes/lib/network_secret_agent.py b/pyanaconda/ui/gui/spokes/lib/network_secret_agent.py index 02dce2d09a1..67d854b9171 100644 --- a/pyanaconda/ui/gui/spokes/lib/network_secret_agent.py +++ b/pyanaconda/ui/gui/spokes/lib/network_secret_agent.py @@ -18,24 +18,25 @@ # import gi + gi.require_version("Gtk", "3.0") gi.require_version("NM", "1.0") -from gi.repository import Gtk, NM +from string import ascii_letters, hexdigits # pylint: disable=deprecated-module -from dasbus.typing import * # pylint: disable=wildcard-import from dasbus.identifier import DBusObjectIdentifier from dasbus.server.interface import dbus_interface -from string import hexdigits, ascii_letters # pylint: disable=deprecated-module +from dasbus.typing import * # pylint: disable=wildcard-import +from gi.repository import NM, Gtk -from pyanaconda.core.i18n import _, C_ -from pyanaconda.core.dbus import SystemBus +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.configuration.anaconda import conf -from pyanaconda.modules.common.constants.services import NETWORK_MANAGER +from pyanaconda.core.dbus import SystemBus +from pyanaconda.core.i18n import C_, _ from pyanaconda.modules.common.constants.namespaces import NETWORK_MANAGER_NAMESPACE +from pyanaconda.modules.common.constants.services import NETWORK_MANAGER from pyanaconda.ui.gui import GUIObject -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) NM_SECRET_AGENT_GET_SECRETS_FLAG_ALLOW_INTERACTION = 0x1 diff --git a/pyanaconda/ui/gui/spokes/lib/ntp_dialog.py b/pyanaconda/ui/gui/spokes/lib/ntp_dialog.py index 325f2e57e09..834f68a417a 100644 --- a/pyanaconda/ui/gui/spokes/lib/ntp_dialog.py +++ b/pyanaconda/ui/gui/spokes/lib/ntp_dialog.py @@ -16,8 +16,7 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from pyanaconda import network -from pyanaconda import ntp +from pyanaconda import network, ntp from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core import constants from pyanaconda.core.configuration.anaconda import conf @@ -25,9 +24,9 @@ from pyanaconda.core.service import restart_service from pyanaconda.core.timer import Timer from pyanaconda.modules.common.structures.timezone import TimeSourceData +from pyanaconda.timezone import NTP_SERVICE from pyanaconda.ui.gui import GUIObject from pyanaconda.ui.gui.utils import override_cell_property -from pyanaconda.timezone import NTP_SERVICE log = get_module_logger(__name__) diff --git a/pyanaconda/ui/gui/spokes/lib/passphrase.py b/pyanaconda/ui/gui/spokes/lib/passphrase.py index e3956bcefac..4124b48f103 100644 --- a/pyanaconda/ui/gui/spokes/lib/passphrase.py +++ b/pyanaconda/ui/gui/spokes/lib/passphrase.py @@ -16,6 +16,8 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # +import gi + from pyanaconda import input_checking from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core import constants @@ -24,7 +26,6 @@ from pyanaconda.ui.gui import GUIObject from pyanaconda.ui.gui.utils import really_hide, really_show, set_password_visibility -import gi gi.require_version("Gtk", "3.0") from gi.repository import Gtk diff --git a/pyanaconda/ui/gui/spokes/lib/refresh.py b/pyanaconda/ui/gui/spokes/lib/refresh.py index 0d84de34ba5..b512df18034 100644 --- a/pyanaconda/ui/gui/spokes/lib/refresh.py +++ b/pyanaconda/ui/gui/spokes/lib/refresh.py @@ -16,10 +16,10 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from pyanaconda.core.timer import Timer +from pyanaconda.core import constants from pyanaconda.core.threads import thread_manager +from pyanaconda.core.timer import Timer from pyanaconda.ui.gui import GUIObject -from pyanaconda.core import constants from pyanaconda.ui.lib.storage import reset_storage __all__ = ["RefreshDialog"] diff --git a/pyanaconda/ui/gui/spokes/lib/resize.py b/pyanaconda/ui/gui/spokes/lib/resize.py index 4aa8953c9e0..32934b2d42a 100644 --- a/pyanaconda/ui/gui/spokes/lib/resize.py +++ b/pyanaconda/ui/gui/spokes/lib/resize.py @@ -17,16 +17,21 @@ # Red Hat, Inc. # from collections import namedtuple + +import gi from blivet.size import Size from pyanaconda.anaconda_loggers import get_module_logger -from pyanaconda.core.i18n import _, C_, N_, P_ +from pyanaconda.core.i18n import C_, N_, P_, _ from pyanaconda.modules.common.constants.services import STORAGE -from pyanaconda.modules.common.structures.storage import OSData, DeviceData, DeviceFormatData +from pyanaconda.modules.common.structures.storage import ( + DeviceData, + DeviceFormatData, + OSData, +) from pyanaconda.ui.gui import GUIObject from pyanaconda.ui.gui.utils import blockedHandler, escape_markup, timed_action -import gi gi.require_version("Gdk", "3.0") gi.require_version("Gtk", "3.0") from gi.repository import Gdk, Gtk diff --git a/pyanaconda/ui/gui/spokes/lib/software_selection.py b/pyanaconda/ui/gui/spokes/lib/software_selection.py index 497dbe14359..aa74f846d8b 100644 --- a/pyanaconda/ui/gui/spokes/lib/software_selection.py +++ b/pyanaconda/ui/gui/spokes/lib/software_selection.py @@ -15,10 +15,11 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # +import gi + from pyanaconda.anaconda_loggers import get_module_logger -from pyanaconda.ui.gui.utils import escape_markup, blockedHandler +from pyanaconda.ui.gui.utils import blockedHandler, escape_markup -import gi gi.require_version("Gtk", "3.0") gi.require_version("Pango", "1.0") from gi.repository import Gtk, Pango diff --git a/pyanaconda/ui/gui/spokes/lib/storage_dialogs.py b/pyanaconda/ui/gui/spokes/lib/storage_dialogs.py index 9e91b7d8b9b..2bc69c8f3d6 100644 --- a/pyanaconda/ui/gui/spokes/lib/storage_dialogs.py +++ b/pyanaconda/ui/gui/spokes/lib/storage_dialogs.py @@ -20,9 +20,9 @@ from pyanaconda.core import constants from pyanaconda.core.constants import PAYLOAD_LIVE_TYPES from pyanaconda.core.i18n import _ -from pyanaconda.core.timer import Timer from pyanaconda.core.product import get_product_name from pyanaconda.core.threads import thread_manager +from pyanaconda.core.timer import Timer from pyanaconda.ui.gui import GUIObject from pyanaconda.ui.gui.utils import escape_markup diff --git a/pyanaconda/ui/gui/spokes/lib/subscription.py b/pyanaconda/ui/gui/spokes/lib/subscription.py index 578eb6f0a12..f4bf7777531 100644 --- a/pyanaconda/ui/gui/spokes/lib/subscription.py +++ b/pyanaconda/ui/gui/spokes/lib/subscription.py @@ -19,9 +19,9 @@ from collections import namedtuple +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.i18n import _ -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) diff --git a/pyanaconda/ui/gui/spokes/network.py b/pyanaconda/ui/gui/spokes/network.py index b66d3e2f06a..5d315b52fa2 100644 --- a/pyanaconda/ui/gui/spokes/network.py +++ b/pyanaconda/ui/gui/spokes/network.py @@ -18,41 +18,46 @@ # import gi + gi.require_version("Gtk", "3.0") gi.require_version("GObject", "2.0") gi.require_version("Pango", "1.0") gi.require_version("Gio", "2.0") gi.require_version("NM", "1.0") -from gi.repository import Gtk -from gi.repository import GObject, Pango, Gio, NM +from uuid import uuid4 + +from gi.repository import NM, Gio, GObject, Gtk, Pango -from pyanaconda.core.i18n import _, N_, CN_ +from pyanaconda import network +from pyanaconda.anaconda_loggers import get_module_logger +from pyanaconda.core import glib +from pyanaconda.core.configuration.anaconda import conf +from pyanaconda.core.constants import ANACONDA_ENVIRON, NETWORK_CAPABILITY_TEAM +from pyanaconda.core.i18n import CN_, N_, _ +from pyanaconda.core.process_watchers import PidWatcher +from pyanaconda.core.util import startProgram from pyanaconda.flags import flags as anaconda_flags +from pyanaconda.modules.common.constants.services import NETWORK +from pyanaconda.modules.common.structures.network import NetworkDeviceConfiguration +from pyanaconda.modules.network.constants import ( + NM_CONNECTION_TYPE_ETHERNET, + NM_CONNECTION_TYPE_WIFI, +) +from pyanaconda.ui.categories.system import SystemCategory +from pyanaconda.ui.common import FirstbootSpokeMixIn from pyanaconda.ui.communication import hubQ from pyanaconda.ui.gui import GUIObject +from pyanaconda.ui.gui.hubs.summary import SummaryHub from pyanaconda.ui.gui.spokes import NormalSpoke, StandaloneSpoke from pyanaconda.ui.gui.spokes.lib.network_secret_agent import register_secret_agent -from pyanaconda.ui.categories.system import SystemCategory -from pyanaconda.ui.gui.hubs.summary import SummaryHub -from pyanaconda.ui.gui.utils import gtk_call_once, escape_markup, really_hide, really_show -from pyanaconda.ui.common import FirstbootSpokeMixIn -from pyanaconda.core.configuration.anaconda import conf -from pyanaconda.core.util import startProgram -from pyanaconda.core.process_watchers import PidWatcher -from pyanaconda.core.constants import ANACONDA_ENVIRON, NETWORK_CAPABILITY_TEAM -from pyanaconda.core import glib -from pyanaconda.modules.common.constants.services import NETWORK -from pyanaconda.modules.common.structures.network import NetworkDeviceConfiguration -from pyanaconda.modules.network.constants import NM_CONNECTION_TYPE_WIFI, \ - NM_CONNECTION_TYPE_ETHERNET - - -from pyanaconda import network +from pyanaconda.ui.gui.utils import ( + escape_markup, + gtk_call_once, + really_hide, + really_show, +) -from uuid import uuid4 - -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) NM._80211ApFlags = getattr(NM, "80211ApFlags") diff --git a/pyanaconda/ui/gui/spokes/root_password.py b/pyanaconda/ui/gui/spokes/root_password.py index 10f0b678c55..a2b72ff9155 100644 --- a/pyanaconda/ui/gui/spokes/root_password.py +++ b/pyanaconda/ui/gui/spokes/root_password.py @@ -16,22 +16,25 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from pyanaconda.core.constants import PASSWORD_POLICY_ROOT -from pyanaconda.core.i18n import _, CN_ -from pyanaconda.core.users import crypt_password from pyanaconda import input_checking +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core import constants -from pyanaconda.modules.common.util import is_module_available +from pyanaconda.core.constants import PASSWORD_POLICY_ROOT +from pyanaconda.core.i18n import CN_, _ +from pyanaconda.core.users import crypt_password from pyanaconda.modules.common.constants.services import USERS -from pyanaconda.ui.gui.spokes import NormalSpoke +from pyanaconda.modules.common.util import is_module_available from pyanaconda.ui.categories.user_settings import UserSettingsCategory -from pyanaconda.ui.gui.helpers import GUISpokeInputCheckHandler -from pyanaconda.ui.gui.utils import set_password_visibility from pyanaconda.ui.common import FirstbootSpokeMixIn from pyanaconda.ui.communication import hubQ -from pyanaconda.ui.lib.users import can_modify_root_configuration, get_root_configuration_status +from pyanaconda.ui.gui.helpers import GUISpokeInputCheckHandler +from pyanaconda.ui.gui.spokes import NormalSpoke +from pyanaconda.ui.gui.utils import set_password_visibility +from pyanaconda.ui.lib.users import ( + can_modify_root_configuration, + get_root_configuration_status, +) -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) __all__ = ["PasswordSpoke"] diff --git a/pyanaconda/ui/gui/spokes/software_selection.py b/pyanaconda/ui/gui/spokes/software_selection.py index 2639f8ece50..8ada5b317c2 100644 --- a/pyanaconda/ui/gui/spokes/software_selection.py +++ b/pyanaconda/ui/gui/spokes/software_selection.py @@ -18,29 +18,46 @@ # import sys +import gi + from pyanaconda.anaconda_loggers import get_module_logger -from pyanaconda.core.constants import PAYLOAD_TYPE_DNF, THREAD_SOFTWARE_WATCHER, THREAD_PAYLOAD, \ - THREAD_CHECK_SOFTWARE, PAYLOAD_STATUS_CHECKING_SOFTWARE -from pyanaconda.core.i18n import _, C_, CN_ +from pyanaconda.core.configuration.anaconda import conf +from pyanaconda.core.constants import ( + PAYLOAD_STATUS_CHECKING_SOFTWARE, + PAYLOAD_TYPE_DNF, + THREAD_CHECK_SOFTWARE, + THREAD_PAYLOAD, + THREAD_SOFTWARE_WATCHER, +) +from pyanaconda.core.i18n import C_, CN_, _ +from pyanaconda.core.threads import thread_manager from pyanaconda.core.util import ipmi_abort from pyanaconda.flags import flags -from pyanaconda.core.threads import thread_manager from pyanaconda.ui.categories.software import SoftwareCategory from pyanaconda.ui.communication import hubQ from pyanaconda.ui.context import context from pyanaconda.ui.gui.spokes import NormalSpoke from pyanaconda.ui.gui.spokes.lib.detailederror import DetailedErrorDialog -from pyanaconda.ui.gui.spokes.lib.software_selection import GroupListBoxRow, SeparatorRow, \ - EnvironmentListBoxRow +from pyanaconda.ui.gui.spokes.lib.software_selection import ( + EnvironmentListBoxRow, + GroupListBoxRow, + SeparatorRow, +) from pyanaconda.ui.gui.utils import escape_markup -from pyanaconda.ui.lib.software import SoftwareSelectionCache, get_software_selection_status, \ - is_software_selection_complete, get_group_data, get_environment_data +from pyanaconda.ui.lib.software import ( + FEATURE_64K, + KernelFeatures, + SoftwareSelectionCache, + get_available_kernel_features, + get_environment_data, + get_group_data, + get_kernel_from_properties, + get_kernel_titles_and_descriptions, + get_software_selection_status, + is_software_selection_complete, +) from pyanaconda.ui.lib.subscription import is_cdn_registration_required -from pyanaconda.ui.lib.software import FEATURE_64K, KernelFeatures, get_kernel_from_properties, \ - get_available_kernel_features, get_kernel_titles_and_descriptions -from pyanaconda.core.configuration.anaconda import conf -import gi gi.require_version("Gtk", "3.0") from gi.repository import Gtk diff --git a/pyanaconda/ui/gui/spokes/storage.py b/pyanaconda/ui/gui/spokes/storage.py index 73b0c688e41..579f8ccde6b 100644 --- a/pyanaconda/ui/gui/spokes/storage.py +++ b/pyanaconda/ui/gui/spokes/storage.py @@ -18,24 +18,37 @@ # import sys +import gi from blivet.size import Size + from pyanaconda.anaconda_loggers import get_module_logger -from pyanaconda.core import util, constants +from pyanaconda.core import constants, util from pyanaconda.core.async_utils import async_action_nowait, async_action_wait from pyanaconda.core.configuration.anaconda import conf -from pyanaconda.core.constants import CLEAR_PARTITIONS_NONE, BOOTLOADER_ENABLED, \ - STORAGE_METADATA_RATIO, WARNING_NO_DISKS_SELECTED, WARNING_NO_DISKS_DETECTED, \ - PARTITIONING_METHOD_AUTOMATIC, PARTITIONING_METHOD_INTERACTIVE, PARTITIONING_METHOD_BLIVET -from pyanaconda.core.i18n import _, C_, CN_ +from pyanaconda.core.constants import ( + BOOTLOADER_ENABLED, + CLEAR_PARTITIONS_NONE, + PARTITIONING_METHOD_AUTOMATIC, + PARTITIONING_METHOD_BLIVET, + PARTITIONING_METHOD_INTERACTIVE, + STORAGE_METADATA_RATIO, + WARNING_NO_DISKS_DETECTED, + WARNING_NO_DISKS_SELECTED, +) +from pyanaconda.core.i18n import C_, CN_, _ +from pyanaconda.core.storage import suggest_swap_size +from pyanaconda.core.threads import thread_manager from pyanaconda.flags import flags -from pyanaconda.modules.common.constants.objects import DISK_SELECTION, DISK_INITIALIZATION, \ - BOOTLOADER, DEVICE_TREE +from pyanaconda.modules.common.constants.objects import ( + BOOTLOADER, + DEVICE_TREE, + DISK_INITIALIZATION, + DISK_SELECTION, +) from pyanaconda.modules.common.constants.services import STORAGE from pyanaconda.modules.common.structures.partitioning import PartitioningRequest from pyanaconda.modules.common.structures.storage import DeviceData from pyanaconda.modules.common.structures.validation import ValidationReport -from pyanaconda.core.storage import suggest_swap_size -from pyanaconda.core.threads import thread_manager from pyanaconda.ui.categories.system import SystemCategory from pyanaconda.ui.communication import hubQ from pyanaconda.ui.gui.spokes import NormalSpoke @@ -45,22 +58,39 @@ from pyanaconda.ui.gui.spokes.lib.passphrase import PassphraseDialog from pyanaconda.ui.gui.spokes.lib.refresh import RefreshDialog from pyanaconda.ui.gui.spokes.lib.resize import ResizeDialog +from pyanaconda.ui.gui.spokes.lib.storage_dialogs import ( + DASD_FORMAT_NO_CHANGE, + DASD_FORMAT_REFRESH, + DASD_FORMAT_RETURN_TO_HUB, + RESPONSE_CANCEL, + RESPONSE_MODIFY_SW, + RESPONSE_OK, + RESPONSE_QUIT, + RESPONSE_RECLAIM, + NeedSpaceDialog, + NoSpaceDialog, +) from pyanaconda.ui.gui.utils import ignoreEscape from pyanaconda.ui.helpers import StorageCheckHandler from pyanaconda.ui.lib.format_dasd import DasdFormatting -from pyanaconda.ui.lib.storage import find_partitioning, apply_partitioning, \ - select_default_disks, apply_disk_selection, get_disks_summary, create_partitioning, \ - is_local_disk, filter_disks_by_names, reset_storage, is_passphrase_required, \ - set_required_passphrase -from pyanaconda.ui.gui.spokes.lib.storage_dialogs import NeedSpaceDialog, NoSpaceDialog, \ - RESPONSE_CANCEL, RESPONSE_OK, RESPONSE_MODIFY_SW, RESPONSE_RECLAIM, RESPONSE_QUIT, \ - DASD_FORMAT_NO_CHANGE, DASD_FORMAT_REFRESH, DASD_FORMAT_RETURN_TO_HUB +from pyanaconda.ui.lib.storage import ( + apply_disk_selection, + apply_partitioning, + create_partitioning, + filter_disks_by_names, + find_partitioning, + get_disks_summary, + is_local_disk, + is_passphrase_required, + reset_storage, + select_default_disks, + set_required_passphrase, +) -import gi gi.require_version("Gtk", "3.0") gi.require_version("Gdk", "3.0") gi.require_version("AnacondaWidgets", "3.4") -from gi.repository import Gdk, AnacondaWidgets, Gtk +from gi.repository import AnacondaWidgets, Gdk, Gtk log = get_module_logger(__name__) diff --git a/pyanaconda/ui/gui/spokes/subscription.py b/pyanaconda/ui/gui/spokes/subscription.py index 16c4af8021b..972b6825a57 100644 --- a/pyanaconda/ui/gui/spokes/subscription.py +++ b/pyanaconda/ui/gui/spokes/subscription.py @@ -21,35 +21,44 @@ from dasbus.typing import unwrap_variant -from pyanaconda.flags import flags -from pyanaconda.core.threads import thread_manager - -from pyanaconda.core.i18n import _, CN_ -from pyanaconda.core.constants import SECRET_TYPE_HIDDEN, \ - SUBSCRIPTION_REQUEST_TYPE_USERNAME_PASSWORD, SUBSCRIPTION_REQUEST_TYPE_ORG_KEY, \ - THREAD_SUBSCRIPTION, THREAD_PAYLOAD, SOURCE_TYPES_OVERRIDEN_BY_CDN, \ - THREAD_SUBSCRIPTION_SPOKE_INIT -from pyanaconda.core.payload import ProxyString, ProxyStringError -from pyanaconda.ui.lib.subscription import register_and_subscribe, \ - unregister, SubscriptionPhase +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.async_utils import async_action_wait - -from pyanaconda.modules.common.constants.services import SUBSCRIPTION, NETWORK -from pyanaconda.modules.common.structures.subscription import SystemPurposeData, \ - SubscriptionRequest, OrganizationData +from pyanaconda.core.constants import ( + SECRET_TYPE_HIDDEN, + SOURCE_TYPES_OVERRIDEN_BY_CDN, + SUBSCRIPTION_REQUEST_TYPE_ORG_KEY, + SUBSCRIPTION_REQUEST_TYPE_USERNAME_PASSWORD, + THREAD_PAYLOAD, + THREAD_SUBSCRIPTION, + THREAD_SUBSCRIPTION_SPOKE_INIT, +) +from pyanaconda.core.i18n import CN_, _ +from pyanaconda.core.payload import ProxyString, ProxyStringError +from pyanaconda.core.threads import thread_manager +from pyanaconda.flags import flags +from pyanaconda.modules.common.constants.services import NETWORK, SUBSCRIPTION from pyanaconda.modules.common.errors.subscription import MultipleOrganizationsError +from pyanaconda.modules.common.structures.subscription import ( + OrganizationData, + SubscriptionRequest, + SystemPurposeData, +) +from pyanaconda.modules.common.task import async_run_task, sync_run_task from pyanaconda.modules.common.util import is_module_available -from pyanaconda.modules.common.task import sync_run_task, async_run_task - +from pyanaconda.ui.categories.software import SoftwareCategory +from pyanaconda.ui.communication import hubQ from pyanaconda.ui.gui.spokes import NormalSpoke from pyanaconda.ui.gui.spokes.lib.subscription import fill_combobox from pyanaconda.ui.gui.utils import set_password_visibility -from pyanaconda.ui.categories.software import SoftwareCategory -from pyanaconda.ui.communication import hubQ -from pyanaconda.ui.lib.subscription import username_password_sufficient, org_keys_sufficient, \ - check_cdn_is_installation_source +from pyanaconda.ui.lib.subscription import ( + SubscriptionPhase, + check_cdn_is_installation_source, + org_keys_sufficient, + register_and_subscribe, + unregister, + username_password_sufficient, +) -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) __all__ = ["SubscriptionSpoke"] diff --git a/pyanaconda/ui/gui/spokes/user.py b/pyanaconda/ui/gui/spokes/user.py index 220d659aa89..104492c2cf3 100644 --- a/pyanaconda/ui/gui/spokes/user.py +++ b/pyanaconda/ui/gui/spokes/user.py @@ -18,27 +18,30 @@ # import os -from pyanaconda.core.constants import PASSWORD_POLICY_USER -from pyanaconda.flags import flags -from pyanaconda.core.i18n import _, CN_ -from pyanaconda.core.configuration.anaconda import conf -from pyanaconda.core.users import crypt_password, guess_username, check_groupname from pyanaconda import input_checking +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core import constants +from pyanaconda.core.configuration.anaconda import conf +from pyanaconda.core.constants import PASSWORD_POLICY_USER +from pyanaconda.core.i18n import CN_, _ +from pyanaconda.core.regexes import GROUPLIST_FANCY_PARSE +from pyanaconda.core.users import check_groupname, crypt_password, guess_username +from pyanaconda.flags import flags from pyanaconda.modules.common.constants.services import USERS from pyanaconda.modules.common.util import is_module_available -from pyanaconda.ui.gui.spokes import NormalSpoke -from pyanaconda.ui.gui import GUIObject from pyanaconda.ui.categories.user_settings import UserSettingsCategory from pyanaconda.ui.common import FirstbootSpokeMixIn -from pyanaconda.ui.helpers import InputCheck -from pyanaconda.ui.gui.helpers import GUISpokeInputCheckHandler, GUIDialogInputCheckHandler -from pyanaconda.ui.gui.utils import blockedHandler, set_password_visibility from pyanaconda.ui.communication import hubQ +from pyanaconda.ui.gui import GUIObject +from pyanaconda.ui.gui.helpers import ( + GUIDialogInputCheckHandler, + GUISpokeInputCheckHandler, +) +from pyanaconda.ui.gui.spokes import NormalSpoke +from pyanaconda.ui.gui.utils import blockedHandler, set_password_visibility +from pyanaconda.ui.helpers import InputCheck from pyanaconda.ui.lib.users import get_user_list, set_user_list -from pyanaconda.core.regexes import GROUPLIST_FANCY_PARSE -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) __all__ = ["AdvancedUserDialog", "UserSpoke"] diff --git a/pyanaconda/ui/gui/spokes/welcome.py b/pyanaconda/ui/gui/spokes/welcome.py index ef5921622d1..90d230f58e3 100644 --- a/pyanaconda/ui/gui/spokes/welcome.py +++ b/pyanaconda/ui/gui/spokes/welcome.py @@ -17,32 +17,38 @@ # Red Hat, Inc. # -import sys -import re import os +import re +import sys import gi gi.require_version("Gtk", "3.0") from gi.repository import Gtk +from pyanaconda import flags, localization +from pyanaconda.anaconda_loggers import get_module_logger +from pyanaconda.core.async_utils import async_action_wait +from pyanaconda.core.constants import ( + DEFAULT_LANG, + TIMEZONE_PRIORITY_LANGUAGE, + WINDOW_TITLE_TEXT, +) +from pyanaconda.core.i18n import _ +from pyanaconda.core.product import ( + get_product_is_final_release, + get_product_name, + get_product_version, +) +from pyanaconda.core.util import ipmi_abort +from pyanaconda.modules.common.constants.services import LOCALIZATION, TIMEZONE +from pyanaconda.modules.common.util import is_module_available from pyanaconda.ui.gui.hubs.summary import SummaryHub from pyanaconda.ui.gui.spokes import StandaloneSpoke -from pyanaconda.ui.gui.utils import setup_gtk_direction, escape_markup -from pyanaconda.core.async_utils import async_action_wait from pyanaconda.ui.gui.spokes.lib.beta_warning_dialog import BetaWarningDialog from pyanaconda.ui.gui.spokes.lib.lang_locale_handler import LangLocaleHandler -from pyanaconda import localization +from pyanaconda.ui.gui.utils import escape_markup, setup_gtk_direction from pyanaconda.ui.helpers import get_distribution_text -from pyanaconda.core.product import get_product_is_final_release, get_product_name, \ - get_product_version -from pyanaconda import flags -from pyanaconda.core.i18n import _ -from pyanaconda.core.util import ipmi_abort -from pyanaconda.core.constants import DEFAULT_LANG, WINDOW_TITLE_TEXT, TIMEZONE_PRIORITY_LANGUAGE -from pyanaconda.modules.common.constants.services import TIMEZONE, LOCALIZATION -from pyanaconda.modules.common.util import is_module_available -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) diff --git a/pyanaconda/ui/gui/utils.py b/pyanaconda/ui/gui/utils.py index 3b483396a1e..22a461c53b4 100644 --- a/pyanaconda/ui/gui/utils.py +++ b/pyanaconda/ui/gui/utils.py @@ -24,22 +24,27 @@ gi.require_version("Gdk", "3.0") gi.require_version("Gtk", "3.0") +import functools import queue -import time import threading -import functools +import time +from contextlib import contextmanager from gi.repository import Gdk, Gtk -from contextlib import contextmanager +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core import glib -from pyanaconda.core.threads import thread_manager from pyanaconda.core.async_utils import async_action_wait, run_in_loop -from pyanaconda.core.constants import NOTICEABLE_FREEZE, PASSWORD_HIDE, PASSWORD_SHOW, \ - PASSWORD_HIDE_ICON, PASSWORD_SHOW_ICON +from pyanaconda.core.constants import ( + NOTICEABLE_FREEZE, + PASSWORD_HIDE, + PASSWORD_HIDE_ICON, + PASSWORD_SHOW, + PASSWORD_SHOW_ICON, +) from pyanaconda.core.i18n import _ +from pyanaconda.core.threads import thread_manager -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) # any better idea how to create a unique, distinguishable object that cannot be diff --git a/pyanaconda/ui/gui/xkl_wrapper.py b/pyanaconda/ui/gui/xkl_wrapper.py index 7cd5661d40a..c2261667759 100644 --- a/pyanaconda/ui/gui/xkl_wrapper.py +++ b/pyanaconda/ui/gui/xkl_wrapper.py @@ -16,17 +16,18 @@ # Red Hat, Inc. # -import iso639 -import threading import gettext +import threading from collections import namedtuple + +import iso639 from xkbregistry import rxkb +from pyanaconda import localization from pyanaconda.core.async_utils import async_action_wait from pyanaconda.core.string import upcase_first_letter from pyanaconda.keyboard import normalize_layout_variant from pyanaconda.modules.common.constants.services import LOCALIZATION -from pyanaconda import localization Xkb_ = lambda x: gettext.translation("xkeyboard-config", fallback=True).gettext(x) iso_ = lambda x: gettext.translation("iso_639", fallback=True).gettext(x) diff --git a/pyanaconda/ui/helpers.py b/pyanaconda/ui/helpers.py index 3cf2b103e31..52202f19cc8 100644 --- a/pyanaconda/ui/helpers.py +++ b/pyanaconda/ui/helpers.py @@ -60,8 +60,8 @@ from pyanaconda.core.constants import DRACUT_REPO_DIR from pyanaconda.core.i18n import _ from pyanaconda.core.path import join_paths +from pyanaconda.core.payload import create_hdd_url, create_nfs_url from pyanaconda.core.product import get_product_name, get_product_version -from pyanaconda.core.payload import create_nfs_url, create_hdd_url from pyanaconda.modules.common.structures.payload import RepoConfigurationData from pyanaconda.ui.lib.payload import create_source, set_source, tear_down_sources diff --git a/pyanaconda/ui/lib/addons.py b/pyanaconda/ui/lib/addons.py index 21915a571cb..4d3dd1af0a2 100644 --- a/pyanaconda/ui/lib/addons.py +++ b/pyanaconda/ui/lib/addons.py @@ -16,6 +16,7 @@ # Red Hat, Inc. # import os + from pyanaconda.anaconda_loggers import get_module_logger __all__ = ["collect_addon_ui_paths"] diff --git a/pyanaconda/ui/lib/format_dasd.py b/pyanaconda/ui/lib/format_dasd.py index eb72d998608..c0559f63867 100644 --- a/pyanaconda/ui/lib/format_dasd.py +++ b/pyanaconda/ui/lib/format_dasd.py @@ -19,16 +19,16 @@ # from blivet import arch -from pyanaconda.flags import flags -from pyanaconda.core.signal import Signal +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.i18n import _ -from pyanaconda.modules.common.structures.storage import DeviceData -from pyanaconda.ui.lib.storage import reset_storage +from pyanaconda.core.signal import Signal +from pyanaconda.flags import flags from pyanaconda.modules.common.constants.objects import DASD, DEVICE_TREE from pyanaconda.modules.common.constants.services import STORAGE +from pyanaconda.modules.common.structures.storage import DeviceData from pyanaconda.modules.common.task import sync_run_task +from pyanaconda.ui.lib.storage import reset_storage -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) diff --git a/pyanaconda/ui/lib/payload.py b/pyanaconda/ui/lib/payload.py index b0934438a7b..378148b866f 100644 --- a/pyanaconda/ui/lib/payload.py +++ b/pyanaconda/ui/lib/payload.py @@ -17,6 +17,7 @@ # from blivet.size import Size from dasbus.client.proxy import get_object_path + from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.constants import PAYLOAD_TYPE_DNF from pyanaconda.modules.common.constants.objects import DEVICE_TREE diff --git a/pyanaconda/ui/lib/software.py b/pyanaconda/ui/lib/software.py index 5856488da64..a2d55afac12 100644 --- a/pyanaconda/ui/lib/software.py +++ b/pyanaconda/ui/lib/software.py @@ -16,11 +16,15 @@ # Red Hat, Inc. # from collections import namedtuple + from blivet.arch import is_aarch64 from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.i18n import _ -from pyanaconda.modules.common.structures.comps import CompsEnvironmentData, CompsGroupData +from pyanaconda.modules.common.structures.comps import ( + CompsEnvironmentData, + CompsGroupData, +) from pyanaconda.modules.common.structures.packages import PackagesSelectionData log = get_module_logger(__name__) diff --git a/pyanaconda/ui/lib/space.py b/pyanaconda/ui/lib/space.py index 33a839f9320..f4a124cb072 100644 --- a/pyanaconda/ui/lib/space.py +++ b/pyanaconda/ui/lib/space.py @@ -17,14 +17,16 @@ # Red Hat, Inc. # import os + from blivet.size import Size + +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.configuration.anaconda import conf from pyanaconda.core.i18n import _ from pyanaconda.modules.common.constants.objects import DEVICE_TREE from pyanaconda.modules.common.constants.services import STORAGE from pyanaconda.modules.common.structures.storage import DeviceData -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) diff --git a/pyanaconda/ui/lib/storage.py b/pyanaconda/ui/lib/storage.py index 78a55bc59b0..4f888900e34 100644 --- a/pyanaconda/ui/lib/storage.py +++ b/pyanaconda/ui/lib/storage.py @@ -19,25 +19,34 @@ import re from blivet.size import Size +from dasbus.client.proxy import get_object_path from dasbus.error import DBusError - from dasbus.typing import unwrap_variant -from dasbus.client.proxy import get_object_path from pyanaconda.anaconda_loggers import get_module_logger -from pyanaconda.core.constants import PARTITIONING_METHOD_AUTOMATIC, BOOTLOADER_DRIVE_UNSET, \ - PARTITIONING_METHOD_CUSTOM +from pyanaconda.core.constants import ( + BOOTLOADER_DRIVE_UNSET, + PARTITIONING_METHOD_AUTOMATIC, + PARTITIONING_METHOD_CUSTOM, +) from pyanaconda.core.i18n import P_, _ -from pyanaconda.errors import errorHandler as error_handler, ERROR_RAISE +from pyanaconda.core.storage import device_matches +from pyanaconda.errors import ERROR_RAISE +from pyanaconda.errors import errorHandler as error_handler from pyanaconda.flags import flags -from pyanaconda.modules.common.constants.objects import DISK_SELECTION, BOOTLOADER, DEVICE_TREE, \ - DISK_INITIALIZATION +from pyanaconda.modules.common.constants.objects import ( + BOOTLOADER, + DEVICE_TREE, + DISK_INITIALIZATION, + DISK_SELECTION, +) from pyanaconda.modules.common.constants.services import STORAGE -from pyanaconda.modules.common.errors.configuration import StorageConfigurationError, \ - BootloaderConfigurationError +from pyanaconda.modules.common.errors.configuration import ( + BootloaderConfigurationError, + StorageConfigurationError, +) from pyanaconda.modules.common.structures.validation import ValidationReport from pyanaconda.modules.common.task import sync_run_task -from pyanaconda.core.storage import device_matches log = get_module_logger(__name__) diff --git a/pyanaconda/ui/lib/subscription.py b/pyanaconda/ui/lib/subscription.py index ec5e8a71368..fcc885d24d6 100644 --- a/pyanaconda/ui/lib/subscription.py +++ b/pyanaconda/ui/lib/subscription.py @@ -19,19 +19,27 @@ from enum import Enum from pyanaconda.anaconda_loggers import get_module_logger -from pyanaconda.core.constants import THREAD_WAIT_FOR_CONNECTING_NM, \ - SOURCE_TYPE_CDN, SOURCE_TYPES_OVERRIDEN_BY_CDN, SECRET_TYPE_HIDDEN, \ - SECRET_TYPE_TEXT, PAYLOAD_TYPE_DNF -from pyanaconda.errors import errorHandler, ERROR_RAISE - -from pyanaconda.modules.common.constants.services import SUBSCRIPTION +from pyanaconda.core.constants import ( + PAYLOAD_TYPE_DNF, + SECRET_TYPE_HIDDEN, + SECRET_TYPE_TEXT, + SOURCE_TYPE_CDN, + SOURCE_TYPES_OVERRIDEN_BY_CDN, + THREAD_WAIT_FOR_CONNECTING_NM, +) +from pyanaconda.core.threads import thread_manager +from pyanaconda.errors import ERROR_RAISE, errorHandler from pyanaconda.modules.common import task +from pyanaconda.modules.common.constants.services import SUBSCRIPTION +from pyanaconda.modules.common.errors.subscription import ( + MultipleOrganizationsError, + RegistrationError, + SatelliteProvisioningError, + UnregistrationError, +) from pyanaconda.modules.common.structures.subscription import SubscriptionRequest from pyanaconda.modules.common.util import is_module_available -from pyanaconda.modules.common.errors.subscription import RegistrationError, \ - UnregistrationError, SatelliteProvisioningError, MultipleOrganizationsError from pyanaconda.payload.manager import payloadMgr -from pyanaconda.core.threads import thread_manager from pyanaconda.ui.lib.payload import create_source, set_source, tear_down_sources log = get_module_logger(__name__) diff --git a/pyanaconda/ui/tui/__init__.py b/pyanaconda/ui/tui/__init__.py index d9750794452..c1f85bfd170 100644 --- a/pyanaconda/ui/tui/__init__.py +++ b/pyanaconda/ui/tui/__init__.py @@ -16,16 +16,12 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from pyanaconda import ui -from pyanaconda.core.constants import IPMI_ABORTED, QUIT_MESSAGE -from pyanaconda.flags import flags -from pyanaconda.core.threads import thread_manager -from pyanaconda.core.util import ipmi_report -from pyanaconda.ui.tui.hubs.summary import SummaryHub -from pyanaconda.ui.tui.signals import SendMessageSignal -from pyanaconda.ui.tui.spokes import StandaloneSpoke -from pyanaconda.ui.tui.tuiobject import IpmiErrorDialog +import os +import queue +import site +import sys +import meh.ui.text from simpleline import App from simpleline.event_loop.glib_event_loop import GLibEventLoop from simpleline.event_loop.signals import ExceptionSignal @@ -33,12 +29,17 @@ from simpleline.render.adv_widgets import YesNoDialog from simpleline.render.screen_handler import ScreenHandler -import os -import sys -import site -import queue -import meh.ui.text +from pyanaconda import ui from pyanaconda.anaconda_loggers import get_module_logger +from pyanaconda.core.constants import IPMI_ABORTED, QUIT_MESSAGE +from pyanaconda.core.threads import thread_manager +from pyanaconda.core.util import ipmi_report +from pyanaconda.flags import flags +from pyanaconda.ui.tui.hubs.summary import SummaryHub +from pyanaconda.ui.tui.signals import SendMessageSignal +from pyanaconda.ui.tui.spokes import StandaloneSpoke +from pyanaconda.ui.tui.tuiobject import IpmiErrorDialog + log = get_module_logger(__name__) exception_processed = False diff --git a/pyanaconda/ui/tui/hubs/__init__.py b/pyanaconda/ui/tui/hubs/__init__.py index 7aeddc13ab6..1efae6454ba 100644 --- a/pyanaconda/ui/tui/hubs/__init__.py +++ b/pyanaconda/ui/tui/hubs/__init__.py @@ -16,17 +16,17 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from pyanaconda import lifecycle -from pyanaconda.ui.tui.tuiobject import TUIObject -from pyanaconda.ui import common - from simpleline.render.containers import ListRowContainer from simpleline.render.prompt import Prompt from simpleline.render.screen import InputState from simpleline.render.screen_handler import ScreenHandler -from pyanaconda.core.i18n import _, N_ +from pyanaconda import lifecycle from pyanaconda.anaconda_loggers import get_module_logger +from pyanaconda.core.i18n import N_, _ +from pyanaconda.ui import common +from pyanaconda.ui.tui.tuiobject import TUIObject + log = get_module_logger(__name__) diff --git a/pyanaconda/ui/tui/hubs/summary.py b/pyanaconda/ui/tui/hubs/summary.py index 09526226546..3e5fdf360aa 100644 --- a/pyanaconda/ui/tui/hubs/summary.py +++ b/pyanaconda/ui/tui/hubs/summary.py @@ -17,21 +17,21 @@ # Red Hat, Inc. # -from pyanaconda.ui.lib.space import FileSystemSpaceChecker, DirInstallSpaceChecker -from pyanaconda.ui.tui.hubs import TUIHub -from pyanaconda.flags import flags -from pyanaconda.errors import CmdlineError -from pyanaconda.core.i18n import N_, _ -from pyanaconda.core.configuration.anaconda import conf +import sys +import time from simpleline import App -from simpleline.render.screen import InputState from simpleline.render.prompt import Prompt - -import sys -import time +from simpleline.render.screen import InputState from pyanaconda.anaconda_loggers import get_module_logger +from pyanaconda.core.configuration.anaconda import conf +from pyanaconda.core.i18n import N_, _ +from pyanaconda.errors import CmdlineError +from pyanaconda.flags import flags +from pyanaconda.ui.lib.space import DirInstallSpaceChecker, FileSystemSpaceChecker +from pyanaconda.ui.tui.hubs import TUIHub + log = get_module_logger(__name__) # TRANSLATORS: 'b' to begin installation diff --git a/pyanaconda/ui/tui/spokes/__init__.py b/pyanaconda/ui/tui/spokes/__init__.py index 2c60547271f..4347c6584b2 100644 --- a/pyanaconda/ui/tui/spokes/__init__.py +++ b/pyanaconda/ui/tui/spokes/__init__.py @@ -16,11 +16,11 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from pyanaconda.ui.common import Spoke, StandaloneSpoke, NormalSpoke -from pyanaconda.ui.tui.tuiobject import TUIObject -from pyanaconda.core.i18n import N_, _ +from simpleline.render.widgets import CheckboxWidget, Widget -from simpleline.render.widgets import Widget, CheckboxWidget +from pyanaconda.core.i18n import N_, _ +from pyanaconda.ui.common import NormalSpoke, Spoke, StandaloneSpoke +from pyanaconda.ui.tui.tuiobject import TUIObject __all__ = ["NormalTUISpoke", "StandaloneSpoke", "TUISpoke"] diff --git a/pyanaconda/ui/tui/spokes/askrd.py b/pyanaconda/ui/tui/spokes/askrd.py index 781817fc7a7..43b571882e3 100644 --- a/pyanaconda/ui/tui/spokes/askrd.py +++ b/pyanaconda/ui/tui/spokes/askrd.py @@ -20,22 +20,22 @@ # import sys -from pyanaconda.core.configuration.anaconda import conf -from pyanaconda.ui.tui.spokes import NormalTUISpoke -from pyanaconda.core.constants import USERDP, USETEXT, QUIT_MESSAGE -from pyanaconda.core.i18n import N_, _ -from pyanaconda.ui.tui import exception_msg_handler -from pyanaconda.core.util import execWithRedirect, ipmi_abort - from simpleline import App from simpleline.event_loop.signals import ExceptionSignal +from simpleline.render.adv_widgets import YesNoDialog from simpleline.render.containers import ListColumnContainer from simpleline.render.prompt import Prompt from simpleline.render.screen import InputState from simpleline.render.screen_handler import ScreenHandler -from simpleline.render.adv_widgets import YesNoDialog from simpleline.render.widgets import TextWidget +from pyanaconda.core.configuration.anaconda import conf +from pyanaconda.core.constants import QUIT_MESSAGE, USERDP, USETEXT +from pyanaconda.core.i18n import N_, _ +from pyanaconda.core.util import execWithRedirect, ipmi_abort +from pyanaconda.ui.tui import exception_msg_handler +from pyanaconda.ui.tui.spokes import NormalTUISpoke + def exception_msg_handler_and_exit(signal, data): """Display an exception and exit so that we don't end up in a loop.""" diff --git a/pyanaconda/ui/tui/spokes/installation_progress.py b/pyanaconda/ui/tui/spokes/installation_progress.py index c22f54f6c6a..83373e04c9c 100644 --- a/pyanaconda/ui/tui/spokes/installation_progress.py +++ b/pyanaconda/ui/tui/spokes/installation_progress.py @@ -16,20 +16,19 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # +from pykickstart.constants import KS_REBOOT, KS_SHUTDOWN +from simpleline import App +from simpleline.event_loop import AbstractSignal, ExitMainLoop +from simpleline.render.prompt import Prompt + from pyanaconda.anaconda_loggers import get_module_logger -from pyanaconda.flags import flags -from pyanaconda.core.i18n import N_, _ from pyanaconda.core import util -from pyanaconda.core.constants import IPMI_FINISHED from pyanaconda.core.configuration.anaconda import conf -from pyanaconda.ui.tui.spokes import StandaloneTUISpoke +from pyanaconda.core.constants import IPMI_FINISHED +from pyanaconda.core.i18n import N_, _ +from pyanaconda.flags import flags from pyanaconda.ui.tui.hubs.summary import SummaryHub - -from simpleline import App -from simpleline.render.prompt import Prompt -from simpleline.event_loop import ExitMainLoop, AbstractSignal - -from pykickstart.constants import KS_SHUTDOWN, KS_REBOOT +from pyanaconda.ui.tui.spokes import StandaloneTUISpoke log = get_module_logger(__name__) diff --git a/pyanaconda/ui/tui/spokes/installation_source.py b/pyanaconda/ui/tui/spokes/installation_source.py index bd5f9b684e3..6f4f33dbc34 100644 --- a/pyanaconda/ui/tui/spokes/installation_source.py +++ b/pyanaconda/ui/tui/spokes/installation_source.py @@ -16,43 +16,53 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # +import fnmatch +import os + +from simpleline.render.containers import ListColumnContainer +from simpleline.render.prompt import Prompt +from simpleline.render.screen import InputState +from simpleline.render.screen_handler import ScreenHandler +from simpleline.render.widgets import EntryWidget, TextWidget + +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.configuration.anaconda import conf +from pyanaconda.core.constants import ( + DRACUT_ISODIR, + ISO_DIR, + PAYLOAD_STATUS_INVALID_SOURCE, + PAYLOAD_STATUS_PROBING_STORAGE, + PAYLOAD_STATUS_SETTING_SOURCE, + PAYLOAD_TYPE_DNF, + SOURCE_TYPE_HMC, + SOURCE_TYPE_NFS, + SOURCE_TYPE_URL, + THREAD_CHECK_SOFTWARE, + THREAD_PAYLOAD, + THREAD_SOURCE_WATCHER, + THREAD_STORAGE_WATCHER, +) +from pyanaconda.core.i18n import N_, _ from pyanaconda.core.payload import parse_nfs_url +from pyanaconda.core.threads import thread_manager from pyanaconda.modules.common.constants.objects import DEVICE_TREE from pyanaconda.modules.common.constants.services import STORAGE from pyanaconda.modules.common.structures.payload import RepoConfigurationData +from pyanaconda.modules.common.structures.storage import DeviceData +from pyanaconda.payload import utils as payload_utils +from pyanaconda.payload.manager import payloadMgr from pyanaconda.payload.utils import get_device_path from pyanaconda.ui.categories.software import SoftwareCategory from pyanaconda.ui.context import context +from pyanaconda.ui.helpers import SourceSwitchHandler +from pyanaconda.ui.lib.payload import ( + find_potential_hdiso_sources, + get_hdiso_source_description, + get_hdiso_source_info, +) from pyanaconda.ui.tui.spokes import NormalTUISpoke from pyanaconda.ui.tui.tuiobject import Dialog -from pyanaconda.core.threads import thread_manager -from pyanaconda.payload import utils as payload_utils -from pyanaconda.payload.manager import payloadMgr -from pyanaconda.core.i18n import N_, _ -from pyanaconda.ui.lib.payload import find_potential_hdiso_sources, get_hdiso_source_info, \ - get_hdiso_source_description -from pyanaconda.modules.common.structures.storage import DeviceData - -from pyanaconda.core.constants import THREAD_SOURCE_WATCHER, THREAD_PAYLOAD, PAYLOAD_TYPE_DNF, \ - SOURCE_TYPE_URL, SOURCE_TYPE_NFS, SOURCE_TYPE_HMC, PAYLOAD_STATUS_SETTING_SOURCE, \ - PAYLOAD_STATUS_INVALID_SOURCE -from pyanaconda.core.constants import THREAD_STORAGE_WATCHER -from pyanaconda.core.constants import THREAD_CHECK_SOFTWARE, ISO_DIR, DRACUT_ISODIR -from pyanaconda.core.constants import PAYLOAD_STATUS_PROBING_STORAGE - -from pyanaconda.ui.helpers import SourceSwitchHandler - -from simpleline.render.containers import ListColumnContainer -from simpleline.render.prompt import Prompt -from simpleline.render.screen import InputState -from simpleline.render.screen_handler import ScreenHandler -from simpleline.render.widgets import TextWidget, EntryWidget -import os -import fnmatch - -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) __all__ = ["SourceSpoke"] diff --git a/pyanaconda/ui/tui/spokes/kernel_warning.py b/pyanaconda/ui/tui/spokes/kernel_warning.py index 0334030c8be..02e7cce7e39 100644 --- a/pyanaconda/ui/tui/spokes/kernel_warning.py +++ b/pyanaconda/ui/tui/spokes/kernel_warning.py @@ -18,10 +18,10 @@ from simpleline.render.widgets import TextWidget from pyanaconda.core.constants import WARNING_SMT_ENABLED_TUI -from pyanaconda.core.i18n import N_, _ from pyanaconda.core.hw import is_smt_enabled -from pyanaconda.ui.tui.spokes import StandaloneTUISpoke +from pyanaconda.core.i18n import N_, _ from pyanaconda.ui.tui.hubs.summary import SummaryHub +from pyanaconda.ui.tui.spokes import StandaloneTUISpoke __all__ = ["KernelWarningSpoke"] diff --git a/pyanaconda/ui/tui/spokes/language_support.py b/pyanaconda/ui/tui/spokes/language_support.py index 59c3596508a..1f177d78986 100644 --- a/pyanaconda/ui/tui/spokes/language_support.py +++ b/pyanaconda/ui/tui/spokes/language_support.py @@ -17,19 +17,19 @@ # Red Hat, Inc. # -from pyanaconda.modules.common.constants.services import LOCALIZATION -from pyanaconda.modules.common.util import is_module_available -from pyanaconda.ui.categories.localization import LocalizationCategory -from pyanaconda.ui.tui.spokes import NormalTUISpoke -from pyanaconda.ui.common import FirstbootSpokeMixIn -from pyanaconda import localization -from pyanaconda.core.i18n import N_, _ - from simpleline.render.containers import ListColumnContainer from simpleline.render.screen import InputState from simpleline.render.screen_handler import ScreenHandler from simpleline.render.widgets import TextWidget +from pyanaconda import localization +from pyanaconda.core.i18n import N_, _ +from pyanaconda.modules.common.constants.services import LOCALIZATION +from pyanaconda.modules.common.util import is_module_available +from pyanaconda.ui.categories.localization import LocalizationCategory +from pyanaconda.ui.common import FirstbootSpokeMixIn +from pyanaconda.ui.tui.spokes import NormalTUISpoke + # TRANSLATORS: 'b' to go back to language list PROMPT_BACK_DESCRIPTION = N_("to return to language list") PROMPT_BACK_KEY = 'b' diff --git a/pyanaconda/ui/tui/spokes/network.py b/pyanaconda/ui/tui/spokes/network.py index 4c44ecbed3f..93e3deb9a28 100644 --- a/pyanaconda/ui/tui/spokes/network.py +++ b/pyanaconda/ui/tui/spokes/network.py @@ -17,30 +17,34 @@ # Red Hat, Inc. # import gi -gi.require_version("NM", "1.0") -from gi.repository import NM +gi.require_version("NM", "1.0") import socket +from gi.repository import NM +from simpleline.render.containers import ListColumnContainer +from simpleline.render.prompt import Prompt +from simpleline.render.screen import InputState +from simpleline.render.screen_handler import ScreenHandler +from simpleline.render.widgets import CheckboxWidget, EntryWidget, TextWidget + from pyanaconda import network +from pyanaconda.anaconda_loggers import get_module_logger from pyanaconda.core.configuration.anaconda import conf +from pyanaconda.core.constants import ANACONDA_ENVIRON +from pyanaconda.core.i18n import N_, _ +from pyanaconda.core.regexes import ( + IPV4_NETMASK_WITH_ANCHORS, + IPV4_OR_DHCP_PATTERN_WITH_ANCHORS, + IPV4_PATTERN_WITH_ANCHORS, +) +from pyanaconda.flags import flags from pyanaconda.modules.common.constants.services import NETWORK from pyanaconda.modules.common.structures.network import NetworkDeviceConfiguration -from pyanaconda.flags import flags from pyanaconda.ui.categories.system import SystemCategory +from pyanaconda.ui.common import FirstbootSpokeMixIn from pyanaconda.ui.tui.spokes import NormalTUISpoke from pyanaconda.ui.tui.tuiobject import Dialog, report_if_failed -from pyanaconda.ui.common import FirstbootSpokeMixIn -from pyanaconda.core.i18n import N_, _ -from pyanaconda.core.regexes import IPV4_PATTERN_WITH_ANCHORS, IPV4_NETMASK_WITH_ANCHORS, IPV4_OR_DHCP_PATTERN_WITH_ANCHORS -from pyanaconda.core.constants import ANACONDA_ENVIRON -from pyanaconda.anaconda_loggers import get_module_logger - -from simpleline.render.containers import ListColumnContainer -from simpleline.render.prompt import Prompt -from simpleline.render.screen import InputState -from simpleline.render.screen_handler import ScreenHandler -from simpleline.render.widgets import TextWidget, CheckboxWidget, EntryWidget log = get_module_logger(__name__) diff --git a/pyanaconda/ui/tui/spokes/root_password.py b/pyanaconda/ui/tui/spokes/root_password.py index f22bcf9bd2b..688ce388391 100644 --- a/pyanaconda/ui/tui/spokes/root_password.py +++ b/pyanaconda/ui/tui/spokes/root_password.py @@ -16,17 +16,20 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # +from simpleline.render.widgets import TextWidget + +from pyanaconda.core.constants import PASSWORD_POLICY_ROOT +from pyanaconda.core.i18n import N_, _ +from pyanaconda.modules.common.constants.services import USERS from pyanaconda.modules.common.util import is_module_available from pyanaconda.ui.categories.user_settings import UserSettingsCategory -from pyanaconda.ui.lib.users import can_modify_root_configuration, get_root_configuration_status -from pyanaconda.ui.tui.tuiobject import PasswordDialog -from pyanaconda.ui.tui.spokes import NormalTUISpoke from pyanaconda.ui.common import FirstbootSpokeMixIn -from pyanaconda.core.i18n import N_, _ -from pyanaconda.modules.common.constants.services import USERS -from pyanaconda.core.constants import PASSWORD_POLICY_ROOT - -from simpleline.render.widgets import TextWidget +from pyanaconda.ui.lib.users import ( + can_modify_root_configuration, + get_root_configuration_status, +) +from pyanaconda.ui.tui.spokes import NormalTUISpoke +from pyanaconda.ui.tui.tuiobject import PasswordDialog class PasswordSpoke(FirstbootSpokeMixIn, NormalTUISpoke): diff --git a/pyanaconda/ui/tui/spokes/shell_spoke.py b/pyanaconda/ui/tui/spokes/shell_spoke.py index 8e4111f54b3..8d3affff0ff 100644 --- a/pyanaconda/ui/tui/spokes/shell_spoke.py +++ b/pyanaconda/ui/tui/spokes/shell_spoke.py @@ -17,15 +17,15 @@ # """Text mode shell spoke""" -from pyanaconda.ui.categories.system import SystemCategory -from pyanaconda.ui.tui.spokes import NormalTUISpoke -from pyanaconda.core.i18n import N_, _ +from blivet import arch +from simpleline.render.widgets import TextWidget + from pyanaconda.core.configuration.anaconda import conf from pyanaconda.core.constants import ANACONDA_ENVIRON +from pyanaconda.core.i18n import N_, _ from pyanaconda.core.util import execConsole -from blivet import arch - -from simpleline.render.widgets import TextWidget +from pyanaconda.ui.categories.system import SystemCategory +from pyanaconda.ui.tui.spokes import NormalTUISpoke __all__ = ["ShellSpoke"] diff --git a/pyanaconda/ui/tui/spokes/software_selection.py b/pyanaconda/ui/tui/spokes/software_selection.py index e84504e255b..1595494531a 100644 --- a/pyanaconda/ui/tui/spokes/software_selection.py +++ b/pyanaconda/ui/tui/spokes/software_selection.py @@ -16,27 +16,39 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from pyanaconda.flags import flags -from pyanaconda.ui.categories.software import SoftwareCategory -from pyanaconda.ui.context import context -from pyanaconda.ui.lib.software import get_software_selection_status, \ - is_software_selection_complete, SoftwareSelectionCache, get_group_data, get_environment_data -from pyanaconda.ui.tui.spokes import NormalTUISpoke -from pyanaconda.core.threads import thread_manager -from pyanaconda.ui.lib.software import FEATURE_64K, KernelFeatures, \ - get_kernel_from_properties, get_available_kernel_features, get_kernel_titles_and_descriptions -from pyanaconda.core.i18n import N_, _ -from pyanaconda.core.constants import THREAD_PAYLOAD, THREAD_CHECK_SOFTWARE, \ - THREAD_SOFTWARE_WATCHER, PAYLOAD_TYPE_DNF -from pyanaconda.core.configuration.anaconda import conf - from simpleline.render.containers import ListColumnContainer from simpleline.render.prompt import Prompt from simpleline.render.screen import InputState from simpleline.render.screen_handler import ScreenHandler -from simpleline.render.widgets import TextWidget, CheckboxWidget +from simpleline.render.widgets import CheckboxWidget, TextWidget from pyanaconda.anaconda_loggers import get_module_logger +from pyanaconda.core.configuration.anaconda import conf +from pyanaconda.core.constants import ( + PAYLOAD_TYPE_DNF, + THREAD_CHECK_SOFTWARE, + THREAD_PAYLOAD, + THREAD_SOFTWARE_WATCHER, +) +from pyanaconda.core.i18n import N_, _ +from pyanaconda.core.threads import thread_manager +from pyanaconda.flags import flags +from pyanaconda.ui.categories.software import SoftwareCategory +from pyanaconda.ui.context import context +from pyanaconda.ui.lib.software import ( + FEATURE_64K, + KernelFeatures, + SoftwareSelectionCache, + get_available_kernel_features, + get_environment_data, + get_group_data, + get_kernel_from_properties, + get_kernel_titles_and_descriptions, + get_software_selection_status, + is_software_selection_complete, +) +from pyanaconda.ui.tui.spokes import NormalTUISpoke + log = get_module_logger(__name__) __all__ = ["SoftwareSpoke"] diff --git a/pyanaconda/ui/tui/spokes/storage.py b/pyanaconda/ui/tui/spokes/storage.py index c210c7ddf4f..b4e6bc33b72 100644 --- a/pyanaconda/ui/tui/spokes/storage.py +++ b/pyanaconda/ui/tui/spokes/storage.py @@ -18,41 +18,66 @@ # from collections import OrderedDict -from pyanaconda.modules.common.constants.objects import DISK_SELECTION, DISK_INITIALIZATION, \ - BOOTLOADER, DEVICE_TREE -from pyanaconda.modules.common.constants.services import STORAGE -from pyanaconda.modules.common.structures.partitioning import MountPointRequest, \ - PartitioningRequest -from pyanaconda.modules.common.structures.storage import DeviceFormatData, DeviceData -from pyanaconda.modules.common.structures.validation import ValidationReport -from pyanaconda.ui.categories.system import SystemCategory -from pyanaconda.ui.lib.storage import find_partitioning, reset_storage, \ - select_default_disks, apply_disk_selection, get_disks_summary, apply_partitioning, \ - create_partitioning, filter_disks_by_names, is_passphrase_required, set_required_passphrase -from pyanaconda.ui.tui.spokes import NormalTUISpoke -from pyanaconda.ui.tui.tuiobject import Dialog, PasswordDialog -from pyanaconda.core.storage import get_supported_autopart_choices -from pyanaconda.ui.lib.format_dasd import DasdFormatting - from blivet.size import Size -from pyanaconda.flags import flags -from pyanaconda.core.threads import thread_manager -from pyanaconda.core.configuration.anaconda import conf -from pyanaconda.core.constants import THREAD_STORAGE, THREAD_STORAGE_WATCHER, \ - PAYLOAD_STATUS_PROBING_STORAGE, CLEAR_PARTITIONS_ALL, \ - CLEAR_PARTITIONS_LINUX, CLEAR_PARTITIONS_NONE, CLEAR_PARTITIONS_DEFAULT, \ - BOOTLOADER_LOCATION_MBR, SecretType, WARNING_NO_DISKS_DETECTED, WARNING_NO_DISKS_SELECTED, \ - PARTITIONING_METHOD_AUTOMATIC, PARTITIONING_METHOD_MANUAL, PASSWORD_POLICY_LUKS -from pyanaconda.core.i18n import _, N_ - +from simpleline.render.adv_widgets import YesNoDialog from simpleline.render.containers import ListColumnContainer from simpleline.render.prompt import Prompt from simpleline.render.screen import InputState from simpleline.render.screen_handler import ScreenHandler -from simpleline.render.widgets import TextWidget, CheckboxWidget, EntryWidget -from simpleline.render.adv_widgets import YesNoDialog +from simpleline.render.widgets import CheckboxWidget, EntryWidget, TextWidget from pyanaconda.anaconda_loggers import get_module_logger +from pyanaconda.core.configuration.anaconda import conf +from pyanaconda.core.constants import ( + BOOTLOADER_LOCATION_MBR, + CLEAR_PARTITIONS_ALL, + CLEAR_PARTITIONS_DEFAULT, + CLEAR_PARTITIONS_LINUX, + CLEAR_PARTITIONS_NONE, + PARTITIONING_METHOD_AUTOMATIC, + PARTITIONING_METHOD_MANUAL, + PASSWORD_POLICY_LUKS, + PAYLOAD_STATUS_PROBING_STORAGE, + THREAD_STORAGE, + THREAD_STORAGE_WATCHER, + WARNING_NO_DISKS_DETECTED, + WARNING_NO_DISKS_SELECTED, + SecretType, +) +from pyanaconda.core.i18n import N_, _ +from pyanaconda.core.storage import get_supported_autopart_choices +from pyanaconda.core.threads import thread_manager +from pyanaconda.flags import flags +from pyanaconda.modules.common.constants.objects import ( + BOOTLOADER, + DEVICE_TREE, + DISK_INITIALIZATION, + DISK_SELECTION, +) +from pyanaconda.modules.common.constants.services import STORAGE +from pyanaconda.modules.common.structures.partitioning import ( + MountPointRequest, + PartitioningRequest, +) +from pyanaconda.modules.common.structures.storage import DeviceData, DeviceFormatData +from pyanaconda.modules.common.structures.validation import ValidationReport +from pyanaconda.ui.categories.system import SystemCategory +from pyanaconda.ui.lib.format_dasd import DasdFormatting +from pyanaconda.ui.lib.storage import ( + apply_disk_selection, + apply_partitioning, + create_partitioning, + filter_disks_by_names, + find_partitioning, + get_disks_summary, + is_passphrase_required, + reset_storage, + select_default_disks, + set_required_passphrase, +) +from pyanaconda.ui.tui.spokes import NormalTUISpoke +from pyanaconda.ui.tui.tuiobject import Dialog, PasswordDialog + log = get_module_logger(__name__) __all__ = ["StorageSpoke"] diff --git a/pyanaconda/ui/tui/spokes/time_spoke.py b/pyanaconda/ui/tui/spokes/time_spoke.py index 48bf5bd5180..8ade56a38e0 100644 --- a/pyanaconda/ui/tui/spokes/time_spoke.py +++ b/pyanaconda/ui/tui/spokes/time_spoke.py @@ -16,29 +16,28 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # +from collections import namedtuple + +from simpleline.render.containers import ListColumnContainer +from simpleline.render.prompt import Prompt +from simpleline.render.screen import InputState +from simpleline.render.screen_handler import ScreenHandler +from simpleline.render.widgets import TextWidget + +from pyanaconda import ntp, timezone +from pyanaconda.anaconda_loggers import get_module_logger +from pyanaconda.core import constants from pyanaconda.core.constants import TIME_SOURCE_SERVER +from pyanaconda.core.i18n import N_, _ +from pyanaconda.flags import flags from pyanaconda.modules.common.constants.services import TIMEZONE from pyanaconda.modules.common.structures.timezone import TimeSourceData from pyanaconda.modules.common.util import is_module_available from pyanaconda.ntp import NTPServerStatusCache from pyanaconda.ui.categories.localization import LocalizationCategory -from pyanaconda.ui.tui.spokes import NormalTUISpoke from pyanaconda.ui.common import FirstbootSpokeMixIn -from pyanaconda import timezone -from pyanaconda import ntp -from pyanaconda.core import constants -from pyanaconda.core.i18n import N_, _ -from pyanaconda.flags import flags - -from collections import namedtuple - -from simpleline.render.containers import ListColumnContainer -from simpleline.render.screen import InputState -from simpleline.render.widgets import TextWidget -from simpleline.render.screen_handler import ScreenHandler -from simpleline.render.prompt import Prompt +from pyanaconda.ui.tui.spokes import NormalTUISpoke -from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) __all__ = ["TimeSpoke"] diff --git a/pyanaconda/ui/tui/spokes/user.py b/pyanaconda/ui/tui/spokes/user.py index e914c1cae9a..ab312e0d813 100644 --- a/pyanaconda/ui/tui/spokes/user.py +++ b/pyanaconda/ui/tui/spokes/user.py @@ -16,23 +16,32 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # +from simpleline.render.containers import ListColumnContainer +from simpleline.render.screen import InputState +from simpleline.render.widgets import CheckboxWidget, EntryWidget + from pyanaconda.core.configuration.anaconda import conf -from pyanaconda.core.constants import FIRSTBOOT_ENVIRON, PASSWORD_SET, PASSWORD_POLICY_USER -from pyanaconda.flags import flags +from pyanaconda.core.constants import ( + FIRSTBOOT_ENVIRON, + PASSWORD_POLICY_USER, + PASSWORD_SET, +) from pyanaconda.core.i18n import N_, _ from pyanaconda.core.regexes import GECOS_VALID +from pyanaconda.core.users import check_grouplist, check_username, guess_username +from pyanaconda.flags import flags from pyanaconda.modules.common.constants.services import USERS from pyanaconda.modules.common.util import is_module_available from pyanaconda.ui.categories.user_settings import UserSettingsCategory from pyanaconda.ui.common import FirstbootSpokeMixIn -from pyanaconda.ui.tui.spokes import NormalTUISpoke -from pyanaconda.ui.tui.tuiobject import Dialog, PasswordDialog, report_if_failed, report_check_func from pyanaconda.ui.lib.users import get_user_list, set_user_list -from pyanaconda.core.users import guess_username, check_username, check_grouplist - -from simpleline.render.screen import InputState -from simpleline.render.containers import ListColumnContainer -from simpleline.render.widgets import CheckboxWidget, EntryWidget +from pyanaconda.ui.tui.spokes import NormalTUISpoke +from pyanaconda.ui.tui.tuiobject import ( + Dialog, + PasswordDialog, + report_check_func, + report_if_failed, +) __all__ = ["UserSpoke"] diff --git a/pyanaconda/ui/tui/tuiobject.py b/pyanaconda/ui/tui/tuiobject.py index bc008964342..9ee10a6c3fb 100644 --- a/pyanaconda/ui/tui/tuiobject.py +++ b/pyanaconda/ui/tui/tuiobject.py @@ -17,16 +17,20 @@ # Red Hat, Inc. # -from pyanaconda.ui import common +from simpleline.render.adv_widgets import ( + ErrorDialog, + GetInputScreen, + GetPasswordInputScreen, + YesNoDialog, +) +from simpleline.render.screen import Prompt, UIScreen +from simpleline.render.screen_handler import ScreenHandler -from pyanaconda.core import util, constants from pyanaconda import input_checking +from pyanaconda.core import constants, util from pyanaconda.core.i18n import _ from pyanaconda.core.users import crypt_password - -from simpleline.render.adv_widgets import ErrorDialog, GetInputScreen, GetPasswordInputScreen, YesNoDialog -from simpleline.render.screen import UIScreen, Prompt -from simpleline.render.screen_handler import ScreenHandler +from pyanaconda.ui import common def reporting_callback(message): diff --git a/pyanaconda/ui/webui/__init__.py b/pyanaconda/ui/webui/__init__.py index d12d57544df..1e33b2a288d 100644 --- a/pyanaconda/ui/webui/__init__.py +++ b/pyanaconda/ui/webui/__init__.py @@ -16,21 +16,25 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -import meh import os - from contextlib import contextmanager +import meh + from pyanaconda import ui from pyanaconda.anaconda_loggers import get_module_logger -from pyanaconda.core.constants import QUIT_MESSAGE, PAYLOAD_TYPE_DNF, WEBUI_VIEWER_PID_FILE, \ - BACKEND_READY_FLAG_FILE -from pyanaconda.core.util import startProgram -from pyanaconda.core.threads import thread_manager from pyanaconda.core.configuration.anaconda import conf -from pyanaconda.core.process_watchers import PidWatcher +from pyanaconda.core.constants import ( + BACKEND_READY_FLAG_FILE, + PAYLOAD_TYPE_DNF, + QUIT_MESSAGE, + WEBUI_VIEWER_PID_FILE, +) from pyanaconda.core.glib import create_main_loop from pyanaconda.core.path import touch +from pyanaconda.core.process_watchers import PidWatcher +from pyanaconda.core.threads import thread_manager +from pyanaconda.core.util import startProgram from pyanaconda.flags import flags log = get_module_logger(__name__) diff --git a/tests/gettext_tests/contexts.py b/tests/gettext_tests/contexts.py index 278b41bb25e..78ea5c70d87 100755 --- a/tests/gettext_tests/contexts.py +++ b/tests/gettext_tests/contexts.py @@ -16,9 +16,10 @@ # along with this program. If not, see . import os -import sys import re import string +import sys + def list_occurrences(occurrences): # Return polib's occurrences list [('file1', line1), ('file2', line2), ...] diff --git a/tests/glade_tests/test_format_string.py b/tests/glade_tests/test_format_string.py index 736dbc742e4..a05dc156520 100644 --- a/tests/glade_tests/test_format_string.py +++ b/tests/glade_tests/test_format_string.py @@ -15,9 +15,10 @@ # along with this program. If not, see . # -from gladecheck import check_glade_files from unittest import TestCase +from gladecheck import check_glade_files + class CheckFormatString(TestCase): def test_format_strings(self): diff --git a/tests/glade_tests/test_glade_validity.py b/tests/glade_tests/test_glade_validity.py index 98e0270db5b..759f3dd6b79 100644 --- a/tests/glade_tests/test_glade_validity.py +++ b/tests/glade_tests/test_glade_validity.py @@ -15,9 +15,10 @@ # along with this program. If not, see . from collections import Counter -from gladecheck import check_glade_files from unittest import TestCase +from gladecheck import check_glade_files + class CheckValidity(TestCase): def test_validity_check(self): diff --git a/tests/glade_tests/test_hidden_translatable.py b/tests/glade_tests/test_hidden_translatable.py index e54c81928ee..d18d5b96345 100644 --- a/tests/glade_tests/test_hidden_translatable.py +++ b/tests/glade_tests/test_hidden_translatable.py @@ -15,9 +15,10 @@ # along with this program. If not, see . # -from gladecheck import check_glade_files from unittest import TestCase +from gladecheck import check_glade_files + class CheckTranslatableComponents(TestCase): def test_translatable_treeview(self): diff --git a/tests/glade_tests/test_icons.py b/tests/glade_tests/test_icons.py index 18740a4ed30..36f435937f6 100644 --- a/tests/glade_tests/test_icons.py +++ b/tests/glade_tests/test_icons.py @@ -16,8 +16,9 @@ # import os -from gladecheck import check_glade_files from unittest import TestCase + +from gladecheck import check_glade_files from iconcheck import icon_exists diff --git a/tests/glade_tests/test_invisible_char.py b/tests/glade_tests/test_invisible_char.py index 74747e1469b..a4ab69564bd 100644 --- a/tests/glade_tests/test_invisible_char.py +++ b/tests/glade_tests/test_invisible_char.py @@ -15,9 +15,10 @@ # along with this program. If not, see . # -from gladecheck import check_glade_files from unittest import TestCase +from gladecheck import check_glade_files + class CheckInvisibleChar(TestCase): def test_invisible_char(self): diff --git a/tests/glade_tests/test_markup.py b/tests/glade_tests/test_markup.py index 5de087cce2e..5779309d16c 100644 --- a/tests/glade_tests/test_markup.py +++ b/tests/glade_tests/test_markup.py @@ -16,11 +16,11 @@ # along with this program. If not, see . # -from gladecheck import check_glade_files from unittest import TestCase -from pocketlint.pangocheck import markup_nodes, markup_match, markup_necessary +from gladecheck import check_glade_files from lxml import etree +from pocketlint.pangocheck import markup_match, markup_necessary, markup_nodes class PangoElementException(Exception): diff --git a/tests/glade_tests/test_mnemonics.py b/tests/glade_tests/test_mnemonics.py index 825a342ba72..345d0d46ac0 100644 --- a/tests/glade_tests/test_mnemonics.py +++ b/tests/glade_tests/test_mnemonics.py @@ -14,9 +14,10 @@ # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see . -from gladecheck import check_glade_files from unittest import TestCase +from gladecheck import check_glade_files + class CheckMnemonics(TestCase): def test_mnemonics(self): diff --git a/tests/glade_tests/test_pw_visibility.py b/tests/glade_tests/test_pw_visibility.py index d3ebe72d7c8..ceb47f6fda6 100644 --- a/tests/glade_tests/test_pw_visibility.py +++ b/tests/glade_tests/test_pw_visibility.py @@ -21,9 +21,10 @@ """ -from gladecheck import check_glade_files from unittest import TestCase +from gladecheck import check_glade_files + PW_ID_INDICATORS = ("pw", "password", "passwd", "passphrase") diff --git a/tests/glade_tests/test_viewport.py b/tests/glade_tests/test_viewport.py index f31766dc6a9..6708981ec6e 100644 --- a/tests/glade_tests/test_viewport.py +++ b/tests/glade_tests/test_viewport.py @@ -15,9 +15,9 @@ # along with this program. If not, see . # -from gladecheck import check_glade_files from unittest import TestCase +from gladecheck import check_glade_files # I guess we could look at the introspected classes and see if they implement the Scrollable # interface but that sounds like kind of a pain diff --git a/tests/lib/filelist.py b/tests/lib/filelist.py index f463cf08f82..ecd94ab9ed7 100644 --- a/tests/lib/filelist.py +++ b/tests/lib/filelist.py @@ -19,6 +19,7 @@ import os import subprocess + def testfilelist(filterfunc=None): """A generator function for the list of file names to check. diff --git a/tests/lib/gladecheck.py b/tests/lib/gladecheck.py index 34a110b365e..8d722d7d3d9 100644 --- a/tests/lib/gladecheck.py +++ b/tests/lib/gladecheck.py @@ -30,9 +30,10 @@ print("No module named lxml, you need to install the python3-lxml package") raise +import logging + from filelist import testfilelist -import logging log = logging.getLogger('unittest') diff --git a/tests/lib/shutup.py b/tests/lib/shutup.py index 424641ba76a..09d4f16edda 100644 --- a/tests/lib/shutup.py +++ b/tests/lib/shutup.py @@ -19,6 +19,7 @@ import os from contextlib import contextmanager + @contextmanager def shutup(): """Run something with stdout and stderr redirected to /dev/null diff --git a/tests/lib/timer.py b/tests/lib/timer.py index bfe77f1c9e6..89d5316a5c0 100644 --- a/tests/lib/timer.py +++ b/tests/lib/timer.py @@ -16,8 +16,9 @@ # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see . -from contextlib import contextmanager import signal +from contextlib import contextmanager + @contextmanager def timer(seconds): diff --git a/tests/pylint/censorship.py b/tests/pylint/censorship.py index 3ea17e98bea..382a179651f 100755 --- a/tests/pylint/censorship.py +++ b/tests/pylint/censorship.py @@ -30,13 +30,11 @@ __all__ = ["CensorshipConfig", "CensorshipLinter"] -import sys import re - +import sys from io import StringIO import pylint.lint - from pylint.reporters.text import TextReporter diff --git a/tests/pylint/runpylint.py b/tests/pylint/runpylint.py index 5058cdcfd27..5106b4b4a82 100755 --- a/tests/pylint/runpylint.py +++ b/tests/pylint/runpylint.py @@ -1,12 +1,11 @@ #!/usr/bin/python3 import atexit +import os import shutil import sys import tempfile import time -import os - from os import path from censorship import CensorshipConfig, CensorshipLinter, FalsePositive diff --git a/tests/rpm_tests/__init__.py b/tests/rpm_tests/__init__.py index 6d4cdceb45d..09d91e02b61 100644 --- a/tests/rpm_tests/__init__.py +++ b/tests/rpm_tests/__init__.py @@ -1,11 +1,9 @@ +import glob import os import subprocess -import glob - from unittest import TestCase - RPM_BUILD_DIR_ENV = "RPM_PATH" ROOT_DIR_ENV = "ROOT_ANACONDA_PATH" diff --git a/tests/ruff/ruff.toml b/tests/ruff/ruff.toml index 4a034ebb25f..13b94b16672 100644 --- a/tests/ruff/ruff.toml +++ b/tests/ruff/ruff.toml @@ -6,6 +6,7 @@ line-length = 99 select = [ "E", # pycodestyle error "F", # pyflakes + "I", # isort "W", # pycodestyle warning (mostly whitespace related) "PL", # pylint "ICN", # flake8-import-conventions @@ -46,3 +47,6 @@ ignore = [ "PLR1714", # Consider merging multiple comparisons: ``. Use a `set` if the elements are hashable. "RUF015", # Prefer `next(...)` over single element slice ] + +[lint.isort] +known-first-party = ["pyanaconda"] diff --git a/tests/unit_tests/__init__.py b/tests/unit_tests/__init__.py index 52aa39fd688..9f765f51667 100644 --- a/tests/unit_tests/__init__.py +++ b/tests/unit_tests/__init__.py @@ -15,10 +15,11 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -import os import locale -import pytest +import os + import gi.overrides +import pytest # Apply overrides for the anaconda widgets. if "ANACONDA_WIDGETS_OVERRIDES" in os.environ: diff --git a/tests/unit_tests/dd_tests/test_dd.py b/tests/unit_tests/dd_tests/test_dd.py index de34ae6101d..ab68de13cac 100644 --- a/tests/unit_tests/dd_tests/test_dd.py +++ b/tests/unit_tests/dd_tests/test_dd.py @@ -2,17 +2,16 @@ import os import shutil -import unittest -import tempfile import subprocess - +import tempfile +import unittest from abc import ABC - -from contextlib import contextmanager from collections import namedtuple -from rpmfluff import SourceFile, GeneratedSourceFile, SimpleRpmBuild -from rpmfluff.utils import expectedArch +from contextlib import contextmanager + +from rpmfluff import GeneratedSourceFile, SimpleRpmBuild, SourceFile from rpmfluff.make import make_elf +from rpmfluff.utils import expectedArch from shutup import shutup TOP_SRCDIR = os.environ.get("top_builddir", "../..") diff --git a/tests/unit_tests/dracut_tests/test_dracut_source.py b/tests/unit_tests/dracut_tests/test_dracut_source.py index 557e07430be..3a5dbc9898c 100644 --- a/tests/unit_tests/dracut_tests/test_dracut_source.py +++ b/tests/unit_tests/dracut_tests/test_dracut_source.py @@ -15,15 +15,13 @@ # subject to the GNU General Public License and may only be used or replicated # with the express permission of Red Hat, Inc. -import unittest import os import re - -import pyanaconda - -from os.path import dirname +import unittest from functools import reduce +from os.path import dirname +import pyanaconda from pyanaconda.core.path import join_paths REPO_DIR = dirname(os.path.realpath(pyanaconda.__file__)) diff --git a/tests/unit_tests/dracut_tests/test_driver_updates.py b/tests/unit_tests/dracut_tests/test_driver_updates.py index 8d6669d991b..74bba64b1f8 100644 --- a/tests/unit_tests/dracut_tests/test_driver_updates.py +++ b/tests/unit_tests/dracut_tests/test_driver_updates.py @@ -18,22 +18,28 @@ # test_driver_updates.py - unittests for driver_updates.py -import unittest -from unittest import mock - -import os -import tempfile -import shutil import collections -import re - import logging - +import os +import re +import shutil import sys +import tempfile +import unittest +from unittest import mock + sys.path.append(os.path.normpath(os.path.dirname(__file__)+'/../../dracut')) -from driver_updates import copy_files, move_files, iter_files, ensure_dir, append_line, \ - mkdir_seq, is_debug_mode_enabled, setup_log +from driver_updates import ( + append_line, + copy_files, + ensure_dir, + is_debug_mode_enabled, + iter_files, + mkdir_seq, + move_files, + setup_log, +) def touch(path): @@ -296,6 +302,8 @@ def test_append(self): from driver_updates import read_lines + + class TestReadLine(FileTestCaseBase): def test_empty(self): """read_lines: return [] for empty file""" @@ -340,7 +348,9 @@ def test_one_exists(self): assert os.path.isdir(firstdir) -from driver_updates import find_repos, save_repo, ARCH +from driver_updates import ARCH, find_repos, save_repo + + # As far as we know, this is what makes a valid repo: rhdd3 + rpms/`uname -m`/ def makerepo(topdir): descfile = makefile(topdir+'/rhdd3') @@ -445,7 +455,9 @@ def test_multiple_repo_folders(self): assert set(listfiles(saved3)) == set(["fake-something2.rpm"]) assert saved3 == os.path.join(self.destdir, "DD-3") -from driver_updates import mount, umount, mounted +from driver_updates import mount, mounted, umount + + class MountTestCase(unittest.TestCase): @mock.patch('driver_updates.mkdir_seq') @mock.patch('driver_updates.subprocess.check_call') @@ -489,7 +501,8 @@ def test_mount_manager(self, mock_umount, mock_mount): # NOTE: dd_list and dd_extract get tested pretty thoroughly in tests/dd_tests, # so this is a slightly higher-level test case -from driver_updates import dd_list, dd_extract, Driver +from driver_updates import Driver, dd_extract, dd_list + fake_module = Driver( source='/repo/path/to/fake-driver-1.0-1.rpm', name='fake-driver', @@ -545,6 +558,7 @@ def test_dd_extract(self, check_output): from driver_updates import extract_drivers, grab_driver_files, load_drivers + @mock.patch("driver_updates.ensure_dir") @mock.patch("driver_updates.save_repo") @mock.patch("driver_updates.append_line") @@ -696,6 +710,8 @@ def patched_check_output(command, stderr=None, universal_newlines=True): from driver_updates import process_driver_disk + + class ProcessDriverDiskTestCase(unittest.TestCase): def setUp(self): # an iterable that returns fake mountpoints, for mocking mount() @@ -765,6 +781,8 @@ def test_no_drivers(self): from driver_updates import process_driver_rpm + + class ProcessDriverRPMTestCase(unittest.TestCase): def setUp(self): self.frepo = { @@ -790,7 +808,8 @@ def test_basic(self): self.mocks['grab_driver_files'].assert_called_once_with() -from driver_updates import finish, mark_finished, all_finished +from driver_updates import all_finished, finish, mark_finished + class FinishedTestCase(FileTestCaseBase): def test_mark_finished(self): @@ -833,7 +852,8 @@ def test_finish(self): assert os.path.exists(done) -from driver_updates import get_deviceinfo, DeviceInfo +from driver_updates import DeviceInfo, get_deviceinfo + blkid_out = '''\ DEVNAME=/dev/sda2 UUID=0f21a3d1-dcd3-4ab4-a292-c5556850d561 @@ -892,7 +912,10 @@ def test_shortdev(self): # TODO: test TextMenu itself from io import StringIO + from driver_updates import device_menu + + class DeviceMenuTestCase(unittest.TestCase): def setUp(self): patches = ( @@ -935,6 +958,8 @@ def test_device_menu(self, stdout): from driver_updates import list_aliases + + class ListAliasesTestCase(unittest.TestCase): @mock.patch('driver_updates.subprocess.check_output', return_value="alias1\nalias2\n") def test_basic(self, check_output): diff --git a/tests/unit_tests/dracut_tests/test_parse_kickstart.py b/tests/unit_tests/dracut_tests/test_parse_kickstart.py index d444af0fcef..1160b1cc3c7 100644 --- a/tests/unit_tests/dracut_tests/test_parse_kickstart.py +++ b/tests/unit_tests/dracut_tests/test_parse_kickstart.py @@ -16,11 +16,12 @@ # with the express permission of Red Hat, Inc. import os -import unittest -import tempfile +import re import shutil import subprocess -import re +import tempfile +import unittest + class BaseTestCase(unittest.TestCase): def setUp(self): diff --git a/tests/unit_tests/pyanaconda_tests/__init__.py b/tests/unit_tests/pyanaconda_tests/__init__.py index d04f59012f2..880050d0fda 100644 --- a/tests/unit_tests/pyanaconda_tests/__init__.py +++ b/tests/unit_tests/pyanaconda_tests/__init__.py @@ -15,23 +15,23 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from collections import defaultdict - import re +from collections import defaultdict import gi -gi.require_version("GLib", "2.0") -from gi.repository import GLib +gi.require_version("GLib", "2.0") from contextlib import ContextDecorator from textwrap import dedent from unittest.mock import Mock, patch from dasbus.server.template import BasicInterfaceTemplate +from dasbus.typing import get_native +from gi.repository import GLib + from pyanaconda.modules.common.constants.interfaces import KICKSTART_MODULE from pyanaconda.modules.common.structures.kickstart import KickstartReport from pyanaconda.modules.common.task import TaskInterface -from dasbus.typing import get_native class run_in_glib: diff --git a/tests/unit_tests/pyanaconda_tests/core/test_configuration.py b/tests/unit_tests/pyanaconda_tests/core/test_configuration.py index 1617e2116ee..c9f2add7ddd 100644 --- a/tests/unit_tests/pyanaconda_tests/core/test_configuration.py +++ b/tests/unit_tests/pyanaconda_tests/core/test_configuration.py @@ -20,25 +20,40 @@ import os import tempfile import unittest -import pytest from textwrap import dedent from unittest.mock import patch +import pytest from blivet.size import Size from dasbus.namespace import get_dbus_name -from pyanaconda.core.configuration.anaconda import AnacondaConfiguration, \ - _convert_geoloc_provider_id_to_url -from pyanaconda.core.configuration.base import create_parser, read_config, write_config, \ - get_option, set_option, ConfigurationError, ConfigurationDataError, ConfigurationFileError, \ - Configuration -from pyanaconda.core.configuration.storage import StorageSection +from pyanaconda.core.configuration.anaconda import ( + AnacondaConfiguration, + _convert_geoloc_provider_id_to_url, +) +from pyanaconda.core.configuration.base import ( + Configuration, + ConfigurationDataError, + ConfigurationError, + ConfigurationFileError, + create_parser, + get_option, + read_config, + set_option, + write_config, +) from pyanaconda.core.configuration.payload import PayloadSection +from pyanaconda.core.configuration.storage import StorageSection from pyanaconda.core.configuration.ui import UserInterfaceSection -from pyanaconda.modules.common.constants import services, namespaces -from pyanaconda.core.constants import SOURCE_TYPE_CLOSEST_MIRROR, GEOLOC_DEFAULT_PROVIDER, \ - GEOLOC_PROVIDER_FEDORA_GEOIP, GEOLOC_PROVIDER_HOSTIP, GEOLOC_URL_FEDORA_GEOIP, \ - GEOLOC_URL_HOSTIP +from pyanaconda.core.constants import ( + GEOLOC_DEFAULT_PROVIDER, + GEOLOC_PROVIDER_FEDORA_GEOIP, + GEOLOC_PROVIDER_HOSTIP, + GEOLOC_URL_FEDORA_GEOIP, + GEOLOC_URL_HOSTIP, + SOURCE_TYPE_CLOSEST_MIRROR, +) +from pyanaconda.modules.common.constants import namespaces, services # Path to the configuration directory of the repo. CONFIG_DIR = os.environ.get("ANACONDA_DATA") diff --git a/tests/unit_tests/pyanaconda_tests/core/test_dbus.py b/tests/unit_tests/pyanaconda_tests/core/test_dbus.py index 1d236f0c0f3..93e649e2bbd 100644 --- a/tests/unit_tests/pyanaconda_tests/core/test_dbus.py +++ b/tests/unit_tests/pyanaconda_tests/core/test_dbus.py @@ -19,14 +19,15 @@ # import tempfile import unittest -import pytest from unittest.mock import patch -from pyanaconda.core.dbus import AnacondaMessageBus, DefaultMessageBus +import gi +import pytest from dasbus.constants import DBUS_STARTER_ADDRESS + from pyanaconda.core.constants import DBUS_ANACONDA_SESSION_ADDRESS +from pyanaconda.core.dbus import AnacondaMessageBus, DefaultMessageBus -import gi gi.require_version("Gio", "2.0") from gi.repository import Gio diff --git a/tests/unit_tests/pyanaconda_tests/core/test_hw.py b/tests/unit_tests/pyanaconda_tests/core/test_hw.py index 0684f191f12..10c1034be9b 100644 --- a/tests/unit_tests/pyanaconda_tests/core/test_hw.py +++ b/tests/unit_tests/pyanaconda_tests/core/test_hw.py @@ -17,11 +17,15 @@ # Red Hat, Inc. import unittest -from unittest.mock import patch -from textwrap import dedent from io import StringIO +from textwrap import dedent +from unittest.mock import patch -from pyanaconda.core.hw import is_lpae_available, detect_virtualized_platform, is_smt_enabled +from pyanaconda.core.hw import ( + detect_virtualized_platform, + is_lpae_available, + is_smt_enabled, +) class MiscHwUtilsTests(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/core/test_kernel.py b/tests/unit_tests/pyanaconda_tests/core/test_kernel.py index a7aedc6268d..14caa35689e 100644 --- a/tests/unit_tests/pyanaconda_tests/core/test_kernel.py +++ b/tests/unit_tests/pyanaconda_tests/core/test_kernel.py @@ -17,7 +17,9 @@ # import unittest + from pyanaconda.core.kernel import KernelArguments, kernel_arguments + # FIXME: https://github.com/pylint-dev/pylint/issues/10112 # Re-enable the following line when the issue is fixed # from collections.abc import Iterable diff --git a/tests/unit_tests/pyanaconda_tests/core/test_live_user.py b/tests/unit_tests/pyanaconda_tests/core/test_live_user.py index f676f65281d..d760f491f34 100644 --- a/tests/unit_tests/pyanaconda_tests/core/test_live_user.py +++ b/tests/unit_tests/pyanaconda_tests/core/test_live_user.py @@ -18,8 +18,9 @@ # from unittest import TestCase -from unittest.mock import patch, Mock -from pyanaconda.core.live_user import get_live_user, User +from unittest.mock import Mock, patch + +from pyanaconda.core.live_user import User, get_live_user class GetLiveUserTests(TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/core/test_path.py b/tests/unit_tests/pyanaconda_tests/core/test_path.py index a9848209449..dccfc9ffd08 100644 --- a/tests/unit_tests/pyanaconda_tests/core/test_path.py +++ b/tests/unit_tests/pyanaconda_tests/core/test_path.py @@ -18,10 +18,19 @@ import shutil import tempfile import unittest -from unittest.mock import patch, call +from unittest.mock import call, patch + import pytest -from pyanaconda.core.path import set_system_root, make_directories, get_mount_paths, \ - open_with_perm, join_paths, touch, set_mode + +from pyanaconda.core.path import ( + get_mount_paths, + join_paths, + make_directories, + open_with_perm, + set_mode, + set_system_root, + touch, +) class SetSystemRootTests(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/core/test_product.py b/tests/unit_tests/pyanaconda_tests/core/test_product.py index 15215912cba..f9b252c77bd 100644 --- a/tests/unit_tests/pyanaconda_tests/core/test_product.py +++ b/tests/unit_tests/pyanaconda_tests/core/test_product.py @@ -18,13 +18,21 @@ # Test the Python-based signal and slot implementation. # -from textwrap import dedent import unittest -from unittest.mock import patch, mock_open -from pyanaconda.core.product import ProductData, get_product_values, get_product_name, \ - get_product_is_final_release, get_product_short_name, get_product_version, \ - trim_product_version_for_ui, shorten_product_name +from textwrap import dedent +from unittest.mock import mock_open, patch + import pyanaconda.core.product # needed for patching, see below +from pyanaconda.core.product import ( + ProductData, + get_product_is_final_release, + get_product_name, + get_product_short_name, + get_product_values, + get_product_version, + shorten_product_name, + trim_product_version_for_ui, +) def make_buildstamp(product="Fedora", version="Rawhide", is_final=False): diff --git a/tests/unit_tests/pyanaconda_tests/core/test_profile.py b/tests/unit_tests/pyanaconda_tests/core/test_profile.py index 05b95c72c59..4b7f5ce17db 100644 --- a/tests/unit_tests/pyanaconda_tests/core/test_profile.py +++ b/tests/unit_tests/pyanaconda_tests/core/test_profile.py @@ -20,18 +20,24 @@ import os import tempfile import unittest -import pytest - from textwrap import dedent from unittest.mock import patch + +import pytest from blivet.size import Size from pykickstart.constants import AUTOPART_TYPE_BTRFS -from pyanaconda.modules.storage.partitioning.automatic.utils import get_default_partitioning -from pyanaconda.modules.storage.partitioning.specification import PartSpec from pyanaconda.core.configuration.anaconda import AnacondaConfiguration -from pyanaconda.core.configuration.base import ConfigurationError, create_parser, read_config +from pyanaconda.core.configuration.base import ( + ConfigurationError, + create_parser, + read_config, +) from pyanaconda.core.configuration.profile import ProfileLoader +from pyanaconda.modules.storage.partitioning.automatic.utils import ( + get_default_partitioning, +) +from pyanaconda.modules.storage.partitioning.specification import PartSpec PROFILE_DIR = os.path.join(os.environ.get("ANACONDA_DATA"), "profile.d") diff --git a/tests/unit_tests/pyanaconda_tests/core/test_services.py b/tests/unit_tests/pyanaconda_tests/core/test_services.py index 8d5965aaea2..20834698e88 100644 --- a/tests/unit_tests/pyanaconda_tests/core/test_services.py +++ b/tests/unit_tests/pyanaconda_tests/core/test_services.py @@ -17,7 +17,9 @@ # import unittest from unittest.mock import patch + import pytest + from pyanaconda.core import service diff --git a/tests/unit_tests/pyanaconda_tests/core/test_signal.py b/tests/unit_tests/pyanaconda_tests/core/test_signal.py index 20d03f2bce5..d696753b094 100644 --- a/tests/unit_tests/pyanaconda_tests/core/test_signal.py +++ b/tests/unit_tests/pyanaconda_tests/core/test_signal.py @@ -24,6 +24,7 @@ from pyanaconda.core.signal import Signal + class FooClass: def __init__(self): self._var = None diff --git a/tests/unit_tests/pyanaconda_tests/core/test_startup_utils.py b/tests/unit_tests/pyanaconda_tests/core/test_startup_utils.py index 2c2156f221c..011b7012a7e 100644 --- a/tests/unit_tests/pyanaconda_tests/core/test_startup_utils.py +++ b/tests/unit_tests/pyanaconda_tests/core/test_startup_utils.py @@ -19,18 +19,26 @@ # easy to test but we can try to improve that. # -import unittest import os - -from unittest.mock import patch, mock_open, Mock, PropertyMock +import unittest from textwrap import dedent +from unittest.mock import Mock, PropertyMock, mock_open, patch -from pyanaconda.startup_utils import print_dracut_errors, check_if_geolocation_should_be_used, \ - start_geolocation_conditionally, wait_for_geolocation_and_use, apply_geolocation_result, \ - fallback_to_tui_if_gtk_ui_is_not_available -from pyanaconda.core.constants import GEOLOC_CONNECTION_TIMEOUT, TIMEZONE_PRIORITY_GEOLOCATION, \ - DisplayModes +from pyanaconda.core.constants import ( + GEOLOC_CONNECTION_TIMEOUT, + TIMEZONE_PRIORITY_GEOLOCATION, + DisplayModes, +) from pyanaconda.modules.common.structures.timezone import GeolocationData +from pyanaconda.startup_utils import ( + apply_geolocation_result, + check_if_geolocation_should_be_used, + fallback_to_tui_if_gtk_ui_is_not_available, + print_dracut_errors, + start_geolocation_conditionally, + wait_for_geolocation_and_use, +) + class StartupUtilsTestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/core/test_storage.py b/tests/unit_tests/pyanaconda_tests/core/test_storage.py index d41a78d36d4..1d7249bf2a2 100644 --- a/tests/unit_tests/pyanaconda_tests/core/test_storage.py +++ b/tests/unit_tests/pyanaconda_tests/core/test_storage.py @@ -19,7 +19,7 @@ from unittest.mock import patch from blivet.size import Size -from bytesize import KiB, ROUND_HALF_UP +from bytesize import ROUND_HALF_UP, KiB from pyanaconda.core.storage import suggest_swap_size diff --git a/tests/unit_tests/pyanaconda_tests/core/test_string.py b/tests/unit_tests/pyanaconda_tests/core/test_string.py index 09ba4be6e70..8b9cb93c87e 100644 --- a/tests/unit_tests/pyanaconda_tests/core/test_string.py +++ b/tests/unit_tests/pyanaconda_tests/core/test_string.py @@ -18,8 +18,15 @@ import unittest -from pyanaconda.core.string import strip_accents, upcase_first_letter, _to_ascii, upper_ascii, \ - lower_ascii, have_word_match, split_in_two +from pyanaconda.core.string import ( + _to_ascii, + have_word_match, + lower_ascii, + split_in_two, + strip_accents, + upcase_first_letter, + upper_ascii, +) class UpcaseFirstLetterTests(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/core/test_threads.py b/tests/unit_tests/pyanaconda_tests/core/test_threads.py index 25e2e1a1f01..f8b95618aeb 100644 --- a/tests/unit_tests/pyanaconda_tests/core/test_threads.py +++ b/tests/unit_tests/pyanaconda_tests/core/test_threads.py @@ -17,12 +17,13 @@ # import sys -import pytest import unittest +from time import sleep from unittest.mock import patch -from time import sleep -from pyanaconda.core.threads import ThreadManager, AnacondaThread +import pytest + +from pyanaconda.core.threads import AnacondaThread, ThreadManager class ThreadManagerTestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/core/test_user.py b/tests/unit_tests/pyanaconda_tests/core/test_user.py index 54e03c60aa8..e8575826ce6 100644 --- a/tests/unit_tests/pyanaconda_tests/core/test_user.py +++ b/tests/unit_tests/pyanaconda_tests/core/test_user.py @@ -20,7 +20,8 @@ # import unittest -from pyanaconda.core.users import check_username, check_groupname, check_grouplist + +from pyanaconda.core.users import check_grouplist, check_groupname, check_username class UserNameTests(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/core/test_user_create.py b/tests/unit_tests/pyanaconda_tests/core/test_user_create.py index 5049edcf28f..b6c25d68f3b 100644 --- a/tests/unit_tests/pyanaconda_tests/core/test_user_create.py +++ b/tests/unit_tests/pyanaconda_tests/core/test_user_create.py @@ -17,11 +17,12 @@ # Red Hat, Inc. # +import os +import shutil +import tempfile import unittest from unittest.mock import patch -import tempfile -import shutil -import os + import pytest try: @@ -32,6 +33,7 @@ from pyanaconda.core import users from pyanaconda.core.path import make_directories, touch + @unittest.skipIf(os.geteuid() != 0, "user creation must be run as root") class UserCreateTest(unittest.TestCase): def setUp(self): diff --git a/tests/unit_tests/pyanaconda_tests/core/test_util.py b/tests/unit_tests/pyanaconda_tests/core/test_util.py index 95545bacbe0..43d128ae0e7 100644 --- a/tests/unit_tests/pyanaconda_tests/core/test_util.py +++ b/tests/unit_tests/pyanaconda_tests/core/test_util.py @@ -16,26 +16,26 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. -import unittest import os -import tempfile import signal import sys -import pytest - +import tempfile +import unittest +from io import StringIO +from textwrap import dedent from threading import Lock from unittest.mock import Mock, patch + +import pytest from timer import timer -from io import StringIO -from textwrap import dedent -from pyanaconda.core.path import make_directories -from pyanaconda.errors import ExitError -from pyanaconda.core.process_watchers import WatchProcesses from pyanaconda.core import util -from pyanaconda.core.util import synchronized, LazyObject, is_stage2_on_nfs from pyanaconda.core.configuration.anaconda import conf from pyanaconda.core.live_user import User +from pyanaconda.core.path import make_directories +from pyanaconda.core.process_watchers import WatchProcesses +from pyanaconda.core.util import LazyObject, is_stage2_on_nfs, synchronized +from pyanaconda.errors import ExitError class RunProgramTests(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/modules/boss/test_boss.py b/tests/unit_tests/pyanaconda_tests/modules/boss/test_boss.py index e566106fa15..2c9d9994ed2 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/boss/test_boss.py +++ b/tests/unit_tests/pyanaconda_tests/modules/boss/test_boss.py @@ -30,9 +30,12 @@ from pyanaconda.modules.boss.module_manager.start_modules import StartModulesTask from pyanaconda.modules.common.structures.requirement import Requirement from pyanaconda.payload.migrated import ActiveDBusPayload - -from tests.unit_tests.pyanaconda_tests import patch_dbus_publish_object, check_task_creation, \ - patch_dbus_get_proxy, check_task_creation_list +from tests.unit_tests.pyanaconda_tests import ( + check_task_creation, + check_task_creation_list, + patch_dbus_get_proxy, + patch_dbus_publish_object, +) class BossInterfaceTestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/modules/boss/test_copy_logs_task.py b/tests/unit_tests/pyanaconda_tests/modules/boss/test_copy_logs_task.py index 01680d831a4..7b70d34ecd5 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/boss/test_copy_logs_task.py +++ b/tests/unit_tests/pyanaconda_tests/modules/boss/test_copy_logs_task.py @@ -17,6 +17,7 @@ # import unittest from unittest.mock import call, patch + from pyanaconda.modules.boss.installation import CopyLogsTask diff --git a/tests/unit_tests/pyanaconda_tests/modules/boss/test_install_category.py b/tests/unit_tests/pyanaconda_tests/modules/boss/test_install_category.py index 2046b65bfd5..8538a55c0fc 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/boss/test_install_category.py +++ b/tests/unit_tests/pyanaconda_tests/modules/boss/test_install_category.py @@ -19,9 +19,9 @@ import unittest from unittest.mock import Mock, call -from pyanaconda.core.constants import CATEGORY_SYSTEM, CATEGORY_STORAGE +from pyanaconda.core.constants import CATEGORY_STORAGE, CATEGORY_SYSTEM from pyanaconda.installation import RunInstallationTask -from pyanaconda.installation_tasks import TaskQueue, Task +from pyanaconda.installation_tasks import Task, TaskQueue class TestRunInstallation(RunInstallationTask): diff --git a/tests/unit_tests/pyanaconda_tests/modules/boss/test_kickstart.py b/tests/unit_tests/pyanaconda_tests/modules/boss/test_kickstart.py index a4e3385ac3a..44c2e360356 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/boss/test_kickstart.py +++ b/tests/unit_tests/pyanaconda_tests/modules/boss/test_kickstart.py @@ -16,8 +16,8 @@ # Red Hat, Inc. # -import unittest import os +import unittest from contextlib import contextmanager from unittest.mock import Mock, patch @@ -26,7 +26,10 @@ from pyanaconda.modules.boss.kickstart_manager import KickstartManager from pyanaconda.modules.boss.module_manager.module_observer import ModuleObserver from pyanaconda.modules.common.errors.runtime import ScriptError -from pyanaconda.modules.common.structures.kickstart import KickstartReport, KickstartMessage +from pyanaconda.modules.common.structures.kickstart import ( + KickstartMessage, + KickstartReport, +) from pyanaconda.modules.runtime.scripts import ScriptsModule from pyanaconda.modules.runtime.scripts.runtime import RunScriptsTask from pyanaconda.modules.runtime.scripts.scripts_interface import ScriptsInterface diff --git a/tests/unit_tests/pyanaconda_tests/modules/boss/test_kickstart_dispatcher.py b/tests/unit_tests/pyanaconda_tests/modules/boss/test_kickstart_dispatcher.py index 6efd693bdb1..9754ea54534 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/boss/test_kickstart_dispatcher.py +++ b/tests/unit_tests/pyanaconda_tests/modules/boss/test_kickstart_dispatcher.py @@ -18,18 +18,23 @@ # with the express permission of Red Hat, Inc. # -import unittest import os import shlex -import pytest +import unittest from contextlib import contextmanager -from pyanaconda.modules.boss.kickstart_manager.element import KickstartElement,\ - TrackedKickstartElements -from pyanaconda.modules.boss.kickstart_manager.parser import SplitKickstartParser, \ - VALID_SECTIONS_ANACONDA +import pytest +from pykickstart.errors import KickstartError, KickstartParseError from pykickstart.version import makeVersion -from pykickstart.errors import KickstartParseError, KickstartError + +from pyanaconda.modules.boss.kickstart_manager.element import ( + KickstartElement, + TrackedKickstartElements, +) +from pyanaconda.modules.boss.kickstart_manager.parser import ( + VALID_SECTIONS_ANACONDA, + SplitKickstartParser, +) KICKSTART1 = """ text diff --git a/tests/unit_tests/pyanaconda_tests/modules/boss/test_modules.py b/tests/unit_tests/pyanaconda_tests/modules/boss/test_modules.py index e8cea73314b..b5e14bd7989 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/boss/test_modules.py +++ b/tests/unit_tests/pyanaconda_tests/modules/boss/test_modules.py @@ -16,10 +16,10 @@ # Red Hat, Inc. # import unittest -import pytest from unittest.mock import Mock, patch -from dasbus.constants import DBUS_START_REPLY_SUCCESS, DBUS_FLAG_NONE +import pytest +from dasbus.constants import DBUS_FLAG_NONE, DBUS_START_REPLY_SUCCESS from dasbus.error import DBusError from pyanaconda.modules.boss.module_manager import ModuleManager diff --git a/tests/unit_tests/pyanaconda_tests/modules/boss/test_observer.py b/tests/unit_tests/pyanaconda_tests/modules/boss/test_observer.py index 70005765eac..db0c8b933c5 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/boss/test_observer.py +++ b/tests/unit_tests/pyanaconda_tests/modules/boss/test_observer.py @@ -18,10 +18,11 @@ # Red Hat Author(s): Vendula Poncova # import unittest -import pytest from unittest.mock import Mock +import pytest from dasbus.client.observer import DBusObserverError + from pyanaconda.modules.boss.module_manager.module_observer import ModuleObserver diff --git a/tests/unit_tests/pyanaconda_tests/modules/boss/test_set_file_contexts_task.py b/tests/unit_tests/pyanaconda_tests/modules/boss/test_set_file_contexts_task.py index eb2440ee3af..8c685c38716 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/boss/test_set_file_contexts_task.py +++ b/tests/unit_tests/pyanaconda_tests/modules/boss/test_set_file_contexts_task.py @@ -17,6 +17,7 @@ # import unittest from unittest.mock import patch + from pyanaconda.modules.boss.installation import SetContextsTask diff --git a/tests/unit_tests/pyanaconda_tests/modules/common/test_base.py b/tests/unit_tests/pyanaconda_tests/modules/common/test_base.py index 5ec3694db8e..1edabbdab82 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/common/test_base.py +++ b/tests/unit_tests/pyanaconda_tests/modules/common/test_base.py @@ -19,14 +19,18 @@ import warnings from dasbus.typing import * # pylint: disable=wildcard-import +from pykickstart.errors import ( + KickstartDeprecationWarning, + KickstartParseError, + KickstartParseWarning, +) -from pykickstart.errors import KickstartParseError, KickstartParseWarning, \ - KickstartDeprecationWarning - -from tests.unit_tests.pyanaconda_tests import patch_dbus_publish_object, check_task_creation_list - -from pyanaconda.modules.common.base import KickstartService, KickstartModuleInterface +from pyanaconda.modules.common.base import KickstartModuleInterface, KickstartService from pyanaconda.modules.common.task import Task +from tests.unit_tests.pyanaconda_tests import ( + check_task_creation_list, + patch_dbus_publish_object, +) class BaseModuleTestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/modules/common/test_error.py b/tests/unit_tests/pyanaconda_tests/modules/common/test_error.py index 4a4e2450ea2..337a80fe8e1 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/common/test_error.py +++ b/tests/unit_tests/pyanaconda_tests/modules/common/test_error.py @@ -18,10 +18,11 @@ import unittest from dasbus.error import DBusError + from pyanaconda.core.dbus import error_mapper +from pyanaconda.modules.common.errors.general import AnacondaError from pyanaconda.modules.common.errors.module import UnavailableModuleError from pyanaconda.modules.common.errors.payload import SourceSetupError -from pyanaconda.modules.common.errors.general import AnacondaError class DBusErrorTestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/modules/common/test_policy.py b/tests/unit_tests/pyanaconda_tests/modules/common/test_policy.py index f2c15c9287e..260e6271599 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/common/test_policy.py +++ b/tests/unit_tests/pyanaconda_tests/modules/common/test_policy.py @@ -16,9 +16,10 @@ # Red Hat, Inc. # import unittest + import pytest +from dasbus.typing import Int, get_variant -from dasbus.typing import get_variant, Int from pyanaconda.modules.common.structures.policy import PasswordPolicy diff --git a/tests/unit_tests/pyanaconda_tests/modules/common/test_secret_data.py b/tests/unit_tests/pyanaconda_tests/modules/common/test_secret_data.py index 71c3085ff12..030063033c3 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/common/test_secret_data.py +++ b/tests/unit_tests/pyanaconda_tests/modules/common/test_secret_data.py @@ -19,10 +19,18 @@ from dasbus.structure import DBusData from dasbus.typing import * # pylint: disable=wildcard-import -from pyanaconda.core.constants import SECRET_TYPE_NONE, \ - SECRET_TYPE_TEXT, SECRET_TYPE_HIDDEN -from pyanaconda.modules.common.structures.secret import SecretData, SecretDataList, hide_secrets, \ - get_public_copy + +from pyanaconda.core.constants import ( + SECRET_TYPE_HIDDEN, + SECRET_TYPE_NONE, + SECRET_TYPE_TEXT, +) +from pyanaconda.modules.common.structures.secret import ( + SecretData, + SecretDataList, + get_public_copy, + hide_secrets, +) class SecretDataTestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/modules/common/test_services.py b/tests/unit_tests/pyanaconda_tests/modules/common/test_services.py index a51c6fd24e8..814f601b5c9 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/common/test_services.py +++ b/tests/unit_tests/pyanaconda_tests/modules/common/test_services.py @@ -21,23 +21,33 @@ import tempfile import unittest from textwrap import dedent - from unittest.mock import patch -from tests.unit_tests.pyanaconda_tests import patch_dbus_publish_object, \ - check_kickstart_interface, check_dbus_property - -from pyanaconda.core.constants import SETUP_ON_BOOT_DISABLED, \ - SETUP_ON_BOOT_RECONFIG, SETUP_ON_BOOT_ENABLED, SETUP_ON_BOOT_DEFAULT, \ - TEXT_ONLY_TARGET, GRAPHICAL_TARGET +from pyanaconda.core.constants import ( + GRAPHICAL_TARGET, + SETUP_ON_BOOT_DEFAULT, + SETUP_ON_BOOT_DISABLED, + SETUP_ON_BOOT_ENABLED, + SETUP_ON_BOOT_RECONFIG, + TEXT_ONLY_TARGET, +) from pyanaconda.modules.common.constants.services import SERVICES -from pyanaconda.modules.services.installation import ConfigurePostInstallationToolsTask from pyanaconda.modules.common.task import TaskInterface +from pyanaconda.modules.services.constants import SetupOnBootAction +from pyanaconda.modules.services.installation import ( + ConfigureDefaultDesktopTask, + ConfigureInitialSetupTask, + ConfigurePostInstallationToolsTask, + ConfigureServicesTask, + ConfigureSystemdDefaultTargetTask, +) from pyanaconda.modules.services.services import ServicesService from pyanaconda.modules.services.services_interface import ServicesInterface -from pyanaconda.modules.services.constants import SetupOnBootAction -from pyanaconda.modules.services.installation import ConfigureInitialSetupTask, \ - ConfigureServicesTask, ConfigureSystemdDefaultTargetTask, ConfigureDefaultDesktopTask +from tests.unit_tests.pyanaconda_tests import ( + check_dbus_property, + check_kickstart_interface, + patch_dbus_publish_object, +) class ServicesInterfaceTestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/modules/common/test_tasks.py b/tests/unit_tests/pyanaconda_tests/modules/common/test_tasks.py index e74fb17f0a8..85a5af4fabe 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/common/test_tasks.py +++ b/tests/unit_tests/pyanaconda_tests/modules/common/test_tasks.py @@ -16,16 +16,21 @@ # Red Hat, Inc. # import unittest -import pytest - from time import sleep from unittest.mock import Mock +import pytest from dasbus.server.interface import dbus_class from dasbus.typing import * # pylint: disable=wildcard-import + from pyanaconda.modules.common.errors.task import NoResultError -from pyanaconda.modules.common.task import Task, TaskInterface, sync_run_task, \ - async_run_task, wait_for_task +from pyanaconda.modules.common.task import ( + Task, + TaskInterface, + async_run_task, + sync_run_task, + wait_for_task, +) from tests.unit_tests.pyanaconda_tests import run_in_glib diff --git a/tests/unit_tests/pyanaconda_tests/modules/localization/test_live_keyboard.py b/tests/unit_tests/pyanaconda_tests/modules/localization/test_live_keyboard.py index de59d94bf0b..e9b00dbff2e 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/localization/test_live_keyboard.py +++ b/tests/unit_tests/pyanaconda_tests/modules/localization/test_live_keyboard.py @@ -18,8 +18,10 @@ import unittest from unittest.mock import patch -from pyanaconda.modules.localization.live_keyboard import GnomeShellKeyboard, \ - get_live_keyboard_instance +from pyanaconda.modules.localization.live_keyboard import ( + GnomeShellKeyboard, + get_live_keyboard_instance, +) class LiveSystemKeyboardTestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/modules/localization/test_localed_wrapper.py b/tests/unit_tests/pyanaconda_tests/modules/localization/test_localed_wrapper.py index ac73f31b5a3..815c02108bc 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/localization/test_localed_wrapper.py +++ b/tests/unit_tests/pyanaconda_tests/modules/localization/test_localed_wrapper.py @@ -16,10 +16,10 @@ # Red Hat, Inc. # import unittest -from unittest.mock import patch, Mock -from pyanaconda.core.signal import Signal -from pyanaconda.core.glib import Variant +from unittest.mock import Mock, patch +from pyanaconda.core.glib import Variant +from pyanaconda.core.signal import Signal from pyanaconda.modules.localization.localed import LocaledWrapper diff --git a/tests/unit_tests/pyanaconda_tests/modules/localization/test_module_localization.py b/tests/unit_tests/pyanaconda_tests/modules/localization/test_module_localization.py index 75c4d05a8aa..90cbd3db534 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/localization/test_module_localization.py +++ b/tests/unit_tests/pyanaconda_tests/modules/localization/test_module_localization.py @@ -18,25 +18,33 @@ # Red Hat Author(s): Radek Vykydal # import unittest -import langtable - -from unittest.mock import patch, Mock from textwrap import dedent +from unittest.mock import Mock, patch -from tests.unit_tests.pyanaconda_tests import check_kickstart_interface, \ - patch_dbus_publish_object, PropertiesChangedCallback, check_dbus_property, check_task_creation +import langtable +from dasbus.signal import Signal +from dasbus.typing import Bool, Str, get_variant from pyanaconda.modules.common.constants.services import LOCALIZATION from pyanaconda.modules.common.structures.language import LanguageData, LocaleData -from pyanaconda.modules.localization.installation import LanguageInstallationTask, \ - KeyboardInstallationTask +from pyanaconda.modules.common.task import TaskInterface +from pyanaconda.modules.localization.installation import ( + KeyboardInstallationTask, + LanguageInstallationTask, +) from pyanaconda.modules.localization.localization import LocalizationService from pyanaconda.modules.localization.localization_interface import LocalizationInterface -from pyanaconda.modules.localization.runtime import GetMissingKeyboardConfigurationTask, \ - ApplyKeyboardTask -from pyanaconda.modules.common.task import TaskInterface -from dasbus.typing import get_variant, Str, Bool -from dasbus.signal import Signal +from pyanaconda.modules.localization.runtime import ( + ApplyKeyboardTask, + GetMissingKeyboardConfigurationTask, +) +from tests.unit_tests.pyanaconda_tests import ( + PropertiesChangedCallback, + check_dbus_property, + check_kickstart_interface, + check_task_creation, + patch_dbus_publish_object, +) class LocalizationInterfaceTestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/modules/localization/test_module_localization_tasks.py b/tests/unit_tests/pyanaconda_tests/modules/localization/test_module_localization_tasks.py index 0ac30850ed7..e1f5c2b9678 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/localization/test_module_localization_tasks.py +++ b/tests/unit_tests/pyanaconda_tests/modules/localization/test_module_localization_tasks.py @@ -18,20 +18,30 @@ import os import tempfile import unittest -import pytest - -from unittest.mock import patch, Mock, call -from textwrap import dedent from contextlib import contextmanager +from textwrap import dedent +from unittest.mock import Mock, call, patch + +import pytest from pyanaconda.core.constants import DEFAULT_KEYBOARD, DEFAULT_VC_FONT from pyanaconda.modules.common.errors.configuration import KeyboardConfigurationError from pyanaconda.modules.common.errors.installation import KeyboardInstallationError -from pyanaconda.modules.localization.installation import LanguageInstallationTask, \ - KeyboardInstallationTask, write_vc_configuration, VC_CONF_FILE_PATH, write_x_configuration, \ - X_CONF_DIR, X_CONF_FILE_NAME -from pyanaconda.modules.localization.runtime import GetMissingKeyboardConfigurationTask, \ - ApplyKeyboardTask, AssignGenericKeyboardSettingTask, try_to_load_keymap +from pyanaconda.modules.localization.installation import ( + VC_CONF_FILE_PATH, + X_CONF_DIR, + X_CONF_FILE_NAME, + KeyboardInstallationTask, + LanguageInstallationTask, + write_vc_configuration, + write_x_configuration, +) +from pyanaconda.modules.localization.runtime import ( + ApplyKeyboardTask, + AssignGenericKeyboardSettingTask, + GetMissingKeyboardConfigurationTask, + try_to_load_keymap, +) from pyanaconda.modules.localization.utils import get_missing_keyboard_configuration diff --git a/tests/unit_tests/pyanaconda_tests/modules/network/test_module_network.py b/tests/unit_tests/pyanaconda_tests/modules/network/test_module_network.py index 2a8fcefb0e1..452dce1aa55 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/network/test_module_network.py +++ b/tests/unit_tests/pyanaconda_tests/modules/network/test_module_network.py @@ -17,41 +17,56 @@ # # Red Hat Author(s): Radek Vykydal # -import unittest -import tempfile import os import shutil -import pytest - +import tempfile +import unittest from textwrap import dedent -from unittest.mock import patch, Mock +from unittest.mock import Mock, patch +import gi +import pytest from dasbus.signal import Signal +from dasbus.typing import * # pylint: disable=wildcard-import -from tests.unit_tests.pyanaconda_tests import patch_dbus_publish_object, check_dbus_property, \ - check_kickstart_interface, check_task_creation, PropertiesChangedCallback - -from pyanaconda.core.constants import FIREWALL_DEFAULT, FIREWALL_ENABLED, \ - FIREWALL_DISABLED, FIREWALL_USE_SYSTEM_DEFAULTS, NETWORK_CAPABILITY_TEAM +from pyanaconda.core.constants import ( + FIREWALL_DEFAULT, + FIREWALL_DISABLED, + FIREWALL_ENABLED, + FIREWALL_USE_SYSTEM_DEFAULTS, + NETWORK_CAPABILITY_TEAM, +) from pyanaconda.core.kernel import KernelArguments -from pyanaconda.modules.common.constants.services import NETWORK from pyanaconda.modules.common.constants.objects import FIREWALL -from pyanaconda.modules.common.errors.installation import FirewallConfigurationError, \ - NetworkInstallationError -from pyanaconda.modules.network.network import NetworkService -from pyanaconda.modules.network.network_interface import NetworkInterface +from pyanaconda.modules.common.constants.services import NETWORK +from pyanaconda.modules.common.errors.installation import ( + FirewallConfigurationError, + NetworkInstallationError, +) from pyanaconda.modules.network.constants import FirewallMode -from pyanaconda.modules.network.installation import NetworkInstallationTask, \ - ConfigureActivationOnBootTask, HostnameConfigurationTask from pyanaconda.modules.network.firewall.firewall import FirewallModule from pyanaconda.modules.network.firewall.firewall_interface import FirewallInterface from pyanaconda.modules.network.firewall.installation import ConfigureFirewallTask +from pyanaconda.modules.network.initialization import ( + ApplyKickstartTask, + DumpMissingConfigFilesTask, +) +from pyanaconda.modules.network.installation import ( + ConfigureActivationOnBootTask, + HostnameConfigurationTask, + NetworkInstallationTask, +) from pyanaconda.modules.network.kickstart import DEFAULT_DEVICE_SPECIFICATION -from dasbus.typing import * # pylint: disable=wildcard-import -from pyanaconda.modules.network.initialization import ApplyKickstartTask, \ - DumpMissingConfigFilesTask +from pyanaconda.modules.network.network import NetworkService +from pyanaconda.modules.network.network_interface import NetworkInterface +from tests.unit_tests.pyanaconda_tests import ( + PropertiesChangedCallback, + check_dbus_property, + check_kickstart_interface, + check_task_creation, + patch_dbus_publish_object, +) -import gi gi.require_version("NM", "1.0") from gi.repository import NM @@ -115,6 +130,7 @@ def _check_dbus_property(self, *args, **kwargs): def test_set_locale(self, mocked_os, setlocale): """Test setting locale of the module.""" from locale import LC_ALL + import pyanaconda.core.util locale = "en_US.UTF-8" mocked_os.environ = {} diff --git a/tests/unit_tests/pyanaconda_tests/modules/network/test_module_network_config_file.py b/tests/unit_tests/pyanaconda_tests/modules/network/test_module_network_config_file.py index 488fc048101..b11bc7930c0 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/network/test_module_network_config_file.py +++ b/tests/unit_tests/pyanaconda_tests/modules/network/test_module_network_config_file.py @@ -21,11 +21,16 @@ import shutil import tempfile import unittest -from unittest.mock import patch from textwrap import dedent +from unittest.mock import patch -from pyanaconda.modules.network.config_file import IFCFG_DIR, KEYFILE_DIR, \ - get_config_files_content, is_config_file_for_system, get_config_files_paths +from pyanaconda.modules.network.config_file import ( + IFCFG_DIR, + KEYFILE_DIR, + get_config_files_content, + get_config_files_paths, + is_config_file_for_system, +) class ConfigFileTestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/modules/network/test_module_network_nm_client.py b/tests/unit_tests/pyanaconda_tests/modules/network/test_module_network_nm_client.py index 76762d36f8d..bb60ca8f4f1 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/network/test_module_network_nm_client.py +++ b/tests/unit_tests/pyanaconda_tests/modules/network/test_module_network_nm_client.py @@ -17,26 +17,38 @@ # # Red Hat Author(s): Radek Vykydal # -import unittest -import pytest -import time import threading -from unittest.mock import Mock, patch, call +import time +import unittest from textwrap import dedent +from unittest.mock import Mock, call, patch -from pyanaconda.modules.network.nm_client import get_ports_from_connections, \ - get_dracut_arguments_from_connection, get_config_file_connection_of_device, \ - get_kickstart_network_data, NM_BRIDGE_DUMPED_SETTINGS_DEFAULTS, \ - update_connection_wired_settings_from_ksdata, get_new_nm_client, GError, \ - update_connection_ip_settings_from_ksdata -from pyanaconda.core.kickstart.commands import NetworkData -from pyanaconda.core.glib import MainContext, sync_call_glib -from pyanaconda.modules.network.constants import NM_CONNECTION_TYPE_WIFI, \ - NM_CONNECTION_TYPE_ETHERNET, NM_CONNECTION_TYPE_VLAN, NM_CONNECTION_TYPE_BOND, \ - NM_CONNECTION_TYPE_TEAM, NM_CONNECTION_TYPE_BRIDGE, NM_CONNECTION_TYPE_INFINIBAND +import gi +import pytest +from pyanaconda.core.glib import MainContext, sync_call_glib +from pyanaconda.core.kickstart.commands import NetworkData +from pyanaconda.modules.network.constants import ( + NM_CONNECTION_TYPE_BOND, + NM_CONNECTION_TYPE_BRIDGE, + NM_CONNECTION_TYPE_ETHERNET, + NM_CONNECTION_TYPE_INFINIBAND, + NM_CONNECTION_TYPE_TEAM, + NM_CONNECTION_TYPE_VLAN, + NM_CONNECTION_TYPE_WIFI, +) +from pyanaconda.modules.network.nm_client import ( + NM_BRIDGE_DUMPED_SETTINGS_DEFAULTS, + GError, + get_config_file_connection_of_device, + get_dracut_arguments_from_connection, + get_kickstart_network_data, + get_new_nm_client, + get_ports_from_connections, + update_connection_ip_settings_from_ksdata, + update_connection_wired_settings_from_ksdata, +) -import gi gi.require_version("NM", "1.0") gi.require_version("Gio", "2.0") from gi.repository import NM, Gio diff --git a/tests/unit_tests/pyanaconda_tests/modules/network/test_network_utils.py b/tests/unit_tests/pyanaconda_tests/modules/network/test_network_utils.py index 3b6d653aab2..e3ce5360808 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/network/test_network_utils.py +++ b/tests/unit_tests/pyanaconda_tests/modules/network/test_network_utils.py @@ -17,7 +17,7 @@ # import unittest -from pyanaconda.modules.network.utils import is_nbft_device, is_ibft_configured_device +from pyanaconda.modules.network.utils import is_ibft_configured_device, is_nbft_device class NetworkUtilsTestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/module_payload_shared.py b/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/module_payload_shared.py index 4735d8dde1d..26fed43e5bd 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/module_payload_shared.py +++ b/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/module_payload_shared.py @@ -17,15 +17,14 @@ # # Red Hat Author(s): Jiri Konecny # -import pytest - -from unittest.mock import patch, Mock +from unittest.mock import Mock, patch -from tests.unit_tests.pyanaconda_tests import check_kickstart_interface +import pytest from pyanaconda.modules.common.containers import PayloadSourceContainer -from pyanaconda.modules.payloads.source.factory import SourceFactory from pyanaconda.modules.payloads.constants import SourceState +from pyanaconda.modules.payloads.source.factory import SourceFactory +from tests.unit_tests.pyanaconda_tests import check_kickstart_interface class PayloadKickstartSharedTest: diff --git a/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_dnf_initialization.py b/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_dnf_initialization.py index 9e87f3c65d2..21744571433 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_dnf_initialization.py +++ b/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_dnf_initialization.py @@ -23,18 +23,26 @@ import pytest from dasbus.structure import compare_data -from pyanaconda.core.constants import REPO_ORIGIN_SYSTEM, REPO_ORIGIN_USER, REPO_ORIGIN_TREEINFO -from pyanaconda.core.path import make_directories, join_paths +from pyanaconda.core.constants import ( + REPO_ORIGIN_SYSTEM, + REPO_ORIGIN_TREEINFO, + REPO_ORIGIN_USER, +) +from pyanaconda.core.path import join_paths, make_directories from pyanaconda.modules.common.errors.payload import SourceSetupError from pyanaconda.modules.common.structures.packages import PackagesConfigurationData from pyanaconda.modules.common.structures.payload import RepoConfigurationData from pyanaconda.modules.payloads.constants import SourceType from pyanaconda.modules.payloads.payload.dnf.dnf_manager import DNFManager -from pyanaconda.modules.payloads.payload.dnf.initialization import SetUpDNFSourcesResult, \ - SetUpDNFSourcesTask, TearDownDNFSourcesTask +from pyanaconda.modules.payloads.payload.dnf.initialization import ( + SetUpDNFSourcesResult, + SetUpDNFSourcesTask, + TearDownDNFSourcesTask, +) from pyanaconda.modules.payloads.source.factory import SourceFactory -from tests.unit_tests.pyanaconda_tests.modules.payloads.payload.test_dnf_tree_info import \ - TREE_INFO_RHEL +from tests.unit_tests.pyanaconda_tests.modules.payloads.payload.test_dnf_tree_info import ( + TREE_INFO_RHEL, +) class SetUpDNFSourcesTaskTestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_dnf_repositories.py b/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_dnf_repositories.py index d786e1da751..1d5c0c226d0 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_dnf_repositories.py +++ b/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_dnf_repositories.py @@ -18,20 +18,28 @@ import os import tempfile import unittest -from unittest.mock import patch, MagicMock, call +from unittest.mock import MagicMock, call, patch import pytest from dasbus.structure import compare_data from pyanaconda.core.constants import REPO_ORIGIN_SYSTEM -from pyanaconda.core.path import make_directories, join_paths, touch -from pyanaconda.modules.common.errors.payload import SourceSetupError, UnknownRepositoryError +from pyanaconda.core.path import join_paths, make_directories, touch +from pyanaconda.modules.common.errors.payload import ( + SourceSetupError, + UnknownRepositoryError, +) from pyanaconda.modules.common.structures.payload import RepoConfigurationData from pyanaconda.modules.payloads.constants import SourceType from pyanaconda.modules.payloads.payload.dnf.dnf_manager import DNFManager -from pyanaconda.modules.payloads.payload.dnf.repositories import generate_driver_disk_repositories, \ - generate_source_from_repository, enable_updates_repositories, create_repository, \ - disable_default_repositories, enable_existing_repository +from pyanaconda.modules.payloads.payload.dnf.repositories import ( + create_repository, + disable_default_repositories, + enable_existing_repository, + enable_updates_repositories, + generate_driver_disk_repositories, + generate_source_from_repository, +) class DNFDriverDiskRepositoriesTestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_dnf_tree_info.py b/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_dnf_tree_info.py index b0c7aacbe0f..ebbed3a342d 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_dnf_tree_info.py +++ b/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_dnf_tree_info.py @@ -17,19 +17,29 @@ # import os.path import tempfile -import pytest import unittest +from unittest.mock import Mock, patch -from unittest.mock import patch, Mock +import pytest from dasbus.structure import compare_data -from pyanaconda.core.constants import URL_TYPE_METALINK, NETWORK_CONNECTION_TIMEOUT, \ - REPO_ORIGIN_TREEINFO +from pyanaconda.core.constants import ( + NETWORK_CONNECTION_TIMEOUT, + REPO_ORIGIN_TREEINFO, + URL_TYPE_METALINK, +) from pyanaconda.modules.common.structures.payload import RepoConfigurationData -from pyanaconda.modules.payloads.payload.dnf.repositories import update_treeinfo_repositories -from pyanaconda.modules.payloads.payload.dnf.tree_info import TreeInfoMetadata, NoTreeInfoError, \ - InvalidTreeInfoError, LoadTreeInfoMetadataTask, LoadTreeInfoMetadataResult, \ - generate_treeinfo_repository +from pyanaconda.modules.payloads.payload.dnf.repositories import ( + update_treeinfo_repositories, +) +from pyanaconda.modules.payloads.payload.dnf.tree_info import ( + InvalidTreeInfoError, + LoadTreeInfoMetadataResult, + LoadTreeInfoMetadataTask, + NoTreeInfoError, + TreeInfoMetadata, + generate_treeinfo_repository, +) TREE_INFO_FEDORA = """ [header] diff --git a/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_dnf_validation.py b/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_dnf_validation.py index 59f28ebf4b7..19d7c6b9033 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_dnf_validation.py +++ b/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_dnf_validation.py @@ -16,14 +16,18 @@ # Red Hat, Inc. # import unittest - from unittest.mock import Mock, patch from pyanaconda.modules.common.structures.packages import PackagesSelectionData -from pyanaconda.modules.payloads.payload.dnf.dnf_manager import InvalidSelectionError, \ - MissingSpecsError, DNFManager -from pyanaconda.modules.payloads.payload.dnf.validation import CheckPackagesSelectionTask, \ - VerifyRepomdHashesTask +from pyanaconda.modules.payloads.payload.dnf.dnf_manager import ( + DNFManager, + InvalidSelectionError, + MissingSpecsError, +) +from pyanaconda.modules.payloads.payload.dnf.validation import ( + CheckPackagesSelectionTask, + VerifyRepomdHashesTask, +) class CheckPackagesSelectionTaskTestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_flatpak_manager.py b/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_flatpak_manager.py index 4522574b54f..ab6beaf46a7 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_flatpak_manager.py +++ b/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_flatpak_manager.py @@ -15,14 +15,16 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -import unittest import os -import gi - +import unittest from tempfile import TemporaryDirectory -from unittest.mock import patch, Mock, call +from unittest.mock import Mock, call, patch + +import gi -from pyanaconda.modules.payloads.payload.rpm_ostree.flatpak_manager import FlatpakManager +from pyanaconda.modules.payloads.payload.rpm_ostree.flatpak_manager import ( + FlatpakManager, +) gi.require_version("Flatpak", "1.0") from gi.repository.Flatpak import TransactionOperationType diff --git a/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_image_installation.py b/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_image_installation.py index 19fb039cf8a..3d6b92540f1 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_image_installation.py +++ b/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_image_installation.py @@ -17,17 +17,17 @@ # import os import tempfile -import unittest import time - +import unittest from unittest.mock import Mock, call, patch from pyanaconda.core.path import join_paths from pyanaconda.modules.common.constants.objects import DEVICE_TREE from pyanaconda.modules.common.constants.services import STORAGE -from pyanaconda.modules.payloads.payload.live_image.installation_progress import \ - InstallationProgress from pyanaconda.modules.common.structures.storage import DeviceData +from pyanaconda.modules.payloads.payload.live_image.installation_progress import ( + InstallationProgress, +) from tests.unit_tests.pyanaconda_tests import patch_dbus_get_proxy_with_cache diff --git a/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_module_payload_dnf.py b/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_module_payload_dnf.py index 45ba9d850a7..6002f53a8d7 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_module_payload_dnf.py +++ b/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_module_payload_dnf.py @@ -17,62 +17,103 @@ # # Red Hat Author(s): Jiri Konecny # -import pytest import unittest -from unittest.mock import patch, PropertyMock, Mock +from unittest.mock import Mock, PropertyMock, patch +import pytest from blivet.size import Size from dasbus.structure import compare_data from dasbus.typing import * # pylint: disable=wildcard-import - -from pyanaconda.modules.common.errors.general import UnavailableValueError -from pyanaconda.modules.payloads.payload.dnf.tear_down import ResetDNFManagerTask - -from pyanaconda.modules.payloads.payload.dnf.installation import SetRPMMacrosTask, \ - ResolvePackagesTask, PrepareDownloadLocationTask, DownloadPackagesTask, InstallPackagesTask, \ - CleanUpDownloadLocationTask, WriteRepositoriesTask, ImportRPMKeysTask, \ - UpdateDNFConfigurationTask - -from pyanaconda.modules.payloads.source.factory import SourceFactory from pykickstart.version import isRHEL as is_rhel -from pyanaconda.core.constants import SOURCE_TYPE_CDROM, SOURCE_TYPE_HDD, SOURCE_TYPE_HMC, \ - SOURCE_TYPE_NFS, SOURCE_TYPE_REPO_FILES, SOURCE_TYPE_URL, URL_TYPE_BASEURL, \ - SOURCE_TYPE_CLOSEST_MIRROR, SOURCE_TYPE_CDN, GROUP_PACKAGE_TYPES_REQUIRED, \ - GROUP_PACKAGE_TYPES_ALL, MULTILIB_POLICY_ALL, PAYLOAD_TYPE_DNF, REPO_ORIGIN_SYSTEM, \ - REPO_ORIGIN_USER, URL_TYPE_MIRRORLIST, URL_TYPE_METALINK, SOURCE_TYPE_REPO_PATH +from pyanaconda.core.constants import ( + GROUP_PACKAGE_TYPES_ALL, + GROUP_PACKAGE_TYPES_REQUIRED, + MULTILIB_POLICY_ALL, + PAYLOAD_TYPE_DNF, + REPO_ORIGIN_SYSTEM, + REPO_ORIGIN_USER, + SOURCE_TYPE_CDN, + SOURCE_TYPE_CDROM, + SOURCE_TYPE_CLOSEST_MIRROR, + SOURCE_TYPE_HDD, + SOURCE_TYPE_HMC, + SOURCE_TYPE_NFS, + SOURCE_TYPE_REPO_FILES, + SOURCE_TYPE_REPO_PATH, + SOURCE_TYPE_URL, + URL_TYPE_BASEURL, + URL_TYPE_METALINK, + URL_TYPE_MIRRORLIST, +) from pyanaconda.core.kickstart.specification import KickstartSpecificationHandler from pyanaconda.core.kickstart.version import VERSION from pyanaconda.modules.common.constants.interfaces import PAYLOAD_DNF from pyanaconda.modules.common.constants.objects import DISK_SELECTION from pyanaconda.modules.common.constants.services import STORAGE -from pyanaconda.modules.common.errors.payload import UnknownCompsGroupError, \ - UnknownCompsEnvironmentError, SourceSetupError, IncompatibleSourceError -from pyanaconda.modules.common.structures.comps import CompsEnvironmentData, CompsGroupData +from pyanaconda.modules.common.errors.general import UnavailableValueError +from pyanaconda.modules.common.errors.payload import ( + IncompatibleSourceError, + SourceSetupError, + UnknownCompsEnvironmentError, + UnknownCompsGroupError, +) +from pyanaconda.modules.common.structures.comps import ( + CompsEnvironmentData, + CompsGroupData, +) +from pyanaconda.modules.common.structures.packages import ( + PackagesConfigurationData, + PackagesSelectionData, +) from pyanaconda.modules.common.structures.payload import RepoConfigurationData -from pyanaconda.modules.common.structures.packages import PackagesConfigurationData, \ - PackagesSelectionData from pyanaconda.modules.common.task.task_interface import ValidationTaskInterface -from pyanaconda.modules.payloads.constants import SourceType, SourceState +from pyanaconda.modules.payloads.constants import SourceState, SourceType from pyanaconda.modules.payloads.kickstart import PayloadKickstartSpecification from pyanaconda.modules.payloads.payload.dnf.dnf import DNFModule from pyanaconda.modules.payloads.payload.dnf.dnf_interface import DNFInterface from pyanaconda.modules.payloads.payload.dnf.dnf_manager import DNFManager -from pyanaconda.modules.payloads.payload.dnf.initialization import SetUpDNFSourcesTask, \ - TearDownDNFSourcesTask, SetUpDNFSourcesResult -from pyanaconda.modules.payloads.payload.dnf.validation import CheckPackagesSelectionTask, \ - VerifyRepomdHashesTask +from pyanaconda.modules.payloads.payload.dnf.initialization import ( + SetUpDNFSourcesResult, + SetUpDNFSourcesTask, + TearDownDNFSourcesTask, +) +from pyanaconda.modules.payloads.payload.dnf.installation import ( + CleanUpDownloadLocationTask, + DownloadPackagesTask, + ImportRPMKeysTask, + InstallPackagesTask, + PrepareDownloadLocationTask, + ResolvePackagesTask, + SetRPMMacrosTask, + UpdateDNFConfigurationTask, + WriteRepositoriesTask, +) +from pyanaconda.modules.payloads.payload.dnf.tear_down import ResetDNFManagerTask +from pyanaconda.modules.payloads.payload.dnf.validation import ( + CheckPackagesSelectionTask, + VerifyRepomdHashesTask, +) from pyanaconda.modules.payloads.payloads import PayloadsService from pyanaconda.modules.payloads.payloads_interface import PayloadsInterface from pyanaconda.modules.payloads.source.cdrom.cdrom import CdromSourceModule +from pyanaconda.modules.payloads.source.closest_mirror.closest_mirror import ( + ClosestMirrorSourceModule, +) +from pyanaconda.modules.payloads.source.factory import SourceFactory from pyanaconda.modules.payloads.source.harddrive.harddrive import HardDriveSourceModule -from pyanaconda.modules.payloads.source.closest_mirror.closest_mirror import \ - ClosestMirrorSourceModule - -from tests.unit_tests.pyanaconda_tests import patch_dbus_publish_object, check_dbus_property, \ - check_task_creation, patch_dbus_get_proxy_with_cache, patch_dbus_get_proxy, check_instances -from tests.unit_tests.pyanaconda_tests.modules.payloads.payload.module_payload_shared import \ - PayloadSharedTest, PayloadKickstartSharedTest +from tests.unit_tests.pyanaconda_tests import ( + check_dbus_property, + check_instances, + check_task_creation, + patch_dbus_get_proxy, + patch_dbus_get_proxy_with_cache, + patch_dbus_publish_object, +) +from tests.unit_tests.pyanaconda_tests.modules.payloads.payload.module_payload_shared import ( + PayloadKickstartSharedTest, + PayloadSharedTest, +) class DNFKickstartTestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_module_payload_dnf_installation.py b/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_module_payload_dnf_installation.py index 8c3a3b9e999..f5931f2c23f 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_module_payload_dnf_installation.py +++ b/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_module_payload_dnf_installation.py @@ -18,24 +18,38 @@ import os import tempfile import unittest -import pytest +from unittest.mock import Mock, call, patch -from unittest.mock import patch, call, Mock +import pytest -from pyanaconda.core.constants import RPM_LANGUAGES_NONE, MULTILIB_POLICY_ALL +from pyanaconda.core.constants import MULTILIB_POLICY_ALL, RPM_LANGUAGES_NONE from pyanaconda.core.path import join_paths -from pyanaconda.modules.common.errors.installation import NonCriticalInstallationError, \ - PayloadInstallationError -from pyanaconda.modules.common.structures.packages import PackagesConfigurationData, \ - PackagesSelectionData +from pyanaconda.modules.common.errors.installation import ( + NonCriticalInstallationError, + PayloadInstallationError, +) +from pyanaconda.modules.common.structures.packages import ( + PackagesConfigurationData, + PackagesSelectionData, +) from pyanaconda.modules.common.structures.payload import RepoConfigurationData from pyanaconda.modules.common.structures.requirement import Requirement -from pyanaconda.modules.payloads.payload.dnf.dnf_manager import DNFManager, MissingSpecsError, \ - InvalidSelectionError -from pyanaconda.modules.payloads.payload.dnf.installation import ImportRPMKeysTask, \ - SetRPMMacrosTask, DownloadPackagesTask, InstallPackagesTask, PrepareDownloadLocationTask, \ - CleanUpDownloadLocationTask, ResolvePackagesTask, UpdateDNFConfigurationTask, \ - WriteRepositoriesTask +from pyanaconda.modules.payloads.payload.dnf.dnf_manager import ( + DNFManager, + InvalidSelectionError, + MissingSpecsError, +) +from pyanaconda.modules.payloads.payload.dnf.installation import ( + CleanUpDownloadLocationTask, + DownloadPackagesTask, + ImportRPMKeysTask, + InstallPackagesTask, + PrepareDownloadLocationTask, + ResolvePackagesTask, + SetRPMMacrosTask, + UpdateDNFConfigurationTask, + WriteRepositoriesTask, +) class SetRPMMacrosTaskTestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_module_payload_dnf_manager.py b/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_module_payload_dnf_manager.py index 1af0d4a1d34..1aac9a3a266 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_module_payload_dnf_manager.py +++ b/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_module_payload_dnf_manager.py @@ -17,34 +17,46 @@ # import os.path import unittest +from tempfile import TemporaryDirectory from textwrap import dedent +from unittest.mock import Mock, call, patch +import libdnf.transaction import pytest - -from tempfile import TemporaryDirectory -from unittest.mock import patch, Mock, call - -from blivet.size import Size, ROUND_UP +from blivet.size import ROUND_UP, Size from dasbus.structure import compare_data - -from dnf.callback import STATUS_OK, STATUS_FAILED, PKG_SCRIPTLET -from dnf.comps import Environment, Comps, Group -from dnf.exceptions import MarkingErrors, DepsolveError, RepoError +from dnf.callback import PKG_SCRIPTLET, STATUS_FAILED, STATUS_OK +from dnf.comps import Comps, Environment, Group +from dnf.exceptions import DepsolveError, MarkingErrors, RepoError from dnf.package import Package -from dnf.transaction import PKG_INSTALL, TRANS_POST from dnf.repo import Repo -import libdnf.transaction +from dnf.transaction import PKG_INSTALL, TRANS_POST -from pyanaconda.core.constants import MULTILIB_POLICY_ALL, URL_TYPE_BASEURL, URL_TYPE_MIRRORLIST, \ - URL_TYPE_METALINK +from pyanaconda.core.constants import ( + MULTILIB_POLICY_ALL, + URL_TYPE_BASEURL, + URL_TYPE_METALINK, + URL_TYPE_MIRRORLIST, +) from pyanaconda.modules.common.errors.installation import PayloadInstallationError -from pyanaconda.modules.common.errors.payload import UnknownCompsEnvironmentError, \ - UnknownCompsGroupError, UnknownRepositoryError -from pyanaconda.modules.common.structures.comps import CompsEnvironmentData, CompsGroupData +from pyanaconda.modules.common.errors.payload import ( + UnknownCompsEnvironmentError, + UnknownCompsGroupError, + UnknownRepositoryError, +) +from pyanaconda.modules.common.structures.comps import ( + CompsEnvironmentData, + CompsGroupData, +) from pyanaconda.modules.common.structures.packages import PackagesConfigurationData from pyanaconda.modules.common.structures.payload import RepoConfigurationData -from pyanaconda.modules.payloads.payload.dnf.dnf_manager import DNFManager, \ - InvalidSelectionError, BrokenSpecsError, MissingSpecsError, MetadataError +from pyanaconda.modules.payloads.payload.dnf.dnf_manager import ( + BrokenSpecsError, + DNFManager, + InvalidSelectionError, + MetadataError, + MissingSpecsError, +) class DNFManagerTestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_module_payload_dnf_requirements.py b/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_module_payload_dnf_requirements.py index 034b55d8627..74c88747c38 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_module_payload_dnf_requirements.py +++ b/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_module_payload_dnf_requirements.py @@ -19,16 +19,25 @@ import unittest from unittest.mock import Mock, patch -from pyanaconda.core.constants import REQUIREMENT_TYPE_PACKAGE, REQUIREMENT_TYPE_GROUP, \ - MULTILIB_POLICY_ALL, MULTILIB_POLICY_BEST -from pyanaconda.modules.common.constants.services import LOCALIZATION, BOSS +from pyanaconda.core.constants import ( + MULTILIB_POLICY_ALL, + MULTILIB_POLICY_BEST, + REQUIREMENT_TYPE_GROUP, + REQUIREMENT_TYPE_PACKAGE, +) +from pyanaconda.modules.common.constants.services import BOSS, LOCALIZATION +from pyanaconda.modules.common.structures.packages import PackagesConfigurationData from pyanaconda.modules.common.structures.requirement import Requirement from pyanaconda.modules.payloads.payload.dnf.dnf_manager import DNFManager -from pyanaconda.modules.payloads.payload.dnf.requirements import collect_language_requirements, \ - collect_platform_requirements, collect_driver_disk_requirements, collect_remote_requirements, \ - apply_requirements, collect_dnf_requirements +from pyanaconda.modules.payloads.payload.dnf.requirements import ( + apply_requirements, + collect_dnf_requirements, + collect_driver_disk_requirements, + collect_language_requirements, + collect_platform_requirements, + collect_remote_requirements, +) from tests.unit_tests.pyanaconda_tests import patch_dbus_get_proxy_with_cache -from pyanaconda.modules.common.structures.packages import PackagesConfigurationData class DNFRequirementsTestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_module_payload_dnf_utils.py b/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_module_payload_dnf_utils.py index 0436b7a21dd..c9d39d6fd75 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_module_payload_dnf_utils.py +++ b/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_module_payload_dnf_utils.py @@ -16,27 +16,35 @@ # Red Hat, Inc. # import unittest -import pytest - from textwrap import dedent -from unittest.mock import patch, Mock +from unittest.mock import Mock, patch +import pytest from blivet.size import Size -from pyanaconda.core.constants import GROUP_PACKAGE_TYPES_REQUIRED, GROUP_PACKAGE_TYPES_ALL +from pyanaconda.core.constants import ( + GROUP_PACKAGE_TYPES_ALL, + GROUP_PACKAGE_TYPES_REQUIRED, +) from pyanaconda.modules.common.constants.objects import DEVICE_TREE from pyanaconda.modules.common.constants.services import STORAGE from pyanaconda.modules.common.structures.packages import PackagesSelectionData from pyanaconda.modules.common.structures.payload import RepoConfigurationData from pyanaconda.modules.payloads.payload.dnf.dnf_manager import DNFManager -from pyanaconda.modules.payloads.payload.dnf.utils import get_kernel_package, \ - get_product_release_version, get_installation_specs, get_kernel_version_list, \ - pick_download_location, calculate_required_space, get_free_space_map, _pick_mount_points, \ - collect_installation_devices +from pyanaconda.modules.payloads.payload.dnf.utils import ( + _pick_mount_points, + calculate_required_space, + collect_installation_devices, + get_free_space_map, + get_installation_specs, + get_kernel_package, + get_kernel_version_list, + get_product_release_version, + pick_download_location, +) from pyanaconda.modules.payloads.source.cdrom.cdrom import CdromSourceModule from pyanaconda.modules.payloads.source.harddrive.harddrive import HardDriveSourceModule from pyanaconda.modules.payloads.source.url.url import URLSourceModule - from tests.unit_tests.pyanaconda_tests import patch_dbus_get_proxy_with_cache diff --git a/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_module_payload_factory.py b/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_module_payload_factory.py index a3e108442ef..24e6fe6a5eb 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_module_payload_factory.py +++ b/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_module_payload_factory.py @@ -15,17 +15,21 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -import pytest - from unittest.case import TestCase -from pyanaconda.core.kickstart.specification import KickstartSpecificationHandler, \ - KickstartSpecificationParser +import pytest + +from pyanaconda.core.kickstart.specification import ( + KickstartSpecificationHandler, + KickstartSpecificationParser, +) from pyanaconda.modules.payloads.constants import PayloadType from pyanaconda.modules.payloads.kickstart import PayloadKickstartSpecification from pyanaconda.modules.payloads.payload.factory import PayloadFactory from pyanaconda.modules.payloads.payload.payload_base import PayloadBase -from pyanaconda.modules.payloads.payload.payload_base_interface import PayloadBaseInterface +from pyanaconda.modules.payloads.payload.payload_base_interface import ( + PayloadBaseInterface, +) class PayloadFactoryTestCase(TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_module_payload_live.py b/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_module_payload_live.py index b72b910e488..50fc096c932 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_module_payload_live.py +++ b/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_module_payload_live.py @@ -20,20 +20,28 @@ import os import tempfile import unittest +from contextlib import contextmanager +from unittest.mock import MagicMock, Mock, call, patch + import pytest import requests - -from contextlib import contextmanager from requests_file import FileAdapter -from unittest.mock import call, patch, Mock, MagicMock from pyanaconda.core.configuration.anaconda import conf from pyanaconda.core.path import join_paths, touch from pyanaconda.modules.common.errors.installation import PayloadInstallationError from pyanaconda.modules.common.structures.live_image import LiveImageConfigurationData -from pyanaconda.modules.payloads.payload.live_image.download_progress import DownloadProgress -from pyanaconda.modules.payloads.payload.live_image.installation import VerifyImageChecksumTask, \ - InstallFromImageTask, InstallFromTarTask, DownloadImageTask, MountImageTask, RemoveImageTask +from pyanaconda.modules.payloads.payload.live_image.download_progress import ( + DownloadProgress, +) +from pyanaconda.modules.payloads.payload.live_image.installation import ( + DownloadImageTask, + InstallFromImageTask, + InstallFromTarTask, + MountImageTask, + RemoveImageTask, + VerifyImageChecksumTask, +) from pyanaconda.modules.payloads.payload.live_os.utils import get_kernel_version_list diff --git a/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_module_payload_live_image.py b/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_module_payload_live_image.py index 874a0cb4d38..3ce6c4ea5b6 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_module_payload_live_image.py +++ b/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_module_payload_live_image.py @@ -18,22 +18,26 @@ # Red Hat Author(s): Jiri Konecny # import unittest + import pytest from pyanaconda.core.constants import PAYLOAD_TYPE_LIVE_IMAGE, SOURCE_TYPE_LIVE_IMAGE from pyanaconda.modules.common.errors.payload import IncompatibleSourceError -from pyanaconda.modules.payloads.payloads import PayloadsService from pyanaconda.modules.payloads.constants import SourceType -from pyanaconda.modules.payloads.payloads_interface import PayloadsInterface from pyanaconda.modules.payloads.payload.live_image.live_image import LiveImageModule -from pyanaconda.modules.payloads.payload.live_image.live_image_interface import \ - LiveImageInterface +from pyanaconda.modules.payloads.payload.live_image.live_image_interface import ( + LiveImageInterface, +) +from pyanaconda.modules.payloads.payloads import PayloadsService +from pyanaconda.modules.payloads.payloads_interface import PayloadsInterface from pyanaconda.modules.payloads.source.factory import SourceFactory -from pyanaconda.modules.payloads.source.live_image.installation import InstallLiveImageTask +from pyanaconda.modules.payloads.source.live_image.installation import ( + InstallLiveImageTask, +) from pyanaconda.modules.payloads.source.live_tar.installation import InstallLiveTarTask - -from tests.unit_tests.pyanaconda_tests.modules.payloads.payload.module_payload_shared import \ - PayloadKickstartSharedTest +from tests.unit_tests.pyanaconda_tests.modules.payloads.payload.module_payload_shared import ( + PayloadKickstartSharedTest, +) class LiveImageKSTestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_module_payload_live_os.py b/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_module_payload_live_os.py index 5fceb94e3d6..edf83dc1afe 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_module_payload_live_os.py +++ b/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_module_payload_live_os.py @@ -21,19 +21,24 @@ import tempfile import unittest -from pyanaconda.core.constants import SOURCE_TYPE_LIVE_OS_IMAGE, PAYLOAD_TYPE_LIVE_OS +from pyanaconda.core.constants import PAYLOAD_TYPE_LIVE_OS, SOURCE_TYPE_LIVE_OS_IMAGE from pyanaconda.core.path import join_paths, make_directories, touch from pyanaconda.modules.common.errors.payload import IncompatibleSourceError -from pyanaconda.modules.payloads.constants import SourceType, SourceState +from pyanaconda.modules.payloads.constants import SourceState, SourceType +from pyanaconda.modules.payloads.payload.live_image.installation import ( + InstallFromImageTask, +) +from pyanaconda.modules.payloads.payload.live_os.installation import ( + CopyTransientGnomeInitialSetupStateTask, +) from pyanaconda.modules.payloads.payload.live_os.live_os import LiveOSModule -from pyanaconda.modules.payloads.payload.live_os.live_os_interface import LiveOSInterface -from pyanaconda.modules.payloads.payload.live_image.installation import InstallFromImageTask -from pyanaconda.modules.payloads.payload.live_os.installation import \ - CopyTransientGnomeInitialSetupStateTask - +from pyanaconda.modules.payloads.payload.live_os.live_os_interface import ( + LiveOSInterface, +) from tests.unit_tests.pyanaconda_tests import patch_dbus_publish_object -from tests.unit_tests.pyanaconda_tests.modules.payloads.payload.module_payload_shared import \ - PayloadSharedTest +from tests.unit_tests.pyanaconda_tests.modules.payloads.payload.module_payload_shared import ( + PayloadSharedTest, +) class LiveOSInterfaceTestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_rpm_ostree.py b/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_rpm_ostree.py index 7987aef55c6..c09e63a44db 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_rpm_ostree.py +++ b/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_rpm_ostree.py @@ -17,24 +17,39 @@ # import unittest -from pyanaconda.core.constants import SOURCE_TYPE_RPM_OSTREE, SOURCE_TYPE_RPM_OSTREE_CONTAINER, \ - SOURCE_TYPE_FLATPAK, PAYLOAD_TYPE_RPM_OSTREE +from pyanaconda.core.constants import ( + PAYLOAD_TYPE_RPM_OSTREE, + SOURCE_TYPE_FLATPAK, + SOURCE_TYPE_RPM_OSTREE, + SOURCE_TYPE_RPM_OSTREE_CONTAINER, +) from pyanaconda.modules.payloads.base.initialization import TearDownSourcesTask from pyanaconda.modules.payloads.constants import SourceType -from pyanaconda.modules.payloads.payload.rpm_ostree.flatpak_installation import InstallFlatpaksTask -from pyanaconda.modules.payloads.payload.rpm_ostree.installation import InitOSTreeFsAndRepoTask, \ - ChangeOSTreeRemoteTask, PullRemoteAndDeleteTask, DeployOSTreeTask, SetSystemRootTask, \ - PrepareOSTreeMountTargetsTask, CopyBootloaderDataTask, TearDownOSTreeMountTargetsTask, \ - ConfigureBootloader +from pyanaconda.modules.payloads.payload.rpm_ostree.flatpak_installation import ( + InstallFlatpaksTask, +) +from pyanaconda.modules.payloads.payload.rpm_ostree.installation import ( + ChangeOSTreeRemoteTask, + ConfigureBootloader, + CopyBootloaderDataTask, + DeployOSTreeTask, + InitOSTreeFsAndRepoTask, + PrepareOSTreeMountTargetsTask, + PullRemoteAndDeleteTask, + SetSystemRootTask, + TearDownOSTreeMountTargetsTask, +) from pyanaconda.modules.payloads.payload.rpm_ostree.rpm_ostree import RPMOSTreeModule -from pyanaconda.modules.payloads.payload.rpm_ostree.rpm_ostree_interface import RPMOSTreeInterface +from pyanaconda.modules.payloads.payload.rpm_ostree.rpm_ostree_interface import ( + RPMOSTreeInterface, +) from pyanaconda.modules.payloads.payloads import PayloadsService from pyanaconda.modules.payloads.payloads_interface import PayloadsInterface from pyanaconda.modules.payloads.source.factory import SourceFactory from tests.unit_tests.pyanaconda_tests import check_instances - -from tests.unit_tests.pyanaconda_tests.modules.payloads.payload.module_payload_shared import \ - PayloadKickstartSharedTest +from tests.unit_tests.pyanaconda_tests.modules.payloads.payload.module_payload_shared import ( + PayloadKickstartSharedTest, +) class RPMOSTreeInterfaceTestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_rpm_ostree_flatpak.py b/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_rpm_ostree_flatpak.py index d9fed49ca31..2767e64eb9c 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_rpm_ostree_flatpak.py +++ b/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_rpm_ostree_flatpak.py @@ -16,14 +16,15 @@ # Red Hat, Inc. # import unittest -import pytest - -from unittest.mock import patch from tempfile import TemporaryDirectory +from unittest.mock import patch + +import pytest from pyanaconda.modules.common.errors.installation import PayloadInstallationError -from pyanaconda.modules.payloads.payload.rpm_ostree.flatpak_installation import \ - InstallFlatpaksTask +from pyanaconda.modules.payloads.payload.rpm_ostree.flatpak_installation import ( + InstallFlatpaksTask, +) class InstallFlatpakTaskTest(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_rpm_ostree_tasks.py b/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_rpm_ostree_tasks.py index bf282ad0924..81727583a5d 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_rpm_ostree_tasks.py +++ b/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_rpm_ostree_tasks.py @@ -15,22 +15,32 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -import tempfile import os -import pytest - +import tempfile import unittest -from unittest.mock import patch, call, MagicMock +from unittest.mock import MagicMock, call, patch +import pytest from gi.repository import OSTree -from pyanaconda.core.glib import Variant, GError + +from pyanaconda.core.glib import GError, Variant from pyanaconda.modules.common.errors.installation import PayloadInstallationError -from pyanaconda.modules.common.structures.rpm_ostree import \ - RPMOSTreeConfigurationData, RPMOSTreeContainerConfigurationData -from pyanaconda.modules.payloads.payload.rpm_ostree.installation import \ - PrepareOSTreeMountTargetsTask, CopyBootloaderDataTask, InitOSTreeFsAndRepoTask, \ - ChangeOSTreeRemoteTask, ConfigureBootloader, DeployOSTreeTask, PullRemoteAndDeleteTask, \ - SetSystemRootTask, TearDownOSTreeMountTargetsTask +from pyanaconda.modules.common.structures.rpm_ostree import ( + RPMOSTreeConfigurationData, + RPMOSTreeContainerConfigurationData, +) +from pyanaconda.modules.payloads.payload.rpm_ostree.installation import ( + ChangeOSTreeRemoteTask, + ConfigureBootloader, + CopyBootloaderDataTask, + DeployOSTreeTask, + InitOSTreeFsAndRepoTask, + PrepareOSTreeMountTargetsTask, + PullRemoteAndDeleteTask, + SetSystemRootTask, + TearDownOSTreeMountTargetsTask, +) + def _make_config_data(): """Create OSTree configuration data for testing diff --git a/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_rpm_ostree_util.py b/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_rpm_ostree_util.py index df77041d92a..5c0daba9744 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_rpm_ostree_util.py +++ b/tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_rpm_ostree_util.py @@ -17,10 +17,11 @@ # import tempfile import unittest -from pyanaconda.core.path import join_paths, touch, make_directories +from pyanaconda.core.path import join_paths, make_directories, touch from pyanaconda.modules.payloads.payload.rpm_ostree.util import have_bootupd + class RPMOSTreeUtilTestCase(unittest.TestCase): """Test the RPM OSTree utils.""" diff --git a/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_base.py b/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_base.py index 345eefaa33a..8d0d4ae43e2 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_base.py +++ b/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_base.py @@ -16,18 +16,26 @@ # Red Hat, Inc. # import unittest -import pytest - from pathlib import Path from tempfile import TemporaryDirectory from unittest.mock import patch -from pyanaconda.modules.common.errors.payload import SourceSetupError, SourceTearDownError +import pytest + +from pyanaconda.modules.common.errors.payload import ( + SourceSetupError, + SourceTearDownError, +) from pyanaconda.modules.payloads.constants import SourceType -from pyanaconda.modules.payloads.source.mount_tasks import SetUpMountTask, TearDownMountTask +from pyanaconda.modules.payloads.source.mount_tasks import ( + SetUpMountTask, + TearDownMountTask, +) from pyanaconda.modules.payloads.source.source_base import MountingSourceMixin -from pyanaconda.modules.payloads.source.utils import find_and_mount_iso_image, \ - verify_valid_repository +from pyanaconda.modules.payloads.source.utils import ( + find_and_mount_iso_image, + verify_valid_repository, +) mount_location = "/some/dir" diff --git a/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_cdn.py b/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_cdn.py index 1a88d76164c..b0bc5170f22 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_cdn.py +++ b/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_cdn.py @@ -16,9 +16,10 @@ # Red Hat, Inc. # # -import pytest import unittest +import pytest + from pyanaconda.core.constants import SOURCE_TYPE_CDN from pyanaconda.modules.common.constants.services import BOSS, SUBSCRIPTION from pyanaconda.modules.common.errors.payload import SourceSetupError diff --git a/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_cdrom.py b/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_cdrom.py index 4e800be9f7c..f0e4348e7fe 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_cdrom.py +++ b/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_cdrom.py @@ -16,20 +16,24 @@ # Red Hat, Inc. # import unittest -import pytest +from unittest.mock import DEFAULT, Mock, call, patch -from unittest.mock import call, DEFAULT, Mock, patch +import pytest from pyanaconda.core.constants import SOURCE_TYPE_CDROM from pyanaconda.modules.common.errors.payload import SourceSetupError from pyanaconda.modules.common.structures.storage import DeviceData -from pyanaconda.modules.payloads.constants import SourceType, SourceState +from pyanaconda.modules.payloads.constants import SourceState, SourceType from pyanaconda.modules.payloads.source.cdrom.cdrom import CdromSourceModule -from pyanaconda.modules.payloads.source.cdrom.cdrom_interface import CdromSourceInterface +from pyanaconda.modules.payloads.source.cdrom.cdrom_interface import ( + CdromSourceInterface, +) from pyanaconda.modules.payloads.source.cdrom.initialization import SetUpCdromSourceTask from pyanaconda.modules.payloads.source.mount_tasks import TearDownMountTask - -from tests.unit_tests.pyanaconda_tests import patch_dbus_get_proxy, PropertiesChangedCallback +from tests.unit_tests.pyanaconda_tests import ( + PropertiesChangedCallback, + patch_dbus_get_proxy, +) class CdromSourceInterfaceTestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_closest_mirror.py b/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_closest_mirror.py index dcb4bc099a8..32de4cff358 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_closest_mirror.py +++ b/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_closest_mirror.py @@ -18,15 +18,16 @@ # import unittest +from pyanaconda.core.constants import SOURCE_TYPE_CLOSEST_MIRROR from pyanaconda.modules.common.constants.interfaces import PAYLOAD_SOURCE_CLOSEST_MIRROR +from pyanaconda.modules.payloads.source.closest_mirror.closest_mirror import ( + ClosestMirrorSourceModule, +) +from pyanaconda.modules.payloads.source.closest_mirror.closest_mirror_interface import ( + ClosestMirrorSourceInterface, +) from tests.unit_tests.pyanaconda_tests import check_dbus_property -from pyanaconda.core.constants import SOURCE_TYPE_CLOSEST_MIRROR -from pyanaconda.modules.payloads.source.closest_mirror.closest_mirror import \ - ClosestMirrorSourceModule -from pyanaconda.modules.payloads.source.closest_mirror.closest_mirror_interface import \ - ClosestMirrorSourceInterface - class ClosestMirrorSourceInterfaceTestCase(unittest.TestCase): """Test the DBus interface of the closest mirror source module.""" diff --git a/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_factory.py b/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_factory.py index 458ed790604..81781ed2d0c 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_factory.py +++ b/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_factory.py @@ -15,14 +15,16 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -import pytest - from unittest.case import TestCase +import pytest + from pyanaconda.modules.payloads.constants import SourceType from pyanaconda.modules.payloads.source.factory import SourceFactory from pyanaconda.modules.payloads.source.source_base import PayloadSourceBase -from pyanaconda.modules.payloads.source.source_base_interface import PayloadSourceBaseInterface +from pyanaconda.modules.payloads.source.source_base_interface import ( + PayloadSourceBaseInterface, +) class SourceFactoryTestCase(TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_flatpak.py b/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_flatpak.py index d0a4e726d4a..a905dc0a0b7 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_flatpak.py +++ b/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_flatpak.py @@ -21,10 +21,11 @@ from pyanaconda.core.constants import SOURCE_TYPE_FLATPAK from pyanaconda.modules.common.constants.interfaces import PAYLOAD_SOURCE_RPM_OSTREE -from pyanaconda.modules.payloads.constants import SourceType, SourceState +from pyanaconda.modules.payloads.constants import SourceState, SourceType from pyanaconda.modules.payloads.source.flatpak.flatpak import FlatpakSourceModule -from pyanaconda.modules.payloads.source.flatpak.initialization import GetFlatpaksSizeTask - +from pyanaconda.modules.payloads.source.flatpak.initialization import ( + GetFlatpaksSizeTask, +) from tests.unit_tests.pyanaconda_tests import check_dbus_property diff --git a/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_harddrive.py b/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_harddrive.py index 0f73572de88..9868bd875ac 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_harddrive.py +++ b/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_harddrive.py @@ -25,10 +25,12 @@ from pyanaconda.modules.common.errors.general import InvalidValueError from pyanaconda.modules.common.errors.payload import SourceSetupError from pyanaconda.modules.common.structures.payload import RepoConfigurationData -from pyanaconda.modules.payloads.constants import SourceType, SourceState +from pyanaconda.modules.payloads.constants import SourceState, SourceType from pyanaconda.modules.payloads.source.harddrive.harddrive import HardDriveSourceModule -from pyanaconda.modules.payloads.source.harddrive.initialization import SetUpHardDriveSourceTask, \ - SetupHardDriveResult +from pyanaconda.modules.payloads.source.harddrive.initialization import ( + SetupHardDriveResult, + SetUpHardDriveSourceTask, +) from pyanaconda.modules.payloads.source.mount_tasks import TearDownMountTask from tests.unit_tests.pyanaconda_tests import check_dbus_property diff --git a/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_hmc.py b/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_hmc.py index 6377d77786b..5aebf868404 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_hmc.py +++ b/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_hmc.py @@ -18,9 +18,9 @@ # import tempfile import unittest -import pytest +from unittest.mock import call, patch -from unittest.mock import patch, call +import pytest from pyanaconda.core.constants import SOURCE_TYPE_HMC from pyanaconda.modules.common.errors.payload import SourceSetupError diff --git a/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_live_image.py b/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_live_image.py index 21c4df05a08..b84a1945fb7 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_live_image.py +++ b/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_live_image.py @@ -18,26 +18,33 @@ import os import tempfile import unittest -import pytest - from contextlib import contextmanager -from dasbus.typing import get_variant, Str, Bool +from unittest.mock import Mock, patch + +import pytest +from dasbus.typing import Bool, Str, get_variant from requests import RequestException -from unittest.mock import patch, Mock -from pyanaconda.core.constants import SOURCE_TYPE_LIVE_IMAGE, NETWORK_CONNECTION_TIMEOUT -from pyanaconda.core.path import make_directories, touch, join_paths +from pyanaconda.core.constants import NETWORK_CONNECTION_TIMEOUT, SOURCE_TYPE_LIVE_IMAGE +from pyanaconda.core.path import join_paths, make_directories, touch from pyanaconda.modules.common.constants.interfaces import PAYLOAD_SOURCE_LIVE_IMAGE from pyanaconda.modules.common.errors.payload import SourceSetupError from pyanaconda.modules.common.structures.live_image import LiveImageConfigurationData -from pyanaconda.modules.payloads.constants import SourceType, SourceState -from pyanaconda.modules.payloads.source.live_image.initialization import \ - SetUpLocalImageSourceTask, SetUpRemoteImageSourceTask, SetupImageResult -from pyanaconda.modules.payloads.source.live_image.installation import InstallLiveImageTask -from pyanaconda.modules.payloads.source.live_image.live_image import LiveImageSourceModule -from pyanaconda.modules.payloads.source.live_image.live_image_interface import \ - LiveImageSourceInterface - +from pyanaconda.modules.payloads.constants import SourceState, SourceType +from pyanaconda.modules.payloads.source.live_image.initialization import ( + SetupImageResult, + SetUpLocalImageSourceTask, + SetUpRemoteImageSourceTask, +) +from pyanaconda.modules.payloads.source.live_image.installation import ( + InstallLiveImageTask, +) +from pyanaconda.modules.payloads.source.live_image.live_image import ( + LiveImageSourceModule, +) +from pyanaconda.modules.payloads.source.live_image.live_image_interface import ( + LiveImageSourceInterface, +) from tests.unit_tests.pyanaconda_tests import check_dbus_property diff --git a/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_live_os.py b/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_live_os.py index 77ad4c74ea1..8bbf4c27db6 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_live_os.py +++ b/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_live_os.py @@ -18,23 +18,31 @@ # Red Hat Author(s): Jiri Konecny # import unittest -import pytest - from unittest.mock import Mock, patch +import pytest + from pyanaconda.core.constants import SOURCE_TYPE_LIVE_OS_IMAGE from pyanaconda.modules.common.constants.interfaces import PAYLOAD_SOURCE_LIVE_OS from pyanaconda.modules.common.errors.payload import SourceSetupError from pyanaconda.modules.common.structures.storage import DeviceData from pyanaconda.modules.payloads.constants import SourceState +from pyanaconda.modules.payloads.source.live_os.initialization import ( + DetectLiveOSImageTask, + SetupLiveOSResult, + SetUpLiveOSSourceTask, +) from pyanaconda.modules.payloads.source.live_os.live_os import LiveOSSourceModule -from pyanaconda.modules.payloads.source.live_os.live_os_interface import LiveOSSourceInterface -from pyanaconda.modules.payloads.source.live_os.initialization import SetUpLiveOSSourceTask, \ - DetectLiveOSImageTask, SetupLiveOSResult +from pyanaconda.modules.payloads.source.live_os.live_os_interface import ( + LiveOSSourceInterface, +) from pyanaconda.modules.payloads.source.mount_tasks import TearDownMountTask - -from tests.unit_tests.pyanaconda_tests import patch_dbus_get_proxy, patch_dbus_publish_object, \ - check_task_creation, check_dbus_property +from tests.unit_tests.pyanaconda_tests import ( + check_dbus_property, + check_task_creation, + patch_dbus_get_proxy, + patch_dbus_publish_object, +) class LiveOSSourceInterfaceTestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_live_tar.py b/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_live_tar.py index f9a877bd8d5..df535149105 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_live_tar.py +++ b/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_live_tar.py @@ -19,19 +19,18 @@ import tarfile import tempfile import unittest - from contextlib import contextmanager -from dasbus.typing import get_variant, Str, Bool from unittest.mock import patch +from dasbus.typing import Bool, Str, get_variant + from pyanaconda.core.constants import SOURCE_TYPE_LIVE_TAR -from pyanaconda.core.path import touch, join_paths, make_directories +from pyanaconda.core.path import join_paths, make_directories, touch from pyanaconda.modules.common.constants.interfaces import PAYLOAD_SOURCE_LIVE_IMAGE from pyanaconda.modules.common.structures.live_image import LiveImageConfigurationData from pyanaconda.modules.payloads.constants import SourceType from pyanaconda.modules.payloads.source.live_tar.installation import InstallLiveTarTask from pyanaconda.modules.payloads.source.live_tar.live_tar import LiveTarSourceModule - from tests.unit_tests.pyanaconda_tests import check_dbus_property diff --git a/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_nfs.py b/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_nfs.py index b2bd98fcffc..edfe128e5e8 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_nfs.py +++ b/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_nfs.py @@ -25,10 +25,12 @@ from pyanaconda.modules.common.errors.general import InvalidValueError from pyanaconda.modules.common.errors.payload import SourceSetupError from pyanaconda.modules.common.structures.payload import RepoConfigurationData -from pyanaconda.modules.payloads.constants import SourceType, SourceState +from pyanaconda.modules.payloads.constants import SourceState, SourceType from pyanaconda.modules.payloads.source.mount_tasks import TearDownMountTask -from pyanaconda.modules.payloads.source.nfs.initialization import SetUpNFSSourceTask, \ - SetUpNFSSourceResult +from pyanaconda.modules.payloads.source.nfs.initialization import ( + SetUpNFSSourceResult, + SetUpNFSSourceTask, +) from pyanaconda.modules.payloads.source.nfs.nfs import NFSSourceModule from tests.unit_tests.pyanaconda_tests import check_dbus_property diff --git a/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_repo_files.py b/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_repo_files.py index 73aaec55058..6c445a89d94 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_repo_files.py +++ b/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_repo_files.py @@ -17,18 +17,22 @@ # import os import unittest -import pytest - from tempfile import TemporaryDirectory +import pytest + from pyanaconda.core.constants import SOURCE_TYPE_REPO_FILES from pyanaconda.modules.common.errors.payload import SourceSetupError from pyanaconda.modules.payloads.constants import SourceType -from pyanaconda.modules.payloads.source.repo_files.repo_files import RepoFilesSourceModule -from pyanaconda.modules.payloads.source.repo_files.repo_files_interface import \ - RepoFilesSourceInterface -from pyanaconda.modules.payloads.source.repo_files.initialization import \ - SetUpRepoFilesSourceTask +from pyanaconda.modules.payloads.source.repo_files.initialization import ( + SetUpRepoFilesSourceTask, +) +from pyanaconda.modules.payloads.source.repo_files.repo_files import ( + RepoFilesSourceModule, +) +from pyanaconda.modules.payloads.source.repo_files.repo_files_interface import ( + RepoFilesSourceInterface, +) class RepoFilesSourceInterfaceTestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_repo_path.py b/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_repo_path.py index 9f2cea1b5f6..75f2b212af3 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_repo_path.py +++ b/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_repo_path.py @@ -17,19 +17,21 @@ # import subprocess import unittest -import pytest - from tempfile import TemporaryDirectory +import pytest + from pyanaconda.core.constants import SOURCE_TYPE_REPO_PATH from pyanaconda.modules.common.constants.interfaces import PAYLOAD_SOURCE_REPO_PATH -from pyanaconda.modules.payloads.constants import SourceType, SourceState -from pyanaconda.modules.payloads.source.repo_path.repo_path import RepoPathSourceModule -from pyanaconda.modules.payloads.source.repo_path.repo_path_interface import \ - RepoPathSourceInterface -from pyanaconda.modules.payloads.source.repo_path.initialization import SetUpRepoPathSourceTask from pyanaconda.modules.common.errors.payload import SourceSetupError - +from pyanaconda.modules.payloads.constants import SourceState, SourceType +from pyanaconda.modules.payloads.source.repo_path.initialization import ( + SetUpRepoPathSourceTask, +) +from pyanaconda.modules.payloads.source.repo_path.repo_path import RepoPathSourceModule +from pyanaconda.modules.payloads.source.repo_path.repo_path_interface import ( + RepoPathSourceInterface, +) from tests.unit_tests.pyanaconda_tests import check_dbus_property diff --git a/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_rpm_ostree.py b/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_rpm_ostree.py index 84fd7f5dab3..fe3985298a0 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_rpm_ostree.py +++ b/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_rpm_ostree.py @@ -17,15 +17,17 @@ # import unittest -from dasbus.typing import get_variant, Str, Bool +from dasbus.typing import Bool, Str, get_variant from pyanaconda.core.constants import SOURCE_TYPE_RPM_OSTREE from pyanaconda.modules.common.constants.interfaces import PAYLOAD_SOURCE_RPM_OSTREE -from pyanaconda.modules.payloads.constants import SourceType, SourceState -from pyanaconda.modules.payloads.source.rpm_ostree.rpm_ostree import RPMOSTreeSourceModule -from pyanaconda.modules.payloads.source.rpm_ostree.rpm_ostree_interface import \ - RPMOSTreeSourceInterface - +from pyanaconda.modules.payloads.constants import SourceState, SourceType +from pyanaconda.modules.payloads.source.rpm_ostree.rpm_ostree import ( + RPMOSTreeSourceModule, +) +from pyanaconda.modules.payloads.source.rpm_ostree.rpm_ostree_interface import ( + RPMOSTreeSourceInterface, +) from tests.unit_tests.pyanaconda_tests import check_dbus_property diff --git a/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_rpm_ostree_container.py b/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_rpm_ostree_container.py index 5cd78720e46..f33cf66f697 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_rpm_ostree_container.py +++ b/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_rpm_ostree_container.py @@ -18,14 +18,19 @@ import unittest from pyanaconda.core.constants import SOURCE_TYPE_RPM_OSTREE_CONTAINER -from pyanaconda.modules.common.constants.interfaces import PAYLOAD_SOURCE_RPM_OSTREE_CONTAINER -from pyanaconda.modules.payloads.constants import SourceType, SourceState -from pyanaconda.modules.common.structures.rpm_ostree import RPMOSTreeContainerConfigurationData -from pyanaconda.modules.payloads.source.rpm_ostree_container.rpm_ostree_container import \ - RPMOSTreeContainerSourceModule -from pyanaconda.modules.payloads.source.rpm_ostree_container.rpm_ostree_container_interface \ - import RPMOSTreeContainerSourceInterface - +from pyanaconda.modules.common.constants.interfaces import ( + PAYLOAD_SOURCE_RPM_OSTREE_CONTAINER, +) +from pyanaconda.modules.common.structures.rpm_ostree import ( + RPMOSTreeContainerConfigurationData, +) +from pyanaconda.modules.payloads.constants import SourceState, SourceType +from pyanaconda.modules.payloads.source.rpm_ostree_container.rpm_ostree_container import ( + RPMOSTreeContainerSourceModule, +) +from pyanaconda.modules.payloads.source.rpm_ostree_container.rpm_ostree_container_interface import ( + RPMOSTreeContainerSourceInterface, +) from tests.unit_tests.pyanaconda_tests import check_dbus_property diff --git a/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_utils.py b/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_utils.py index 8a2e8b7d549..60568423d95 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_utils.py +++ b/tests/unit_tests/pyanaconda_tests/modules/payloads/source/test_source_utils.py @@ -15,11 +15,11 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from io import StringIO import unittest +from io import StringIO from unittest.mock import patch -from pyanaconda.modules.payloads.source.utils import is_valid_install_disk, is_tar +from pyanaconda.modules.payloads.source.utils import is_tar, is_valid_install_disk class SourceUtilsTestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/modules/payloads/test_module_payloads.py b/tests/unit_tests/pyanaconda_tests/modules/payloads/test_module_payloads.py index 3e1834351a3..4c3ea3612c4 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/payloads/test_module_payloads.py +++ b/tests/unit_tests/pyanaconda_tests/modules/payloads/test_module_payloads.py @@ -18,32 +18,41 @@ # Red Hat Author(s): Jiri Konecny # import os -import pytest - from tempfile import TemporaryDirectory from textwrap import dedent from unittest import TestCase -from unittest.mock import patch, create_autospec, DEFAULT +from unittest.mock import DEFAULT, create_autospec, patch -from tests.unit_tests.pyanaconda_tests import patch_dbus_publish_object, check_dbus_object_creation -from tests.unit_tests.pyanaconda_tests.modules.payloads.payload.module_payload_shared import \ - PayloadKickstartSharedTest +import pytest from pyanaconda.core.constants import SOURCE_TYPE_LIVE_OS_IMAGE from pyanaconda.modules.common.containers import PayloadContainer from pyanaconda.modules.common.errors.general import UnavailableValueError -from pyanaconda.modules.common.errors.payload import SourceSetupError, SourceTearDownError +from pyanaconda.modules.common.errors.payload import ( + SourceSetupError, + SourceTearDownError, +) from pyanaconda.modules.common.task import Task -from pyanaconda.modules.payloads.source.source_base import PayloadSourceBase -from pyanaconda.modules.payloads.base.initialization import SetUpSourcesTask, TearDownSourcesTask -from pyanaconda.modules.payloads.installation import PrepareSystemForInstallationTask +from pyanaconda.modules.payloads.base.initialization import ( + SetUpSourcesTask, + TearDownSourcesTask, +) from pyanaconda.modules.payloads.constants import PayloadType, SourceType -from pyanaconda.modules.payloads.payloads_interface import PayloadsInterface -from pyanaconda.modules.payloads.payloads import PayloadsService +from pyanaconda.modules.payloads.installation import PrepareSystemForInstallationTask from pyanaconda.modules.payloads.payload.dnf.dnf import DNFModule from pyanaconda.modules.payloads.payload.live_image.live_image import LiveImageModule from pyanaconda.modules.payloads.payload.live_os.live_os import LiveOSModule +from pyanaconda.modules.payloads.payloads import PayloadsService +from pyanaconda.modules.payloads.payloads_interface import PayloadsInterface from pyanaconda.modules.payloads.source.live_os.live_os import LiveOSSourceModule +from pyanaconda.modules.payloads.source.source_base import PayloadSourceBase +from tests.unit_tests.pyanaconda_tests import ( + check_dbus_object_creation, + patch_dbus_publish_object, +) +from tests.unit_tests.pyanaconda_tests.modules.payloads.payload.module_payload_shared import ( + PayloadKickstartSharedTest, +) class PayloadsInterfaceTestCase(TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/modules/runtime/test_module_runtime.py b/tests/unit_tests/pyanaconda_tests/modules/runtime/test_module_runtime.py index 84cf02bc830..c5ab23f6032 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/runtime/test_module_runtime.py +++ b/tests/unit_tests/pyanaconda_tests/modules/runtime/test_module_runtime.py @@ -18,10 +18,9 @@ import unittest from textwrap import dedent -from tests.unit_tests.pyanaconda_tests import check_kickstart_interface - from pyanaconda.modules.runtime.runtime import RuntimeService from pyanaconda.modules.runtime.runtime_interface import RuntimeInterface +from tests.unit_tests.pyanaconda_tests import check_kickstart_interface class RuntimeInterfaceTestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/modules/runtime/test_module_ui.py b/tests/unit_tests/pyanaconda_tests/modules/runtime/test_module_ui.py index 63aba51bbee..e940222fbbb 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/runtime/test_module_ui.py +++ b/tests/unit_tests/pyanaconda_tests/modules/runtime/test_module_ui.py @@ -18,12 +18,12 @@ import unittest from dasbus.structure import compare_data -from dasbus.typing import get_variant, Bool, UInt16 +from dasbus.typing import Bool, UInt16, get_variant -from pyanaconda.modules.runtime.user_interface import UIModule -from pyanaconda.modules.runtime.user_interface.ui_interface import UIInterface from pyanaconda.modules.common.constants.objects import USER_INTERFACE from pyanaconda.modules.common.structures.policy import PasswordPolicy +from pyanaconda.modules.runtime.user_interface import UIModule +from pyanaconda.modules.runtime.user_interface.ui_interface import UIInterface from tests.unit_tests.pyanaconda_tests import check_dbus_property diff --git a/tests/unit_tests/pyanaconda_tests/modules/security/test_module_security.py b/tests/unit_tests/pyanaconda_tests/modules/security/test_module_security.py index 9f83fcea05f..90e8d1ca7ec 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/security/test_module_security.py +++ b/tests/unit_tests/pyanaconda_tests/modules/security/test_module_security.py @@ -17,32 +17,46 @@ # # Red Hat Author(s): Vendula Poncova # -import unittest -import tempfile import os -import pytest - +import tempfile +import unittest from contextlib import contextmanager from textwrap import dedent from unittest.mock import patch +import pytest +from dasbus.typing import Bool, List, Str, get_variant +from pykickstart.constants import SELINUX_ENFORCING, SELINUX_PERMISSIVE + from pyanaconda.core.configuration.target import TargetType from pyanaconda.core.constants import PAYLOAD_TYPE_DNF, PAYLOAD_TYPE_RPM_OSTREE -from pykickstart.constants import SELINUX_ENFORCING, SELINUX_PERMISSIVE -from pyanaconda.modules.common.errors.installation import SecurityInstallationError from pyanaconda.modules.common.constants.services import SECURITY +from pyanaconda.modules.common.errors.installation import SecurityInstallationError from pyanaconda.modules.common.structures.realm import RealmData -from dasbus.typing import get_variant, Str, List, Bool +from pyanaconda.modules.common.structures.requirement import Requirement +from pyanaconda.modules.security.constants import SELinuxMode +from pyanaconda.modules.security.installation import ( + AUTHSELECT_TOOL_PATH, + PAM_SO_64_PATH, + PAM_SO_PATH, + ConfigureAuthselectTask, + ConfigureFingerprintAuthTask, + ConfigureFIPSTask, + ConfigureSELinuxTask, + PreconfigureFIPSTask, + RealmDiscoverTask, + RealmJoinTask, +) from pyanaconda.modules.security.security import SecurityService from pyanaconda.modules.security.security_interface import SecurityInterface -from pyanaconda.modules.security.constants import SELinuxMode -from pyanaconda.modules.security.installation import ConfigureSELinuxTask, \ - RealmDiscoverTask, RealmJoinTask, ConfigureFingerprintAuthTask, \ - ConfigureAuthselectTask, AUTHSELECT_TOOL_PATH, \ - PAM_SO_64_PATH, PAM_SO_PATH, PreconfigureFIPSTask, ConfigureFIPSTask -from tests.unit_tests.pyanaconda_tests import patch_dbus_publish_object, check_kickstart_interface, \ - check_task_creation, check_task_creation_list, PropertiesChangedCallback, check_dbus_property -from pyanaconda.modules.common.structures.requirement import Requirement +from tests.unit_tests.pyanaconda_tests import ( + PropertiesChangedCallback, + check_dbus_property, + check_kickstart_interface, + check_task_creation, + check_task_creation_list, + patch_dbus_publish_object, +) class SecurityInterfaceTestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/modules/storage/partitioning/test_module_part_automatic.py b/tests/unit_tests/pyanaconda_tests/modules/storage/partitioning/test_module_part_automatic.py index 112c4f99db3..6027180ca5e 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/storage/partitioning/test_module_part_automatic.py +++ b/tests/unit_tests/pyanaconda_tests/modules/storage/partitioning/test_module_part_automatic.py @@ -18,39 +18,49 @@ # Red Hat Author(s): Vendula Poncova # import unittest -import pytest - -from unittest.mock import Mock, patch, ANY, call +from unittest.mock import ANY, Mock, call, patch +import pytest +from blivet.errors import StorageError from blivet.formats.luks import LUKS2PBKDFArgs from blivet.size import Size -from blivet.errors import StorageError - -from pyanaconda.modules.common.structures.validation import ValidationReport -from pyanaconda.modules.storage.partitioning.automatic.resizable_module import \ - ResizableDeviceTreeModule -from pyanaconda.modules.storage.partitioning.automatic.utils import \ - get_disks_for_implicit_partitions -from pyanaconda.modules.storage.partitioning.specification import PartSpec -from tests.unit_tests.pyanaconda_tests import patch_dbus_publish_object, check_dbus_property, \ - check_task_creation, check_dbus_object_creation - -from pykickstart.constants import AUTOPART_TYPE_LVM_THINP, AUTOPART_TYPE_PLAIN, \ - AUTOPART_TYPE_LVM, AUTOPART_TYPE_BTRFS - from dasbus.typing import * # pylint: disable=wildcard-import +from pykickstart.constants import ( + AUTOPART_TYPE_BTRFS, + AUTOPART_TYPE_LVM, + AUTOPART_TYPE_LVM_THINP, + AUTOPART_TYPE_PLAIN, +) + from pyanaconda.modules.common.constants.objects import AUTO_PARTITIONING from pyanaconda.modules.common.errors.storage import UnavailableStorageError from pyanaconda.modules.common.structures.partitioning import PartitioningRequest -from pyanaconda.modules.storage.partitioning.automatic.automatic_module import \ - AutoPartitioningModule -from pyanaconda.modules.storage.partitioning.automatic.automatic_interface import \ - AutoPartitioningInterface -from pyanaconda.modules.storage.partitioning.automatic.automatic_partitioning import \ - AutomaticPartitioningTask -from pyanaconda.modules.storage.partitioning.automatic.utils import get_default_partitioning -from pyanaconda.modules.storage.partitioning.validate import StorageValidateTask +from pyanaconda.modules.common.structures.validation import ValidationReport from pyanaconda.modules.storage.devicetree import create_storage +from pyanaconda.modules.storage.partitioning.automatic.automatic_interface import ( + AutoPartitioningInterface, +) +from pyanaconda.modules.storage.partitioning.automatic.automatic_module import ( + AutoPartitioningModule, +) +from pyanaconda.modules.storage.partitioning.automatic.automatic_partitioning import ( + AutomaticPartitioningTask, +) +from pyanaconda.modules.storage.partitioning.automatic.resizable_module import ( + ResizableDeviceTreeModule, +) +from pyanaconda.modules.storage.partitioning.automatic.utils import ( + get_default_partitioning, + get_disks_for_implicit_partitions, +) +from pyanaconda.modules.storage.partitioning.specification import PartSpec +from pyanaconda.modules.storage.partitioning.validate import StorageValidateTask +from tests.unit_tests.pyanaconda_tests import ( + check_dbus_object_creation, + check_dbus_property, + check_task_creation, + patch_dbus_publish_object, +) class AutopartitioningInterfaceTestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/modules/storage/partitioning/test_module_part_blivet.py b/tests/unit_tests/pyanaconda_tests/modules/storage/partitioning/test_module_part_blivet.py index a37d130b554..0c4a376282a 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/storage/partitioning/test_module_part_blivet.py +++ b/tests/unit_tests/pyanaconda_tests/modules/storage/partitioning/test_module_part_blivet.py @@ -18,22 +18,27 @@ # Red Hat Author(s): Vendula Poncova # import os -import sys import pickle +import sys import unittest -import pytest - from unittest.mock import patch -from pyanaconda.modules.storage.devicetree import create_storage -from tests.unit_tests.pyanaconda_tests import patch_dbus_publish_object, check_task_creation - -from pyanaconda.modules.storage.partitioning.blivet.blivet_module import BlivetPartitioningModule -from pyanaconda.modules.storage.partitioning.blivet.blivet_interface import \ - BlivetPartitioningInterface -from pyanaconda.modules.storage.partitioning.interactive.interactive_partitioning import \ - InteractivePartitioningTask +import pytest +from pyanaconda.modules.storage.devicetree import create_storage +from pyanaconda.modules.storage.partitioning.blivet.blivet_interface import ( + BlivetPartitioningInterface, +) +from pyanaconda.modules.storage.partitioning.blivet.blivet_module import ( + BlivetPartitioningModule, +) +from pyanaconda.modules.storage.partitioning.interactive.interactive_partitioning import ( + InteractivePartitioningTask, +) +from tests.unit_tests.pyanaconda_tests import ( + check_task_creation, + patch_dbus_publish_object, +) # blivet-gui is supported on Fedora, but not ELN/CentOS/RHEL HAVE_BLIVET_GUI = os.path.exists("/usr/bin/blivet-gui") @@ -71,7 +76,9 @@ def test_unsupported_partitioning(self): assert blivet_module.storage is not None # Import the exception again. - from pyanaconda.modules.common.errors.storage import UnsupportedPartitioningError + from pyanaconda.modules.common.errors.storage import ( + UnsupportedPartitioningError, + ) # Handle the missing support. with pytest.raises(UnsupportedPartitioningError): @@ -107,7 +114,9 @@ def test_send_request(self): answer = self.interface.SendRequest(request) answer = pickle.loads(answer) - from blivetgui.communication.proxy_utils import ProxyID # pylint: disable=import-error + from blivetgui.communication.proxy_utils import ( + ProxyID, # pylint: disable=import-error + ) assert isinstance(answer, ProxyID) assert answer.id == 0 diff --git a/tests/unit_tests/pyanaconda_tests/modules/storage/partitioning/test_module_part_custom.py b/tests/unit_tests/pyanaconda_tests/modules/storage/partitioning/test_module_part_custom.py index 265f2704a1a..6b9f07da772 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/storage/partitioning/test_module_part_custom.py +++ b/tests/unit_tests/pyanaconda_tests/modules/storage/partitioning/test_module_part_custom.py @@ -18,26 +18,31 @@ # Red Hat Author(s): Vendula Poncova # import unittest -import pytest - from unittest.mock import Mock, PropertyMock, patch +import pytest from blivet.devices import PartitionDevice from blivet.formats import get_format from blivet.size import Size -from tests.unit_tests.pyanaconda_tests import patch_dbus_publish_object, check_task_creation, \ - patch_dbus_get_proxy - from pyanaconda.modules.common.errors.storage import UnavailableDataError +from pyanaconda.modules.storage.devicetree import create_storage from pyanaconda.modules.storage.devicetree.model import InstallerStorage -from pyanaconda.modules.storage.partitioning.custom.custom_module import CustomPartitioningModule -from pyanaconda.modules.storage.partitioning.custom.custom_interface import \ - CustomPartitioningInterface -from pyanaconda.modules.storage.partitioning.custom.custom_partitioning import \ - CustomPartitioningTask +from pyanaconda.modules.storage.partitioning.custom.custom_interface import ( + CustomPartitioningInterface, +) +from pyanaconda.modules.storage.partitioning.custom.custom_module import ( + CustomPartitioningModule, +) +from pyanaconda.modules.storage.partitioning.custom.custom_partitioning import ( + CustomPartitioningTask, +) from pyanaconda.modules.storage.storage import StorageService -from pyanaconda.modules.storage.devicetree import create_storage +from tests.unit_tests.pyanaconda_tests import ( + check_task_creation, + patch_dbus_get_proxy, + patch_dbus_publish_object, +) class CustomPartitioningInterfaceTestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/modules/storage/partitioning/test_module_part_factory.py b/tests/unit_tests/pyanaconda_tests/modules/storage/partitioning/test_module_part_factory.py index d9d7eed32d7..939b8359e06 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/storage/partitioning/test_module_part_factory.py +++ b/tests/unit_tests/pyanaconda_tests/modules/storage/partitioning/test_module_part_factory.py @@ -18,14 +18,16 @@ # Red Hat Author(s): Vendula Poncova # import unittest -import pytest - -from unittest.mock import patch, PropertyMock +from unittest.mock import PropertyMock, patch +import pytest from blivet.formats.fs import BTRFS from pykickstart.base import RemovedCommand -from pyanaconda.core.kickstart.specification import KickstartSpecificationHandler, \ - KickstartSpecificationParser + +from pyanaconda.core.kickstart.specification import ( + KickstartSpecificationHandler, + KickstartSpecificationParser, +) from pyanaconda.modules.storage.kickstart import StorageKickstartSpecification from pyanaconda.modules.storage.partitioning.base import PartitioningModule from pyanaconda.modules.storage.partitioning.base_interface import PartitioningInterface diff --git a/tests/unit_tests/pyanaconda_tests/modules/storage/partitioning/test_module_part_interactive.py b/tests/unit_tests/pyanaconda_tests/modules/storage/partitioning/test_module_part_interactive.py index 0897fa1e3c7..e51c6ed3ec2 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/storage/partitioning/test_module_part_interactive.py +++ b/tests/unit_tests/pyanaconda_tests/modules/storage/partitioning/test_module_part_interactive.py @@ -18,36 +18,52 @@ # Red Hat Author(s): Vendula Poncova # import unittest -import pytest - from unittest.mock import patch +import pytest from blivet import devicefactory from blivet.devicelibs import raid -from blivet.devices import StorageDevice, DiskDevice, PartitionDevice, LVMVolumeGroupDevice, \ - LVMLogicalVolumeDevice, MDRaidArrayDevice, BTRFSVolumeDevice, BTRFSSubVolumeDevice +from blivet.devices import ( + BTRFSSubVolumeDevice, + BTRFSVolumeDevice, + DiskDevice, + LVMLogicalVolumeDevice, + LVMVolumeGroupDevice, + MDRaidArrayDevice, + PartitionDevice, + StorageDevice, +) from blivet.formats import get_format from blivet.size import Size +from dasbus.typing import * # pylint: disable=wildcard-import from pyanaconda.core.constants import PARTITIONING_METHOD_INTERACTIVE -from dasbus.typing import * # pylint: disable=wildcard-import from pyanaconda.modules.common.containers import DeviceTreeContainer from pyanaconda.modules.common.errors.storage import UnsupportedDeviceError from pyanaconda.modules.common.structures.device_factory import DeviceFactoryRequest -from pyanaconda.modules.storage.devicetree.devicetree_interface import DeviceTreeInterface -from pyanaconda.modules.storage.partitioning.interactive.interactive_module import \ - InteractivePartitioningModule -from pyanaconda.modules.storage.partitioning.interactive import utils -from pyanaconda.modules.storage.partitioning.interactive.interactive_interface import \ - InteractivePartitioningInterface -from pyanaconda.modules.storage.partitioning.interactive.interactive_partitioning import \ - InteractivePartitioningTask -from pyanaconda.modules.storage.partitioning.interactive.scheduler_module import \ - DeviceTreeSchedulerModule from pyanaconda.modules.storage.devicetree import create_storage - -from tests.unit_tests.pyanaconda_tests import patch_dbus_publish_object, check_task_creation, \ - check_dbus_object_creation, reset_dbus_container +from pyanaconda.modules.storage.devicetree.devicetree_interface import ( + DeviceTreeInterface, +) +from pyanaconda.modules.storage.partitioning.interactive import utils +from pyanaconda.modules.storage.partitioning.interactive.interactive_interface import ( + InteractivePartitioningInterface, +) +from pyanaconda.modules.storage.partitioning.interactive.interactive_module import ( + InteractivePartitioningModule, +) +from pyanaconda.modules.storage.partitioning.interactive.interactive_partitioning import ( + InteractivePartitioningTask, +) +from pyanaconda.modules.storage.partitioning.interactive.scheduler_module import ( + DeviceTreeSchedulerModule, +) +from tests.unit_tests.pyanaconda_tests import ( + check_dbus_object_creation, + check_task_creation, + patch_dbus_publish_object, + reset_dbus_container, +) class InteractivePartitioningInterfaceTestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/modules/storage/partitioning/test_module_part_manual.py b/tests/unit_tests/pyanaconda_tests/modules/storage/partitioning/test_module_part_manual.py index d7e3eeed7e5..c7624629555 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/storage/partitioning/test_module_part_manual.py +++ b/tests/unit_tests/pyanaconda_tests/modules/storage/partitioning/test_module_part_manual.py @@ -20,23 +20,28 @@ import unittest from unittest.mock import Mock -from tests.unit_tests.pyanaconda_tests import patch_dbus_publish_object - -from tests.unit_tests.pyanaconda_tests import check_task_creation, check_dbus_property - -from blivet.devices import StorageDevice, DiskDevice +from blivet.devices import DiskDevice, StorageDevice from blivet.formats import get_format from blivet.size import Size +from dasbus.typing import Bool, Str, get_variant -from dasbus.typing import get_variant, Str, Bool from pyanaconda.modules.common.constants.objects import MANUAL_PARTITIONING from pyanaconda.modules.common.structures.partitioning import MountPointRequest -from pyanaconda.modules.storage.partitioning.manual.manual_module import ManualPartitioningModule -from pyanaconda.modules.storage.partitioning.manual.manual_interface import \ - ManualPartitioningInterface -from pyanaconda.modules.storage.partitioning.manual.manual_partitioning import \ - ManualPartitioningTask from pyanaconda.modules.storage.devicetree import create_storage +from pyanaconda.modules.storage.partitioning.manual.manual_interface import ( + ManualPartitioningInterface, +) +from pyanaconda.modules.storage.partitioning.manual.manual_module import ( + ManualPartitioningModule, +) +from pyanaconda.modules.storage.partitioning.manual.manual_partitioning import ( + ManualPartitioningTask, +) +from tests.unit_tests.pyanaconda_tests import ( + check_dbus_property, + check_task_creation, + patch_dbus_publish_object, +) class ManualPartitioningInterfaceTestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/modules/storage/partitioning/test_module_part_specification.py b/tests/unit_tests/pyanaconda_tests/modules/storage/partitioning/test_module_part_specification.py index 7f8b22e5e81..be860cb69e4 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/storage/partitioning/test_module_part_specification.py +++ b/tests/unit_tests/pyanaconda_tests/modules/storage/partitioning/test_module_part_specification.py @@ -17,8 +17,12 @@ # import unittest -from pykickstart.constants import AUTOPART_TYPE_PLAIN, AUTOPART_TYPE_LVM, AUTOPART_TYPE_BTRFS, \ - AUTOPART_TYPE_LVM_THINP +from pykickstart.constants import ( + AUTOPART_TYPE_BTRFS, + AUTOPART_TYPE_LVM, + AUTOPART_TYPE_LVM_THINP, + AUTOPART_TYPE_PLAIN, +) from pyanaconda.modules.storage.partitioning.specification import PartSpec diff --git a/tests/unit_tests/pyanaconda_tests/modules/storage/partitioning/test_module_resizable.py b/tests/unit_tests/pyanaconda_tests/modules/storage/partitioning/test_module_resizable.py index 11ec0cf8a3a..0b8e0cb0ec1 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/storage/partitioning/test_module_resizable.py +++ b/tests/unit_tests/pyanaconda_tests/modules/storage/partitioning/test_module_resizable.py @@ -18,21 +18,22 @@ # Red Hat Author(s): Vendula Poncova # import unittest -import pytest - from unittest.mock import patch -from blivet.devices import StorageDevice, DiskDevice, PartitionDevice +import pytest +from blivet.devices import DiskDevice, PartitionDevice, StorageDevice from blivet.formats import get_format from blivet.formats.fs import FS from blivet.size import Size -from pyanaconda.modules.storage.partitioning.automatic.resizable_interface import \ - ResizableDeviceTreeInterface -from pyanaconda.modules.storage.partitioning.automatic.resizable_module import \ - ResizableDeviceTreeModule from pyanaconda.modules.common.errors.storage import ProtectedDeviceError from pyanaconda.modules.storage.devicetree import create_storage +from pyanaconda.modules.storage.partitioning.automatic.resizable_interface import ( + ResizableDeviceTreeInterface, +) +from pyanaconda.modules.storage.partitioning.automatic.resizable_module import ( + ResizableDeviceTreeModule, +) class ResizableDeviceTreeTestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/modules/storage/partitioning/test_module_scheduler.py b/tests/unit_tests/pyanaconda_tests/modules/storage/partitioning/test_module_scheduler.py index ca9f98f42c7..d65a003d2d6 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/storage/partitioning/test_module_scheduler.py +++ b/tests/unit_tests/pyanaconda_tests/modules/storage/partitioning/test_module_scheduler.py @@ -17,18 +17,33 @@ # # Red Hat Author(s): Vendula Poncova # -import unittest -import pytest import copy -from unittest.mock import patch, Mock +import unittest +from unittest.mock import Mock, patch -from blivet.devicefactory import DEVICE_TYPE_LVM, SIZE_POLICY_AUTO, DEVICE_TYPE_PARTITION, \ - DEVICE_TYPE_LVM_THINP, DEVICE_TYPE_DISK, DEVICE_TYPE_MD, DEVICE_TYPE_BTRFS -from blivet.devices import StorageDevice, DiskDevice, PartitionDevice, LUKSDevice, \ - BTRFSVolumeDevice, MDRaidArrayDevice, LVMVolumeGroupDevice, LVMLogicalVolumeDevice +import pytest +from blivet.devicefactory import ( + DEVICE_TYPE_BTRFS, + DEVICE_TYPE_DISK, + DEVICE_TYPE_LVM, + DEVICE_TYPE_LVM_THINP, + DEVICE_TYPE_MD, + DEVICE_TYPE_PARTITION, + SIZE_POLICY_AUTO, +) +from blivet.devices import ( + BTRFSVolumeDevice, + DiskDevice, + LUKSDevice, + LVMLogicalVolumeDevice, + LVMVolumeGroupDevice, + MDRaidArrayDevice, + PartitionDevice, + StorageDevice, +) from blivet.errors import StorageError from blivet.formats import get_format -from blivet.formats.fs import FS, BTRFS +from blivet.formats.fs import BTRFS, FS from blivet.size import Size from dasbus.structure import compare_data from dasbus.typing import get_native @@ -37,17 +52,23 @@ from pyanaconda.modules.common.errors.configuration import StorageConfigurationError from pyanaconda.modules.common.structures.device_factory import DeviceFactoryRequest from pyanaconda.modules.common.structures.partitioning import PartitioningRequest -from pyanaconda.modules.storage.partitioning.interactive.interactive_partitioning import \ - InteractiveAutoPartitioningTask -from pyanaconda.modules.storage.partitioning.interactive.scheduler_interface import \ - DeviceTreeSchedulerInterface -from pyanaconda.modules.storage.partitioning.interactive.scheduler_module import \ - DeviceTreeSchedulerModule -from pyanaconda.modules.storage.platform import EFI from pyanaconda.modules.storage.devicetree import create_storage from pyanaconda.modules.storage.devicetree.root import Root -from tests.unit_tests.pyanaconda_tests import patch_dbus_publish_object, check_task_creation, \ - patch_dbus_get_proxy +from pyanaconda.modules.storage.partitioning.interactive.interactive_partitioning import ( + InteractiveAutoPartitioningTask, +) +from pyanaconda.modules.storage.partitioning.interactive.scheduler_interface import ( + DeviceTreeSchedulerInterface, +) +from pyanaconda.modules.storage.partitioning.interactive.scheduler_module import ( + DeviceTreeSchedulerModule, +) +from pyanaconda.modules.storage.platform import EFI +from tests.unit_tests.pyanaconda_tests import ( + check_task_creation, + patch_dbus_get_proxy, + patch_dbus_publish_object, +) class DeviceTreeSchedulerTestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/modules/storage/test_clearpart.py b/tests/unit_tests/pyanaconda_tests/modules/storage/test_clearpart.py index 08950660e79..931784121c9 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/storage/test_clearpart.py +++ b/tests/unit_tests/pyanaconda_tests/modules/storage/test_clearpart.py @@ -2,12 +2,16 @@ from unittest import mock import blivet +from blivet.flags import flags +from parted import PARTITION_NORMAL -from pyanaconda.modules.storage.disk_initialization import DiskInitializationConfig +from pyanaconda.core.constants import ( + CLEAR_PARTITIONS_ALL, + CLEAR_PARTITIONS_LINUX, + CLEAR_PARTITIONS_NONE, +) from pyanaconda.modules.storage.devicetree import create_storage -from pyanaconda.core.constants import CLEAR_PARTITIONS_ALL, CLEAR_PARTITIONS_LINUX, CLEAR_PARTITIONS_NONE -from parted import PARTITION_NORMAL -from blivet.flags import flags +from pyanaconda.modules.storage.disk_initialization import DiskInitializationConfig DEVICE_CLASSES = [ blivet.devices.DiskDevice, diff --git a/tests/unit_tests/pyanaconda_tests/modules/storage/test_fsset.py b/tests/unit_tests/pyanaconda_tests/modules/storage/test_fsset.py index 481fef2ba32..3ff2a0a999e 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/storage/test_fsset.py +++ b/tests/unit_tests/pyanaconda_tests/modules/storage/test_fsset.py @@ -22,8 +22,8 @@ from blivet.devicetree import DeviceTree from blivet.formats import get_format -from pyanaconda.modules.storage.platform import EFI, X86 from pyanaconda.modules.storage.devicetree.fsset import FSSet +from pyanaconda.modules.storage.platform import EFI, X86 class FSSetTestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/modules/storage/test_grub_raid.py b/tests/unit_tests/pyanaconda_tests/modules/storage/test_grub_raid.py index 6bcf550efc3..c05e12d2e6e 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/storage/test_grub_raid.py +++ b/tests/unit_tests/pyanaconda_tests/modules/storage/test_grub_raid.py @@ -17,15 +17,21 @@ # Test that grub installs involving raid work correctly # These tests do not write anything to the disk and do not require root -from blivet.devices import DiskDevice, PartitionDevice, MDRaidArrayDevice -from blivet.devices import BTRFSVolumeDevice, BTRFSSubVolumeDevice +import unittest + from blivet.devicelibs.raid import RAID1 +from blivet.devices import ( + BTRFSSubVolumeDevice, + BTRFSVolumeDevice, + DiskDevice, + MDRaidArrayDevice, + PartitionDevice, +) from blivet.formats import get_format from blivet.size import Size from pyanaconda.modules.storage.bootloader.grub2 import GRUB2 -import unittest class GRUBRaidSimpleTest(unittest.TestCase): def setUp(self): diff --git a/tests/unit_tests/pyanaconda_tests/modules/storage/test_initialization.py b/tests/unit_tests/pyanaconda_tests/modules/storage/test_initialization.py index 1327638d3bf..8fc4a4a0ffd 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/storage/test_initialization.py +++ b/tests/unit_tests/pyanaconda_tests/modules/storage/test_initialization.py @@ -19,6 +19,7 @@ from unittest.mock import patch from blivet.formats import get_device_format_class + from pyanaconda.modules.storage.initialization import _set_default_label_type diff --git a/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_bootloader.py b/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_bootloader.py index 8bd7021a34d..b2ae361d3ed 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_bootloader.py +++ b/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_bootloader.py @@ -20,39 +20,62 @@ import os import tempfile import unittest -import pytest - from unittest import mock from unittest.mock import Mock, patch +import pytest from blivet.devices import BTRFSDevice, DiskDevice from blivet.formats import get_format from blivet.size import Size -from pyanaconda.modules.storage.devicetree import create_storage -from tests.unit_tests.pyanaconda_tests import patch_dbus_publish_object, check_dbus_property, \ - reset_boot_loader_factory, check_task_creation_list, check_task_creation - +from pyanaconda.core.constants import ( + BOOTLOADER_LOCATION_PARTITION, + BOOTLOADER_SKIPPED, + PAYLOAD_TYPE_DNF, + PAYLOAD_TYPE_LIVE_IMAGE, + PAYLOAD_TYPE_RPM_OSTREE, +) from pyanaconda.core.path import make_directories, touch +from pyanaconda.modules.common.constants.objects import BOOTLOADER +from pyanaconda.modules.common.errors.storage import UnavailableStorageError from pyanaconda.modules.storage import platform -from pyanaconda.modules.storage.bootloader import BootLoaderFactory +from pyanaconda.modules.storage.bootloader import BootLoaderFactory, BootloaderModule from pyanaconda.modules.storage.bootloader.base import BootLoader -from pyanaconda.modules.storage.bootloader.efi import EFIGRUB, Aarch64EFIGRUB, ArmEFIGRUB +from pyanaconda.modules.storage.bootloader.bootloader_interface import ( + BootloaderInterface, +) +from pyanaconda.modules.storage.bootloader.efi import ( + EFIGRUB, + Aarch64EFIGRUB, + ArmEFIGRUB, +) from pyanaconda.modules.storage.bootloader.extlinux import EXTLINUX -from pyanaconda.modules.storage.bootloader.grub2 import GRUB2, IPSeriesGRUB2, PowerNVGRUB2 +from pyanaconda.modules.storage.bootloader.grub2 import ( + GRUB2, + IPSeriesGRUB2, + PowerNVGRUB2, +) +from pyanaconda.modules.storage.bootloader.image import LinuxBootLoaderImage +from pyanaconda.modules.storage.bootloader.installation import ( + CollectKernelArgumentsTask, + ConfigureBootloaderTask, + CreateBLSEntriesTask, + CreateRescueImagesTask, + FixBTRFSBootloaderTask, + FixZIPLBootloaderTask, + InstallBootloaderTask, + RecreateInitrdsTask, +) from pyanaconda.modules.storage.bootloader.zipl import ZIPL -from pyanaconda.modules.common.errors.storage import UnavailableStorageError from pyanaconda.modules.storage.constants import BootloaderMode - -from pyanaconda.modules.storage.bootloader.image import LinuxBootLoaderImage -from pyanaconda.core.constants import BOOTLOADER_SKIPPED, BOOTLOADER_LOCATION_PARTITION, \ - PAYLOAD_TYPE_RPM_OSTREE, PAYLOAD_TYPE_LIVE_IMAGE, PAYLOAD_TYPE_DNF -from pyanaconda.modules.common.constants.objects import BOOTLOADER -from pyanaconda.modules.storage.bootloader import BootloaderModule -from pyanaconda.modules.storage.bootloader.bootloader_interface import BootloaderInterface -from pyanaconda.modules.storage.bootloader.installation import ConfigureBootloaderTask, \ - InstallBootloaderTask, FixZIPLBootloaderTask, FixBTRFSBootloaderTask, RecreateInitrdsTask, \ - CreateRescueImagesTask, CreateBLSEntriesTask, CollectKernelArgumentsTask +from pyanaconda.modules.storage.devicetree import create_storage +from tests.unit_tests.pyanaconda_tests import ( + check_dbus_property, + check_task_creation, + check_task_creation_list, + patch_dbus_publish_object, + reset_boot_loader_factory, +) class BootloaderInterfaceTestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_dasd.py b/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_dasd.py index c6ff5ca7911..c5a81ecd02b 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_dasd.py +++ b/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_dasd.py @@ -18,22 +18,27 @@ # Red Hat Author(s): Vendula Poncova # import unittest -import pytest - -from unittest.mock import patch, call +from unittest.mock import call, patch +import pytest from blivet.devices import DASDDevice from blivet.formats import get_format from blivet.size import Size from pyanaconda.modules.common.errors.configuration import StorageDiscoveryError -from pyanaconda.modules.common.errors.storage import UnavailableStorageError, UnknownDeviceError +from pyanaconda.modules.common.errors.storage import ( + UnavailableStorageError, + UnknownDeviceError, +) from pyanaconda.modules.storage.dasd import DASDModule from pyanaconda.modules.storage.dasd.dasd_interface import DASDInterface from pyanaconda.modules.storage.dasd.discover import DASDDiscoverTask from pyanaconda.modules.storage.dasd.format import DASDFormatTask from pyanaconda.modules.storage.devicetree import create_storage -from tests.unit_tests.pyanaconda_tests import patch_dbus_publish_object, check_task_creation +from tests.unit_tests.pyanaconda_tests import ( + check_task_creation, + patch_dbus_publish_object, +) class DASDInterfaceTestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_device_tree.py b/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_device_tree.py index e5b4496d2be..00beb978e2f 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_device_tree.py +++ b/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_device_tree.py @@ -19,32 +19,57 @@ # import tempfile import unittest -import pytest - -from unittest.mock import patch, Mock, PropertyMock -from tests.unit_tests.pyanaconda_tests import patch_dbus_publish_object, check_task_creation +from unittest.mock import Mock, PropertyMock, patch -from blivet.devices import StorageDevice, DiskDevice, DASDDevice, ZFCPDiskDevice, PartitionDevice, \ - LUKSDevice, iScsiDiskDevice, FcoeDiskDevice, OpticalDevice,LVMVolumeGroupDevice, \ - NVMeFabricsNamespaceDevice +import pytest +from blivet.devices import ( + DASDDevice, + DiskDevice, + FcoeDiskDevice, + LUKSDevice, + LVMVolumeGroupDevice, + NVMeFabricsNamespaceDevice, + OpticalDevice, + PartitionDevice, + StorageDevice, + ZFCPDiskDevice, + iScsiDiskDevice, +) from blivet.devices.disk import NVMeController -from blivet.errors import StorageError, FSError -from blivet.formats import get_format, device_formats, DeviceFormat +from blivet.errors import FSError, StorageError +from blivet.formats import DeviceFormat, device_formats, get_format from blivet.formats.fs import FS, Iso9660FS from blivet.formats.luks import LUKS from blivet.size import Size - from dasbus.typing import * # pylint: disable=wildcard-import + from pyanaconda.core.kernel import KernelArguments -from pyanaconda.modules.common.errors.storage import UnknownDeviceError, MountFilesystemError -from pyanaconda.modules.common.structures.storage import DeviceFormatData, \ - MountPointConstraintsData -from pyanaconda.modules.storage.devicetree import DeviceTreeModule, create_storage, utils -from pyanaconda.modules.storage.devicetree.devicetree_interface import DeviceTreeInterface +from pyanaconda.modules.common.errors.storage import ( + MountFilesystemError, + UnknownDeviceError, +) +from pyanaconda.modules.common.structures.storage import ( + DeviceFormatData, + MountPointConstraintsData, +) +from pyanaconda.modules.storage.devicetree import ( + DeviceTreeModule, + create_storage, + utils, +) +from pyanaconda.modules.storage.devicetree.devicetree_interface import ( + DeviceTreeInterface, +) from pyanaconda.modules.storage.devicetree.populate import FindDevicesTask -from pyanaconda.modules.storage.devicetree.rescue import FindExistingSystemsTask, \ - MountExistingSystemTask +from pyanaconda.modules.storage.devicetree.rescue import ( + FindExistingSystemsTask, + MountExistingSystemTask, +) from pyanaconda.modules.storage.devicetree.root import Root +from tests.unit_tests.pyanaconda_tests import ( + check_task_creation, + patch_dbus_publish_object, +) class DeviceTreeInterfaceTestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_disk_init.py b/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_disk_init.py index 78ba7827321..96feb591f68 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_disk_init.py +++ b/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_disk_init.py @@ -18,20 +18,20 @@ # Red Hat Author(s): Vendula Poncova # import unittest -import pytest - from unittest.mock import Mock +import pytest from pykickstart.constants import CLEARPART_TYPE_NONE from pyanaconda.core.constants import CLEAR_PARTITIONS_LINUX from pyanaconda.modules.common.constants.objects import DISK_INITIALIZATION from pyanaconda.modules.common.errors.storage import UnavailableStorageError from pyanaconda.modules.storage.constants import InitializationMode -from pyanaconda.modules.storage.disk_initialization import DiskInitializationModule -from pyanaconda.modules.storage.disk_initialization.initialization_interface import \ - DiskInitializationInterface from pyanaconda.modules.storage.devicetree import create_storage +from pyanaconda.modules.storage.disk_initialization import DiskInitializationModule +from pyanaconda.modules.storage.disk_initialization.initialization_interface import ( + DiskInitializationInterface, +) from tests.unit_tests.pyanaconda_tests import check_dbus_property diff --git a/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_disk_select.py b/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_disk_select.py index 017ebd7afc8..90f56c838ed 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_disk_select.py +++ b/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_disk_select.py @@ -18,8 +18,8 @@ # Red Hat Author(s): Vendula Poncova # import unittest -import pytest +import pytest from blivet.devices import DiskDevice from blivet.formats import get_format from blivet.size import Size @@ -27,9 +27,11 @@ from pyanaconda.modules.common.constants.objects import DISK_SELECTION from pyanaconda.modules.common.errors.storage import UnavailableStorageError from pyanaconda.modules.common.structures.validation import ValidationReport -from pyanaconda.modules.storage.disk_selection import DiskSelectionModule -from pyanaconda.modules.storage.disk_selection.selection_interface import DiskSelectionInterface from pyanaconda.modules.storage.devicetree import create_storage +from pyanaconda.modules.storage.disk_selection import DiskSelectionModule +from pyanaconda.modules.storage.disk_selection.selection_interface import ( + DiskSelectionInterface, +) from tests.unit_tests.pyanaconda_tests import check_dbus_property diff --git a/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_fcoe.py b/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_fcoe.py index 58d0017778c..745f8cd1a07 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_fcoe.py +++ b/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_fcoe.py @@ -18,16 +18,19 @@ # Red Hat Author(s): Vendula Poncova # import unittest -import pytest - from unittest.mock import Mock, patch +import pytest + from pyanaconda.core.configuration.anaconda import conf from pyanaconda.modules.common.errors.configuration import StorageDiscoveryError from pyanaconda.modules.storage.fcoe import FCOEModule from pyanaconda.modules.storage.fcoe.discover import FCOEDiscoverTask from pyanaconda.modules.storage.fcoe.fcoe_interface import FCOEInterface -from tests.unit_tests.pyanaconda_tests import patch_dbus_publish_object, check_task_creation +from tests.unit_tests.pyanaconda_tests import ( + check_task_creation, + patch_dbus_publish_object, +) class FCOEInterfaceTestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_iscsi.py b/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_iscsi.py index 79d5ddb5447..7bb574b22ac 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_iscsi.py +++ b/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_iscsi.py @@ -22,14 +22,19 @@ from pyanaconda.core.configuration.anaconda import conf from pyanaconda.modules.common.constants.objects import ISCSI -from pyanaconda.modules.common.structures.iscsi import Portal, Credentials, Node +from pyanaconda.modules.common.structures.iscsi import Credentials, Node, Portal from pyanaconda.modules.storage.constants import IscsiInterfacesMode from pyanaconda.modules.storage.iscsi import ISCSIModule from pyanaconda.modules.storage.iscsi.discover import ISCSIDiscoverTask, ISCSILoginTask -from pyanaconda.modules.storage.iscsi.iscsi_interface import ISCSIInterface, \ - ISCSIDiscoverTaskInterface -from tests.unit_tests.pyanaconda_tests import patch_dbus_publish_object, check_task_creation, \ - check_dbus_property +from pyanaconda.modules.storage.iscsi.iscsi_interface import ( + ISCSIDiscoverTaskInterface, + ISCSIInterface, +) +from tests.unit_tests.pyanaconda_tests import ( + check_dbus_property, + check_task_creation, + patch_dbus_publish_object, +) class ISCSIInterfaceTestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_nvme.py b/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_nvme.py index 88468c6ead6..87ebbaa75fc 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_nvme.py +++ b/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_nvme.py @@ -18,7 +18,6 @@ # Red Hat Author(s): Vojtech Trefny # import unittest - from unittest.mock import patch from pyanaconda.core.configuration.anaconda import conf diff --git a/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_snapshot.py b/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_snapshot.py index 4691249642f..6c21ab79295 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_snapshot.py +++ b/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_snapshot.py @@ -18,14 +18,10 @@ # Red Hat Author(s): Vendula Poncova # import unittest -import pytest - -from unittest.mock import patch, Mock +from unittest.mock import Mock, patch +import pytest from blivet.errors import StorageError - -from tests.unit_tests.pyanaconda_tests import patch_dbus_publish_object, check_task_creation - from pykickstart.constants import SNAPSHOT_WHEN_POST_INSTALL, SNAPSHOT_WHEN_PRE_INSTALL from pyanaconda.modules.common.errors.storage import UnavailableStorageError @@ -33,6 +29,10 @@ from pyanaconda.modules.storage.snapshot.create import SnapshotCreateTask from pyanaconda.modules.storage.snapshot.device import get_snapshot_device from pyanaconda.modules.storage.snapshot.snapshot_interface import SnapshotInterface +from tests.unit_tests.pyanaconda_tests import ( + check_task_creation, + patch_dbus_publish_object, +) class SnapshotInterfaceTestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_storage.py b/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_storage.py index ef7bc8111d8..7d963bffd44 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_storage.py +++ b/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_storage.py @@ -21,50 +21,71 @@ import os import tempfile import unittest -import pytest - -from unittest.mock import patch, Mock, PropertyMock +from unittest.mock import Mock, PropertyMock, patch -from blivet.formats.fs import BTRFS +import pytest from blivet.devices import StorageDevice +from blivet.formats.fs import BTRFS +from dasbus.server.container import DBusContainerError from dasbus.typing import * # pylint: disable=wildcard-import from pykickstart.base import RemovedCommand from pykickstart.errors import KickstartParseError -from pyanaconda.modules.storage.bootloader import BootLoaderFactory -from pyanaconda.modules.storage.bootloader.extlinux import EXTLINUX -from pyanaconda.modules.storage.kickstart import StorageKickstartSpecification -from pyanaconda.core.constants import PARTITIONING_METHOD_AUTOMATIC, PARTITIONING_METHOD_MANUAL, \ - PARTITIONING_METHOD_INTERACTIVE, PARTITIONING_METHOD_CUSTOM -from dasbus.server.container import DBusContainerError +from pyanaconda.core.constants import ( + PARTITIONING_METHOD_AUTOMATIC, + PARTITIONING_METHOD_CUSTOM, + PARTITIONING_METHOD_INTERACTIVE, + PARTITIONING_METHOD_MANUAL, +) from pyanaconda.modules.common.constants.services import STORAGE from pyanaconda.modules.common.containers import PartitioningContainer +from pyanaconda.modules.common.errors.storage import InvalidStorageError +from pyanaconda.modules.common.task import TaskInterface +from pyanaconda.modules.storage.bootloader import BootLoaderFactory +from pyanaconda.modules.storage.bootloader.extlinux import EXTLINUX +from pyanaconda.modules.storage.bootloader.grub2 import GRUB2, IPSeriesGRUB2 +from pyanaconda.modules.storage.bootloader.zipl import ZIPL +from pyanaconda.modules.storage.checker.utils import StorageCheckerReport +from pyanaconda.modules.storage.devicetree import create_storage from pyanaconda.modules.storage.initialization import enable_installer_mode -from pyanaconda.modules.storage.partitioning.automatic.automatic_module import \ - AutoPartitioningModule -from pyanaconda.modules.storage.partitioning.manual.manual_module import ManualPartitioningModule +from pyanaconda.modules.storage.installation import ( + CreateStorageLayoutTask, + MountFilesystemsTask, + WriteConfigurationTask, +) +from pyanaconda.modules.storage.kickstart import ( + StorageKickstartSpecification, + fips_check_luks_passphrase, +) +from pyanaconda.modules.storage.partitioning.automatic.automatic_module import ( + AutoPartitioningModule, +) from pyanaconda.modules.storage.partitioning.base import PartitioningModule from pyanaconda.modules.storage.partitioning.constants import PartitioningMethod -from pyanaconda.modules.storage.partitioning.interactive.interactive_module import \ - InteractivePartitioningModule -from pyanaconda.modules.storage.devicetree import create_storage -from pyanaconda.modules.storage.platform import S390 -from tests.unit_tests.pyanaconda_tests import check_kickstart_interface, check_task_creation, \ - patch_dbus_publish_object, check_dbus_property, patch_dbus_get_proxy, \ - reset_boot_loader_factory, reset_dbus_container -from pyanaconda.modules.storage.bootloader.grub2 import IPSeriesGRUB2, GRUB2 -from pyanaconda.modules.storage.bootloader.zipl import ZIPL -from pyanaconda.modules.common.errors.storage import InvalidStorageError -from pyanaconda.modules.common.task import TaskInterface -from pyanaconda.modules.storage.installation import CreateStorageLayoutTask, \ - MountFilesystemsTask, WriteConfigurationTask +from pyanaconda.modules.storage.partitioning.interactive.interactive_module import ( + InteractivePartitioningModule, +) +from pyanaconda.modules.storage.partitioning.manual.manual_module import ( + ManualPartitioningModule, +) from pyanaconda.modules.storage.partitioning.validate import StorageValidateTask +from pyanaconda.modules.storage.platform import S390 from pyanaconda.modules.storage.reset import ScanDevicesTask from pyanaconda.modules.storage.storage import StorageService from pyanaconda.modules.storage.storage_interface import StorageInterface -from pyanaconda.modules.storage.teardown import UnmountFilesystemsTask, TeardownDiskImagesTask -from pyanaconda.modules.storage.checker.utils import StorageCheckerReport -from pyanaconda.modules.storage.kickstart import fips_check_luks_passphrase +from pyanaconda.modules.storage.teardown import ( + TeardownDiskImagesTask, + UnmountFilesystemsTask, +) +from tests.unit_tests.pyanaconda_tests import ( + check_dbus_property, + check_kickstart_interface, + check_task_creation, + patch_dbus_get_proxy, + patch_dbus_publish_object, + reset_boot_loader_factory, + reset_dbus_container, +) class StorageInterfaceTestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_storage_checker.py b/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_storage_checker.py index bfd936b0464..500dae2d578 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_storage_checker.py +++ b/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_storage_checker.py @@ -18,23 +18,27 @@ # Red Hat Author(s): Vendula Poncova # import unittest -import pytest - from functools import partial -from unittest.mock import patch, Mock, mock_open, PropertyMock +from unittest.mock import Mock, PropertyMock, mock_open, patch +import pytest from blivet.devices import StorageDevice from blivet.formats import get_format from blivet.formats.fs import XFS from blivet.size import Size -from dasbus.typing import get_variant, Int -from pyanaconda.core.constants import STORAGE_MIN_RAM, STORAGE_LUKS2_MIN_RAM +from dasbus.typing import Int, get_variant + +from pyanaconda.core.constants import STORAGE_LUKS2_MIN_RAM, STORAGE_MIN_RAM from pyanaconda.modules.common.errors.general import UnsupportedValueError from pyanaconda.modules.storage.checker import StorageCheckerModule from pyanaconda.modules.storage.checker.checker_interface import StorageCheckerInterface -from pyanaconda.modules.storage.checker.utils import storage_checker, verify_lvm_destruction, \ - verify_opal_compatibility, _get_opal_firmware_kernel_version, \ - _check_opal_firmware_kernel_version +from pyanaconda.modules.storage.checker.utils import ( + _check_opal_firmware_kernel_version, + _get_opal_firmware_kernel_version, + storage_checker, + verify_lvm_destruction, + verify_opal_compatibility, +) from pyanaconda.modules.storage.devicetree import create_storage diff --git a/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_zfcp.py b/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_zfcp.py index 1771dd89081..b440544cd48 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_zfcp.py +++ b/tests/unit_tests/pyanaconda_tests/modules/storage/test_module_zfcp.py @@ -18,16 +18,19 @@ # Red Hat Author(s): Vendula Poncova # import unittest -import pytest - from unittest.mock import patch +import pytest + from pyanaconda.core.configuration.anaconda import conf from pyanaconda.modules.common.errors.configuration import StorageDiscoveryError from pyanaconda.modules.storage.zfcp import ZFCPModule from pyanaconda.modules.storage.zfcp.discover import ZFCPDiscoverTask from pyanaconda.modules.storage.zfcp.zfcp_interface import ZFCPInterface -from tests.unit_tests.pyanaconda_tests import patch_dbus_publish_object, check_task_creation +from tests.unit_tests.pyanaconda_tests import ( + check_task_creation, + patch_dbus_publish_object, +) class ZFCPInterfaceTestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/modules/storage/test_platform.py b/tests/unit_tests/pyanaconda_tests/modules/storage/test_platform.py index c80e598837a..76db0318edb 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/storage/test_platform.py +++ b/tests/unit_tests/pyanaconda_tests/modules/storage/test_platform.py @@ -16,14 +16,27 @@ # Red Hat, Inc. # import unittest -import pytest from unittest.mock import patch +import pytest from blivet.devicelibs import raid from blivet.size import Size + from pyanaconda.modules.storage.partitioning.specification import PartSpec -from pyanaconda.modules.storage.platform import X86, get_platform, NewWorldPPC, IPSeriesPPC, \ - PowerNV, PS3, S390, ARM, Aarch64EFI, EFI, RISCV64, RISCV64EFI +from pyanaconda.modules.storage.platform import ( + ARM, + EFI, + PS3, + RISCV64, + RISCV64EFI, + S390, + X86, + Aarch64EFI, + IPSeriesPPC, + NewWorldPPC, + PowerNV, + get_platform, +) class PlatformTestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/modules/storage/test_storage_checker.py b/tests/unit_tests/pyanaconda_tests/modules/storage/test_storage_checker.py index 713657437b4..adbba76caa0 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/storage/test_storage_checker.py +++ b/tests/unit_tests/pyanaconda_tests/modules/storage/test_storage_checker.py @@ -19,10 +19,11 @@ # Red Hat Author(s): Vendula Poncova # import unittest -import pytest -import pyanaconda.modules.storage.checker.utils as checks +import pytest from blivet.size import Size + +import pyanaconda.modules.storage.checker.utils as checks from pyanaconda.modules.storage.checker.utils import StorageChecker diff --git a/tests/unit_tests/pyanaconda_tests/modules/subscription/test_rhsm_observer.py b/tests/unit_tests/pyanaconda_tests/modules/subscription/test_rhsm_observer.py index d97ba1f97c7..006ab64ca5d 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/subscription/test_rhsm_observer.py +++ b/tests/unit_tests/pyanaconda_tests/modules/subscription/test_rhsm_observer.py @@ -19,12 +19,11 @@ # import unittest -import pytest - -from unittest.mock import patch, Mock, PropertyMock +from unittest.mock import Mock, PropertyMock, patch -from dasbus.typing import get_variant, Str +import pytest from dasbus.client.observer import DBusObserverError +from dasbus.typing import Str, get_variant from pyanaconda.core.constants import RHSM_SERVICE_TIMEOUT from pyanaconda.modules.subscription.initialization import StartRHSMTask diff --git a/tests/unit_tests/pyanaconda_tests/modules/subscription/test_subscription.py b/tests/unit_tests/pyanaconda_tests/modules/subscription/test_subscription.py index f7f1c4d62c9..2233d833b5e 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/subscription/test_subscription.py +++ b/tests/unit_tests/pyanaconda_tests/modules/subscription/test_subscription.py @@ -18,30 +18,47 @@ # Red Hat Author(s): Martin Kolman # import unittest -from unittest.mock import patch, Mock +from unittest.mock import Mock, patch from dasbus.typing import * # pylint: disable=wildcard-import -from pyanaconda.core.constants import SECRET_TYPE_NONE, SECRET_TYPE_HIDDEN, SECRET_TYPE_TEXT, \ - SUBSCRIPTION_REQUEST_TYPE_USERNAME_PASSWORD, SUBSCRIPTION_REQUEST_TYPE_ORG_KEY, \ - DEFAULT_SUBSCRIPTION_REQUEST_TYPE - -from pyanaconda.modules.common.constants.services import SUBSCRIPTION +from pyanaconda.core.constants import ( + DEFAULT_SUBSCRIPTION_REQUEST_TYPE, + SECRET_TYPE_HIDDEN, + SECRET_TYPE_NONE, + SECRET_TYPE_TEXT, + SUBSCRIPTION_REQUEST_TYPE_ORG_KEY, + SUBSCRIPTION_REQUEST_TYPE_USERNAME_PASSWORD, +) from pyanaconda.modules.common.constants.objects import RHSM_CONFIG -from pyanaconda.modules.common.structures.subscription import SystemPurposeData, \ - SubscriptionRequest - +from pyanaconda.modules.common.constants.services import SUBSCRIPTION +from pyanaconda.modules.common.structures.subscription import ( + SubscriptionRequest, + SystemPurposeData, +) +from pyanaconda.modules.subscription.installation import ( + ConnectToInsightsTask, + ProvisionTargetSystemForSatelliteTask, + RestoreRHSMDefaultsTask, + TransferSubscriptionTokensTask, +) +from pyanaconda.modules.subscription.runtime import ( + RegisterAndSubscribeTask, + RetrieveOrganizationsTask, + SetRHSMConfigurationTask, + SystemPurposeConfigurationTask, + UnregisterTask, +) from pyanaconda.modules.subscription.subscription import SubscriptionService from pyanaconda.modules.subscription.subscription_interface import SubscriptionInterface -from pyanaconda.modules.subscription.installation import ConnectToInsightsTask, \ - RestoreRHSMDefaultsTask, TransferSubscriptionTokensTask, ProvisionTargetSystemForSatelliteTask -from pyanaconda.modules.subscription.runtime import SetRHSMConfigurationTask, \ - RegisterAndSubscribeTask, UnregisterTask, SystemPurposeConfigurationTask, \ - RetrieveOrganizationsTask - -from tests.unit_tests.pyanaconda_tests import check_kickstart_interface, check_dbus_property, \ - PropertiesChangedCallback, patch_dbus_publish_object, check_task_creation_list, \ - check_task_creation +from tests.unit_tests.pyanaconda_tests import ( + PropertiesChangedCallback, + check_dbus_property, + check_kickstart_interface, + check_task_creation, + check_task_creation_list, + patch_dbus_publish_object, +) class SubscriptionInterfaceTestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/modules/subscription/test_subscription_tasks.py b/tests/unit_tests/pyanaconda_tests/modules/subscription/test_subscription_tasks.py index 3a755d7200b..6628f112244 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/subscription/test_subscription_tasks.py +++ b/tests/unit_tests/pyanaconda_tests/modules/subscription/test_subscription_tasks.py @@ -17,45 +17,70 @@ # # Red Hat Author(s): Martin Kolman # -import os -import unittest -import pytest import json - -from unittest.mock import patch, Mock, call - +import os import tempfile +import unittest +from unittest.mock import Mock, call, patch -from dasbus.typing import get_variant, get_native, Str, Bool +import gi +import pytest from dasbus.error import DBusError +from dasbus.typing import Bool, Str, get_native, get_variant +from pyanaconda.core.constants import ( + RHSM_SYSPURPOSE_FILE_PATH, + SUBSCRIPTION_REQUEST_TYPE_ORG_KEY, + SUBSCRIPTION_REQUEST_TYPE_USERNAME_PASSWORD, +) from pyanaconda.core.path import join_paths -from pyanaconda.core.constants import SUBSCRIPTION_REQUEST_TYPE_ORG_KEY, \ - RHSM_SYSPURPOSE_FILE_PATH, SUBSCRIPTION_REQUEST_TYPE_USERNAME_PASSWORD - -from pyanaconda.modules.common.errors.installation import InsightsConnectError, \ - InsightsClientMissingError, SubscriptionTokenTransferError -from pyanaconda.modules.common.errors.subscription import RegistrationError, \ - SatelliteProvisioningError, MultipleOrganizationsError -from pyanaconda.modules.common.structures.subscription import SystemPurposeData, \ - SubscriptionRequest, OrganizationData +from pyanaconda.modules.common.constants.objects import ( + RHSM_CONFIG, + RHSM_REGISTER, + RHSM_UNREGISTER, +) from pyanaconda.modules.common.constants.services import RHSM -from pyanaconda.modules.common.constants.objects import RHSM_REGISTER, RHSM_UNREGISTER, \ - RHSM_CONFIG +from pyanaconda.modules.common.errors.installation import ( + InsightsClientMissingError, + InsightsConnectError, + SubscriptionTokenTransferError, +) +from pyanaconda.modules.common.errors.subscription import ( + MultipleOrganizationsError, + RegistrationError, + SatelliteProvisioningError, +) +from pyanaconda.modules.common.structures.subscription import ( + OrganizationData, + SubscriptionRequest, + SystemPurposeData, +) +from pyanaconda.modules.subscription.constants import ( + RHSM_SERVICE_NAME, + SERVER_HOSTNAME_NOT_SATELLITE_PREFIX, +) +from pyanaconda.modules.subscription.installation import ( + ConnectToInsightsTask, + ProvisionTargetSystemForSatelliteTask, + RestoreRHSMDefaultsTask, + TransferSubscriptionTokensTask, +) +from pyanaconda.modules.subscription.runtime import ( + BackupRHSMConfBeforeSatelliteProvisioningTask, + DownloadSatelliteProvisioningScriptTask, + ParseSubscriptionDataTask, + RegisterAndSubscribeTask, + RegisterWithOrganizationKeyTask, + RegisterWithUsernamePasswordTask, + RetrieveOrganizationsTask, + RHSMPrivateBus, + RollBackSatelliteProvisioningTask, + RunSatelliteProvisioningScriptTask, + SetRHSMConfigurationTask, + SystemPurposeConfigurationTask, + UnregisterTask, +) -from pyanaconda.modules.subscription.installation import ConnectToInsightsTask, \ - RestoreRHSMDefaultsTask, TransferSubscriptionTokensTask, ProvisionTargetSystemForSatelliteTask - -from pyanaconda.modules.subscription.runtime import SetRHSMConfigurationTask, \ - RHSMPrivateBus, RegisterWithUsernamePasswordTask, RegisterWithOrganizationKeyTask, \ - UnregisterTask, SystemPurposeConfigurationTask, \ - ParseSubscriptionDataTask, DownloadSatelliteProvisioningScriptTask, \ - RunSatelliteProvisioningScriptTask, BackupRHSMConfBeforeSatelliteProvisioningTask, \ - RollBackSatelliteProvisioningTask, RegisterAndSubscribeTask, RetrieveOrganizationsTask -from pyanaconda.modules.subscription.constants import SERVER_HOSTNAME_NOT_SATELLITE_PREFIX, \ - RHSM_SERVICE_NAME - -import gi gi.require_version("Gio", "2.0") from gi.repository import Gio diff --git a/tests/unit_tests/pyanaconda_tests/modules/subscription/test_system_purpose.py b/tests/unit_tests/pyanaconda_tests/modules/subscription/test_system_purpose.py index 967f095190b..1aefc90fd6b 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/subscription/test_system_purpose.py +++ b/tests/unit_tests/pyanaconda_tests/modules/subscription/test_system_purpose.py @@ -18,15 +18,20 @@ # Red Hat Author(s): Martin Kolman import os +import tempfile import unittest from unittest.mock import Mock -import tempfile -from dasbus.typing import * # pylint: disable=wildcard-import from dasbus.error import DBusError +from dasbus.typing import * # pylint: disable=wildcard-import -from pyanaconda.modules.subscription.system_purpose import get_valid_fields, _normalize_field, \ - _match_field, process_field, give_the_system_purpose +from pyanaconda.modules.subscription.system_purpose import ( + _match_field, + _normalize_field, + get_valid_fields, + give_the_system_purpose, + process_field, +) # content of a valid populated valid values json file for system purpose testing SYSPURPOSE_VALID_VALUES_JSON = """ diff --git a/tests/unit_tests/pyanaconda_tests/modules/timezone/test_module_timezone.py b/tests/unit_tests/pyanaconda_tests/modules/timezone/test_module_timezone.py index 14937d4bfb4..f7da1547cea 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/timezone/test_module_timezone.py +++ b/tests/unit_tests/pyanaconda_tests/modules/timezone/test_module_timezone.py @@ -18,28 +18,42 @@ # Red Hat Author(s): Vendula Poncova # import unittest -from unittest.mock import patch, MagicMock - from collections import OrderedDict +from unittest.mock import MagicMock, patch from dasbus.structure import compare_data from dasbus.typing import * # pylint: disable=wildcard-import -from pyanaconda.core.constants import TIME_SOURCE_SERVER, TIME_SOURCE_POOL, \ - TIMEZONE_PRIORITY_DEFAULT, TIMEZONE_PRIORITY_LANGUAGE, TIMEZONE_PRIORITY_GEOLOCATION, \ - TIMEZONE_PRIORITY_KICKSTART, TIMEZONE_PRIORITY_USER -from pyanaconda.timezone import get_timezone +from pyanaconda.core.constants import ( + TIME_SOURCE_POOL, + TIME_SOURCE_SERVER, + TIMEZONE_PRIORITY_DEFAULT, + TIMEZONE_PRIORITY_GEOLOCATION, + TIMEZONE_PRIORITY_KICKSTART, + TIMEZONE_PRIORITY_LANGUAGE, + TIMEZONE_PRIORITY_USER, +) from pyanaconda.modules.common.constants.services import TIMEZONE from pyanaconda.modules.common.structures.requirement import Requirement -from pyanaconda.modules.common.structures.timezone import TimeSourceData -from pyanaconda.modules.timezone.installation import ConfigureHardwareClockTask, \ - ConfigureNTPTask, ConfigureTimezoneTask -from pyanaconda.modules.common.structures.timezone import GeolocationData +from pyanaconda.modules.common.structures.timezone import ( + GeolocationData, + TimeSourceData, +) +from pyanaconda.modules.timezone.initialization import GeolocationTask +from pyanaconda.modules.timezone.installation import ( + ConfigureHardwareClockTask, + ConfigureNTPTask, + ConfigureTimezoneTask, +) from pyanaconda.modules.timezone.timezone import TimezoneService from pyanaconda.modules.timezone.timezone_interface import TimezoneInterface -from pyanaconda.modules.timezone.initialization import GeolocationTask -from tests.unit_tests.pyanaconda_tests import check_kickstart_interface, \ - patch_dbus_publish_object, check_task_creation_list, check_dbus_property +from pyanaconda.timezone import get_timezone +from tests.unit_tests.pyanaconda_tests import ( + check_dbus_property, + check_kickstart_interface, + check_task_creation_list, + patch_dbus_publish_object, +) class TimezoneInterfaceTestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/modules/timezone/test_timezone_geoloc.py b/tests/unit_tests/pyanaconda_tests/modules/timezone/test_timezone_geoloc.py index 639f5bc79d0..133a345be43 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/timezone/test_timezone_geoloc.py +++ b/tests/unit_tests/pyanaconda_tests/modules/timezone/test_timezone_geoloc.py @@ -16,8 +16,10 @@ # Red Hat, Inc. # from unittest import TestCase -from unittest.mock import patch, Mock +from unittest.mock import Mock, patch + from requests.exceptions import RequestException + from pyanaconda.core.constants import GEOLOC_URL_FEDORA_GEOIP, GEOLOC_URL_HOSTIP from pyanaconda.modules.common.structures.timezone import GeolocationData from pyanaconda.modules.timezone.initialization import GeolocationTask diff --git a/tests/unit_tests/pyanaconda_tests/modules/timezone/test_timezone_tasks.py b/tests/unit_tests/pyanaconda_tests/modules/timezone/test_timezone_tasks.py index 9b07daa74dd..90e7d499517 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/timezone/test_timezone_tasks.py +++ b/tests/unit_tests/pyanaconda_tests/modules/timezone/test_timezone_tasks.py @@ -20,16 +20,19 @@ import os import tempfile import unittest -import pytest - -from shutil import copytree, copyfile +from shutil import copyfile, copytree from unittest.mock import patch -from pyanaconda.core.constants import TIME_SOURCE_SERVER, TIME_SOURCE_POOL +import pytest + +from pyanaconda.core.constants import TIME_SOURCE_POOL, TIME_SOURCE_SERVER from pyanaconda.modules.common.errors.installation import TimezoneConfigurationError from pyanaconda.modules.common.structures.timezone import TimeSourceData -from pyanaconda.modules.timezone.installation import ConfigureHardwareClockTask, \ - ConfigureNTPTask, ConfigureTimezoneTask +from pyanaconda.modules.timezone.installation import ( + ConfigureHardwareClockTask, + ConfigureNTPTask, + ConfigureTimezoneTask, +) from pyanaconda.ntp import NTP_CONFIG_FILE, NTPconfigError diff --git a/tests/unit_tests/pyanaconda_tests/modules/users/test_module_users.py b/tests/unit_tests/pyanaconda_tests/modules/users/test_module_users.py index 4e63b39c044..09eb4861eb9 100644 --- a/tests/unit_tests/pyanaconda_tests/modules/users/test_module_users.py +++ b/tests/unit_tests/pyanaconda_tests/modules/users/test_module_users.py @@ -22,18 +22,29 @@ import unittest from textwrap import dedent -from tests.unit_tests.pyanaconda_tests import check_kickstart_interface, patch_dbus_publish_object, \ - PropertiesChangedCallback, check_dbus_property, check_task_creation_list, check_task_creation +from dasbus.typing import Bool, List, Str, UInt32, get_variant from pyanaconda.core.constants import ID_MODE_USE_DEFAULT, ID_MODE_USE_VALUE from pyanaconda.modules.common.constants.services import USERS -from pyanaconda.modules.common.structures.user import UserData from pyanaconda.modules.common.structures.group import GroupData +from pyanaconda.modules.common.structures.user import UserData +from pyanaconda.modules.users.installation import ( + ConfigureRootPasswordSSHLoginTask, + CreateGroupsTask, + CreateUsersTask, + SetRootPasswordTask, + SetSshKeysTask, +) from pyanaconda.modules.users.users import UsersService from pyanaconda.modules.users.users_interface import UsersInterface -from pyanaconda.modules.users.installation import ConfigureRootPasswordSSHLoginTask, \ - CreateGroupsTask, CreateUsersTask, SetRootPasswordTask, SetSshKeysTask -from dasbus.typing import get_variant, List, Str, UInt32, Bool +from tests.unit_tests.pyanaconda_tests import ( + PropertiesChangedCallback, + check_dbus_property, + check_kickstart_interface, + check_task_creation, + check_task_creation_list, + patch_dbus_publish_object, +) class UsersInterfaceTestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/test_argparse.py b/tests/unit_tests/pyanaconda_tests/test_argparse.py index 9cd2baba59d..dd4a2963292 100644 --- a/tests/unit_tests/pyanaconda_tests/test_argparse.py +++ b/tests/unit_tests/pyanaconda_tests/test_argparse.py @@ -16,13 +16,14 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # +import unittest + import pytest from pyanaconda import argument_parsing from pyanaconda.core.configuration.anaconda import AnacondaConfiguration -from pyanaconda.core.kernel import KernelArguments from pyanaconda.core.constants import DisplayModes -import unittest +from pyanaconda.core.kernel import KernelArguments class ArgparseTest(unittest.TestCase): @@ -87,6 +88,7 @@ def test_display_mode(self): def test_selinux(self): from pykickstart.constants import SELINUX_DISABLED, SELINUX_ENFORCING + from pyanaconda.core.constants import SELINUX_DEFAULT # with no arguments, use SELINUX_DEFAULT diff --git a/tests/unit_tests/pyanaconda_tests/test_controller.py b/tests/unit_tests/pyanaconda_tests/test_controller.py index b0b83315edd..1d8b735e020 100644 --- a/tests/unit_tests/pyanaconda_tests/test_controller.py +++ b/tests/unit_tests/pyanaconda_tests/test_controller.py @@ -22,6 +22,7 @@ from pyanaconda.lifecycle import Controller + class TestModule: def __init__(self): self._test = 1 diff --git a/tests/unit_tests/pyanaconda_tests/test_installation_tasks.py b/tests/unit_tests/pyanaconda_tests/test_installation_tasks.py index a3d302bfd24..1c373e24c8c 100644 --- a/tests/unit_tests/pyanaconda_tests/test_installation_tasks.py +++ b/tests/unit_tests/pyanaconda_tests/test_installation_tasks.py @@ -18,11 +18,9 @@ # with the express permission of Red Hat, Inc. # import unittest - from textwrap import dedent -from pyanaconda.installation_tasks import Task -from pyanaconda.installation_tasks import TaskQueue +from pyanaconda.installation_tasks import Task, TaskQueue class InstallTasksTestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/test_kexec.py b/tests/unit_tests/pyanaconda_tests/test_kexec.py index 8d4df2e3bee..715982c63d0 100644 --- a/tests/unit_tests/pyanaconda_tests/test_kexec.py +++ b/tests/unit_tests/pyanaconda_tests/test_kexec.py @@ -16,6 +16,7 @@ # Red Hat, Inc. # import unittest + from pyanaconda.kexec import unquote diff --git a/tests/unit_tests/pyanaconda_tests/test_keyboard.py b/tests/unit_tests/pyanaconda_tests/test_keyboard.py index 798732fafa4..e07aadf331a 100644 --- a/tests/unit_tests/pyanaconda_tests/test_keyboard.py +++ b/tests/unit_tests/pyanaconda_tests/test_keyboard.py @@ -15,11 +15,12 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -from pyanaconda import keyboard import unittest +from unittest.mock import patch + import pytest -from unittest.mock import patch +from pyanaconda import keyboard class KeyboardUtilsTestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/test_kickstart_specification.py b/tests/unit_tests/pyanaconda_tests/test_kickstart_specification.py index a4c1116b985..05055d4d6bc 100644 --- a/tests/unit_tests/pyanaconda_tests/test_kickstart_specification.py +++ b/tests/unit_tests/pyanaconda_tests/test_kickstart_specification.py @@ -18,36 +18,39 @@ # Red Hat Author(s): Vendula Poncova # import unittest -import pytest import warnings - from textwrap import dedent +import pytest from pykickstart.base import RemovedCommand -from pykickstart.errors import KickstartParseError from pykickstart.commands.skipx import FC3_SkipX -from pykickstart.commands.user import F24_User, F19_UserData +from pykickstart.commands.user import F19_UserData, F24_User +from pykickstart.errors import KickstartParseError from pykickstart.options import KSOptionParser from pykickstart.parser import Packages from pykickstart.sections import PackageSection -from pykickstart.version import F30, isRHEL as is_rhel +from pykickstart.version import F30 +from pykickstart.version import isRHEL as is_rhel from pyanaconda import kickstart from pyanaconda.core.kickstart.addon import AddonData, AddonRegistry +from pyanaconda.core.kickstart.specification import ( + KickstartSpecification, + KickstartSpecificationHandler, + KickstartSpecificationParser, +) from pyanaconda.core.kickstart.version import VERSION -from pyanaconda.core.kickstart.specification import KickstartSpecification,\ - KickstartSpecificationHandler, KickstartSpecificationParser from pyanaconda.kickstart import AnacondaKickstartSpecification from pyanaconda.modules.localization.kickstart import LocalizationKickstartSpecification from pyanaconda.modules.network.kickstart import NetworkKickstartSpecification from pyanaconda.modules.payloads.kickstart import PayloadKickstartSpecification +from pyanaconda.modules.runtime.kickstart import RuntimeKickstartSpecification from pyanaconda.modules.security.kickstart import SecurityKickstartSpecification from pyanaconda.modules.services.kickstart import ServicesKickstartSpecification from pyanaconda.modules.storage.kickstart import StorageKickstartSpecification from pyanaconda.modules.subscription.kickstart import SubscriptionKickstartSpecification from pyanaconda.modules.timezone.kickstart import TimezoneKickstartSpecification from pyanaconda.modules.users.kickstart import UsersKickstartSpecification -from pyanaconda.modules.runtime.kickstart import RuntimeKickstartSpecification class TestData1(AddonData): diff --git a/tests/unit_tests/pyanaconda_tests/test_ks_version.py b/tests/unit_tests/pyanaconda_tests/test_ks_version.py index 4548af462c8..2fd8a2afcd1 100644 --- a/tests/unit_tests/pyanaconda_tests/test_ks_version.py +++ b/tests/unit_tests/pyanaconda_tests/test_ks_version.py @@ -14,17 +14,19 @@ # # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see . -import unittest -import pytest import importlib import os import shutil import sys import tempfile +import unittest import warnings + +import pytest +from pykickstart.version import isRHEL as is_rhel + from pyanaconda import kickstart from pyanaconda.core.kickstart.version import VERSION -from pykickstart.version import isRHEL as is_rhel # Verify that each kickstart command in anaconda uses the correct version of diff --git a/tests/unit_tests/pyanaconda_tests/test_localization.py b/tests/unit_tests/pyanaconda_tests/test_localization.py index f43807ddcb1..f9c0540ba5c 100644 --- a/tests/unit_tests/pyanaconda_tests/test_localization.py +++ b/tests/unit_tests/pyanaconda_tests/test_localization.py @@ -17,10 +17,10 @@ # import locale as locale_mod import unittest -import pytest - -from unittest.mock import call, patch, MagicMock from io import StringIO +from unittest.mock import MagicMock, call, patch + +import pytest from pyanaconda import localization from pyanaconda.core.constants import DEFAULT_LANG diff --git a/tests/unit_tests/pyanaconda_tests/test_network.py b/tests/unit_tests/pyanaconda_tests/test_network.py index 6fbf5acfd28..46cac688f86 100644 --- a/tests/unit_tests/pyanaconda_tests/test_network.py +++ b/tests/unit_tests/pyanaconda_tests/test_network.py @@ -16,9 +16,10 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. -from pyanaconda import network import unittest +from pyanaconda import network + class NetworkTests(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/test_payload.py b/tests/unit_tests/pyanaconda_tests/test_payload.py index 501ee80cd04..b56b7f85ea8 100644 --- a/tests/unit_tests/pyanaconda_tests/test_payload.py +++ b/tests/unit_tests/pyanaconda_tests/test_payload.py @@ -23,9 +23,14 @@ import pytest import pyanaconda.core.payload as util -from pyanaconda.core.constants import SOURCE_TYPE_CDROM, SOURCE_TYPE_URL, SOURCE_TYPE_NFS, \ - SOURCE_TYPE_HDD, SOURCE_TYPE_HMC -from pyanaconda.core.payload import parse_hdd_url, create_hdd_url +from pyanaconda.core.constants import ( + SOURCE_TYPE_CDROM, + SOURCE_TYPE_HDD, + SOURCE_TYPE_HMC, + SOURCE_TYPE_NFS, + SOURCE_TYPE_URL, +) +from pyanaconda.core.payload import create_hdd_url, parse_hdd_url from pyanaconda.modules.common.constants.services import PAYLOADS from pyanaconda.modules.common.structures.payload import RepoConfigurationData from pyanaconda.payload.dnf import DNFPayload diff --git a/tests/unit_tests/pyanaconda_tests/test_secret_agent.py b/tests/unit_tests/pyanaconda_tests/test_secret_agent.py index e3f952fe83c..bd00f36a6a2 100644 --- a/tests/unit_tests/pyanaconda_tests/test_secret_agent.py +++ b/tests/unit_tests/pyanaconda_tests/test_secret_agent.py @@ -18,13 +18,14 @@ # Red Hat Author(s): Radek Vykydal # import unittest -from pyanaconda.ui.gui.spokes.lib.network_secret_agent import SecretAgent import gi + +from pyanaconda.ui.gui.spokes.lib.network_secret_agent import SecretAgent + gi.require_version("NM", "1.0") gi.require_version("GLib", "2.0") -from gi.repository import NM -from gi.repository import GLib +from gi.repository import NM, GLib class SecretAgentTestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/test_simple_import.py b/tests/unit_tests/pyanaconda_tests/test_simple_import.py index 27b824ead79..5ac608b8c3e 100644 --- a/tests/unit_tests/pyanaconda_tests/test_simple_import.py +++ b/tests/unit_tests/pyanaconda_tests/test_simple_import.py @@ -17,12 +17,12 @@ # # Red Hat Author(s): Vendula Poncova # -import pyanaconda import unittest - from importlib import import_module from pkgutil import walk_packages +import pyanaconda + class SimpleImportTestCase(unittest.TestCase): """Simple test case for pyanaconda. diff --git a/tests/unit_tests/pyanaconda_tests/test_subscription_helpers.py b/tests/unit_tests/pyanaconda_tests/test_subscription_helpers.py index 866279afb34..f5d8b7030ed 100644 --- a/tests/unit_tests/pyanaconda_tests/test_subscription_helpers.py +++ b/tests/unit_tests/pyanaconda_tests/test_subscription_helpers.py @@ -19,28 +19,39 @@ # import os import tempfile - import unittest -from unittest.mock import patch, Mock, MagicMock, call +from unittest.mock import MagicMock, Mock, call, patch from dasbus.typing import * # pylint: disable=wildcard-import +from pyanaconda.core.constants import ( + PAYLOAD_TYPE_DNF, + PAYLOAD_TYPE_RPM_OSTREE, + RHSM_SYSPURPOSE_FILE_PATH, + SOURCE_TYPE_CDN, + SOURCE_TYPE_CDROM, + SOURCE_TYPE_CLOSEST_MIRROR, + SOURCE_TYPE_URL, + SUBSCRIPTION_REQUEST_TYPE_ORG_KEY, + SUBSCRIPTION_REQUEST_TYPE_USERNAME_PASSWORD, + THREAD_WAIT_FOR_CONNECTING_NM, +) from pyanaconda.core.path import join_paths -from pyanaconda.core.constants import RHSM_SYSPURPOSE_FILE_PATH, \ - THREAD_WAIT_FOR_CONNECTING_NM, SUBSCRIPTION_REQUEST_TYPE_USERNAME_PASSWORD, \ - SUBSCRIPTION_REQUEST_TYPE_ORG_KEY, SOURCE_TYPE_CLOSEST_MIRROR, \ - SOURCE_TYPE_CDN, SOURCE_TYPE_CDROM, PAYLOAD_TYPE_DNF, PAYLOAD_TYPE_RPM_OSTREE, \ - SOURCE_TYPE_URL - -from pyanaconda.modules.common.errors.subscription import UnregistrationError, \ - RegistrationError, SatelliteProvisioningError -from pyanaconda.modules.common.structures.subscription import SubscriptionRequest - from pyanaconda.core.subscription import check_system_purpose_set - -from pyanaconda.ui.lib.subscription import SubscriptionPhase, \ - register_and_subscribe, unregister, org_keys_sufficient, \ - username_password_sufficient, check_cdn_is_installation_source +from pyanaconda.modules.common.errors.subscription import ( + RegistrationError, + SatelliteProvisioningError, + UnregistrationError, +) +from pyanaconda.modules.common.structures.subscription import SubscriptionRequest +from pyanaconda.ui.lib.subscription import ( + SubscriptionPhase, + check_cdn_is_installation_source, + org_keys_sufficient, + register_and_subscribe, + unregister, + username_password_sufficient, +) class CheckSystemPurposeSetTestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/test_timezone.py b/tests/unit_tests/pyanaconda_tests/test_timezone.py index 72cf134c1f2..82709f55806 100644 --- a/tests/unit_tests/pyanaconda_tests/test_timezone.py +++ b/tests/unit_tests/pyanaconda_tests/test_timezone.py @@ -16,10 +16,11 @@ # Red Hat, Inc. # import unittest - from collections import OrderedDict -from freezegun import freeze_time from unittest.mock import patch + +from freezegun import freeze_time + from pyanaconda import timezone diff --git a/tests/unit_tests/pyanaconda_tests/ui/test_common_code.py b/tests/unit_tests/pyanaconda_tests/ui/test_common_code.py index 098992b6341..de7f9633b15 100644 --- a/tests/unit_tests/pyanaconda_tests/ui/test_common_code.py +++ b/tests/unit_tests/pyanaconda_tests/ui/test_common_code.py @@ -19,9 +19,10 @@ # import unittest + from pyanaconda.core.i18n import _ -from pyanaconda.ui.common import sort_categories from pyanaconda.ui.categories import SpokeCategory +from pyanaconda.ui.common import sort_categories class AaaCategory(SpokeCategory): diff --git a/tests/unit_tests/pyanaconda_tests/ui/test_rdp.py b/tests/unit_tests/pyanaconda_tests/ui/test_rdp.py index f2b46195cbb..d55867f1c59 100644 --- a/tests/unit_tests/pyanaconda_tests/ui/test_rdp.py +++ b/tests/unit_tests/pyanaconda_tests/ui/test_rdp.py @@ -15,14 +15,14 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -import unittest import socket +import unittest +from contextlib import contextmanager +from unittest.mock import Mock, call, patch + import pytest from systemd import journal -from unittest.mock import patch, Mock, call -from contextlib import contextmanager - from pyanaconda import gnome_remote_desktop diff --git a/tests/unit_tests/pyanaconda_tests/ui/test_simple_ui.py b/tests/unit_tests/pyanaconda_tests/ui/test_simple_ui.py index 6a4348add5c..231ea81d7df 100644 --- a/tests/unit_tests/pyanaconda_tests/ui/test_simple_ui.py +++ b/tests/unit_tests/pyanaconda_tests/ui/test_simple_ui.py @@ -20,13 +20,12 @@ import os import re import unittest +from unittest.mock import Mock, create_autospec, patch -from unittest.mock import Mock, patch, create_autospec from pyanaconda.ui import UserInterface -from pyanaconda.ui.common import StandaloneSpoke, Hub, Screen +from pyanaconda.ui.common import Hub, Screen, StandaloneSpoke from tests.unit_tests.pyanaconda_tests import patch_dbus_get_proxy - # blivet-gui is supported on Fedora, but not ELN/CentOS/RHEL HAVE_BLIVET_GUI = os.path.exists("/usr/bin/blivet-gui") diff --git a/tests/unit_tests/pyanaconda_tests/ui/test_software.py b/tests/unit_tests/pyanaconda_tests/ui/test_software.py index 8bc02439db8..718f9f89f55 100644 --- a/tests/unit_tests/pyanaconda_tests/ui/test_software.py +++ b/tests/unit_tests/pyanaconda_tests/ui/test_software.py @@ -16,18 +16,25 @@ # Red Hat, Inc. # import unittest -from unittest.mock import patch -from unittest.mock import Mock +from unittest.mock import Mock, patch from dasbus.structure import compare_data -from pyanaconda.modules.common.structures.comps import CompsEnvironmentData, CompsGroupData +from pyanaconda.modules.common.structures.comps import ( + CompsEnvironmentData, + CompsGroupData, +) from pyanaconda.modules.common.structures.packages import PackagesSelectionData from pyanaconda.modules.payloads.payload.dnf.dnf import DNFModule from pyanaconda.modules.payloads.payload.dnf.dnf_manager import DNFManager -from pyanaconda.ui.lib.software import is_software_selection_complete, \ - get_software_selection_status, SoftwareSelectionCache, get_kernel_from_properties, \ - get_available_kernel_features, KernelFeatures +from pyanaconda.ui.lib.software import ( + KernelFeatures, + SoftwareSelectionCache, + get_available_kernel_features, + get_kernel_from_properties, + get_software_selection_status, + is_software_selection_complete, +) def get_dnf_proxy(dnf_manager): diff --git a/tests/unit_tests/pyanaconda_tests/ui/test_ui_custom_spoke.py b/tests/unit_tests/pyanaconda_tests/ui/test_ui_custom_spoke.py index a44b916084c..6e374fcf66c 100644 --- a/tests/unit_tests/pyanaconda_tests/ui/test_ui_custom_spoke.py +++ b/tests/unit_tests/pyanaconda_tests/ui/test_ui_custom_spoke.py @@ -15,15 +15,17 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -import unittest import copy +import unittest from textwrap import dedent from blivet import devicefactory from blivet.size import Size from pyanaconda.modules.common.structures.device_factory import DeviceFactoryRequest -from pyanaconda.ui.gui.spokes.lib.custom_storage_helpers import generate_request_description +from pyanaconda.ui.gui.spokes.lib.custom_storage_helpers import ( + generate_request_description, +) class CustomStorageHelpersTestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/ui/test_ui_payload.py b/tests/unit_tests/pyanaconda_tests/ui/test_ui_payload.py index 64ba821f549..6a1387b2fa4 100644 --- a/tests/unit_tests/pyanaconda_tests/ui/test_ui_payload.py +++ b/tests/unit_tests/pyanaconda_tests/ui/test_ui_payload.py @@ -18,10 +18,21 @@ import unittest from unittest.mock import patch -from pyanaconda.core.constants import PAYLOAD_TYPE_LIVE_OS, PAYLOAD_TYPE_DNF, SOURCE_TYPE_CDROM +from pyanaconda.core.constants import ( + PAYLOAD_TYPE_DNF, + PAYLOAD_TYPE_LIVE_OS, + SOURCE_TYPE_CDROM, +) from pyanaconda.modules.common.constants.services import PAYLOADS -from pyanaconda.ui.lib.payload import create_payload, get_payload, create_source, set_source, \ - get_source, set_up_sources, tear_down_sources +from pyanaconda.ui.lib.payload import ( + create_payload, + create_source, + get_payload, + get_source, + set_source, + set_up_sources, + tear_down_sources, +) from tests.unit_tests.pyanaconda_tests import patch_dbus_get_proxy_with_cache diff --git a/tests/unit_tests/pyanaconda_tests/ui/test_ui_source_spoke.py b/tests/unit_tests/pyanaconda_tests/ui/test_ui_source_spoke.py index 5c28af49c37..5cfc8f5ba6f 100644 --- a/tests/unit_tests/pyanaconda_tests/ui/test_ui_source_spoke.py +++ b/tests/unit_tests/pyanaconda_tests/ui/test_ui_source_spoke.py @@ -18,11 +18,17 @@ import unittest from textwrap import dedent -from pyanaconda.core.constants import REPO_ORIGIN_TREEINFO, REPO_ORIGIN_SYSTEM +from pyanaconda.core.constants import REPO_ORIGIN_SYSTEM, REPO_ORIGIN_TREEINFO from pyanaconda.modules.common.structures.payload import RepoConfigurationData -from pyanaconda.ui.gui.spokes.lib.installation_source_helpers import get_unique_repo_name, \ - validate_repo_name, validate_repo_url, validate_proxy, get_invalid_repository_message, \ - validate_additional_repositories, generate_repository_description +from pyanaconda.ui.gui.spokes.lib.installation_source_helpers import ( + generate_repository_description, + get_invalid_repository_message, + get_unique_repo_name, + validate_additional_repositories, + validate_proxy, + validate_repo_name, + validate_repo_url, +) from pyanaconda.ui.helpers import InputCheck diff --git a/tests/unit_tests/pyanaconda_tests/ui/test_ui_users.py b/tests/unit_tests/pyanaconda_tests/ui/test_ui_users.py index 002d6653266..8dee3778fd5 100644 --- a/tests/unit_tests/pyanaconda_tests/ui/test_ui_users.py +++ b/tests/unit_tests/pyanaconda_tests/ui/test_ui_users.py @@ -21,8 +21,12 @@ from dasbus.structure import compare_data from pyanaconda.modules.common.structures.user import UserData -from pyanaconda.ui.lib.users import get_user_list, set_user_list, can_modify_root_configuration, \ - get_root_configuration_status +from pyanaconda.ui.lib.users import ( + can_modify_root_configuration, + get_root_configuration_status, + get_user_list, + set_user_list, +) class UsersUITestCase(unittest.TestCase): diff --git a/tests/unit_tests/pyanaconda_tests/ui/test_webui.py b/tests/unit_tests/pyanaconda_tests/ui/test_webui.py index 7b4dc6cd819..f3ff0a51b43 100644 --- a/tests/unit_tests/pyanaconda_tests/ui/test_webui.py +++ b/tests/unit_tests/pyanaconda_tests/ui/test_webui.py @@ -15,16 +15,16 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -import unittest -import pytest -import tempfile import os +import tempfile +import unittest +from unittest.mock import Mock, patch +import pytest from meh.ui.text import TextIntf -from pyanaconda.ui.webui import CockpitUserInterface, FIREFOX_THEME_DEFAULT -from unittest.mock import Mock, patch from pyanaconda.core.constants import PAYLOAD_TYPE_DNF, PAYLOAD_TYPE_LIVE_IMAGE +from pyanaconda.ui.webui import FIREFOX_THEME_DEFAULT, CockpitUserInterface class SimpleWebUITestCase(unittest.TestCase): diff --git a/tests/unit_tests/regex_tests/test_dasd_name.py b/tests/unit_tests/regex_tests/test_dasd_name.py index f634bacced3..3a9a074b4b6 100644 --- a/tests/unit_tests/regex_tests/test_dasd_name.py +++ b/tests/unit_tests/regex_tests/test_dasd_name.py @@ -21,6 +21,7 @@ import unittest from regexcheck import regex_match + from pyanaconda.core.regexes import DASD_DEVICE_NUMBER diff --git a/tests/unit_tests/regex_tests/test_groupparse.py b/tests/unit_tests/regex_tests/test_groupparse.py index 36f2865fe12..4f3727c3c8d 100644 --- a/tests/unit_tests/regex_tests/test_groupparse.py +++ b/tests/unit_tests/regex_tests/test_groupparse.py @@ -19,8 +19,10 @@ import unittest from regexcheck import regex_group + from pyanaconda.core.regexes import GROUPLIST_FANCY_PARSE + class GroupParseTestCase(unittest.TestCase): def test_group_list(self): """Test a list of possible group-name (GID) values with the group diff --git a/tests/unit_tests/regex_tests/test_hostname.py b/tests/unit_tests/regex_tests/test_hostname.py index 76b9831c842..18a50b968f2 100644 --- a/tests/unit_tests/regex_tests/test_hostname.py +++ b/tests/unit_tests/regex_tests/test_hostname.py @@ -17,12 +17,17 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -import unittest import re +import unittest from regexcheck import regex_match -from pyanaconda.core.regexes import HOSTNAME_PATTERN_WITHOUT_ANCHORS, \ - IPV4_PATTERN_WITHOUT_ANCHORS, IPV6_PATTERN_WITHOUT_ANCHORS + +from pyanaconda.core.regexes import ( + HOSTNAME_PATTERN_WITHOUT_ANCHORS, + IPV4_PATTERN_WITHOUT_ANCHORS, + IPV6_PATTERN_WITHOUT_ANCHORS, +) + class HostnameRegexTestCase(unittest.TestCase): def test_hostname(self): diff --git a/tests/unit_tests/regex_tests/test_ibft_device_name.py b/tests/unit_tests/regex_tests/test_ibft_device_name.py index 4e9b1316390..21d87fcd546 100644 --- a/tests/unit_tests/regex_tests/test_ibft_device_name.py +++ b/tests/unit_tests/regex_tests/test_ibft_device_name.py @@ -23,6 +23,7 @@ from pyanaconda.core.regexes import IBFT_CONFIGURED_DEVICE_NAME + def _run_tests(testcase, expression, goodlist, badlist): got_error = False for good in goodlist: diff --git a/tests/unit_tests/regex_tests/test_initamfs_con_name.py b/tests/unit_tests/regex_tests/test_initamfs_con_name.py index 3359748431d..bce19c5f783 100644 --- a/tests/unit_tests/regex_tests/test_initamfs_con_name.py +++ b/tests/unit_tests/regex_tests/test_initamfs_con_name.py @@ -17,6 +17,7 @@ import unittest from regexcheck import regex_match + from pyanaconda.core.regexes import NM_MAC_INITRAMFS_CONNECTION diff --git a/tests/unit_tests/regex_tests/test_iscsi_name.py b/tests/unit_tests/regex_tests/test_iscsi_name.py index f0dcba673ba..5d9b8d113ed 100644 --- a/tests/unit_tests/regex_tests/test_iscsi_name.py +++ b/tests/unit_tests/regex_tests/test_iscsi_name.py @@ -17,7 +17,9 @@ import unittest from regexcheck import regex_match -from pyanaconda.core.regexes import ISCSI_IQN_NAME_REGEX, ISCSI_EUI_NAME_REGEX + +from pyanaconda.core.regexes import ISCSI_EUI_NAME_REGEX, ISCSI_IQN_NAME_REGEX + class iSCSIiqnnameRegexTestCase(unittest.TestCase): def test_iqnname(self): diff --git a/tests/unit_tests/regex_tests/test_netmask.py b/tests/unit_tests/regex_tests/test_netmask.py index 0a5e6fae907..682a750cae0 100644 --- a/tests/unit_tests/regex_tests/test_netmask.py +++ b/tests/unit_tests/regex_tests/test_netmask.py @@ -17,11 +17,12 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # -import unittest import re +import unittest from pyanaconda.core.regexes import IPV4_NETMASK_WITHOUT_ANCHORS + def _run_tests(testcase, expression, goodlist, badlist): errors = [] for good in goodlist: diff --git a/tests/unit_tests/regex_tests/test_repo_name.py b/tests/unit_tests/regex_tests/test_repo_name.py index d1de4f0615f..0d1a710fd2d 100644 --- a/tests/unit_tests/regex_tests/test_repo_name.py +++ b/tests/unit_tests/regex_tests/test_repo_name.py @@ -20,8 +20,10 @@ import unittest from regexcheck import regex_match + from pyanaconda.core.regexes import REPO_NAME_VALID + class RepoNameTestCase(unittest.TestCase): def test_reponame(self): good_tests = [ diff --git a/tests/unit_tests/regex_tests/test_url.py b/tests/unit_tests/regex_tests/test_url.py index 80959701f76..2b13f670256 100644 --- a/tests/unit_tests/regex_tests/test_url.py +++ b/tests/unit_tests/regex_tests/test_url.py @@ -19,8 +19,10 @@ import unittest from regexcheck import regex_group + from pyanaconda.core.regexes import URL_PARSE + class URLRegexTestCase(unittest.TestCase): def test_url_regex(self): """ diff --git a/tests/unit_tests/regex_tests/test_username.py b/tests/unit_tests/regex_tests/test_username.py index 13fcd570dd0..81abcb5578d 100644 --- a/tests/unit_tests/regex_tests/test_username.py +++ b/tests/unit_tests/regex_tests/test_username.py @@ -20,7 +20,9 @@ import unittest from regexcheck import regex_match -from pyanaconda.core.regexes import GECOS_VALID, NAME_VALID, GROUPLIST_SIMPLE_VALID + +from pyanaconda.core.regexes import GECOS_VALID, GROUPLIST_SIMPLE_VALID, NAME_VALID + class UsernameRegexTestCase(unittest.TestCase): def test_gecos(self): diff --git a/tests/unit_tests/regex_tests/test_zfcp_name.py b/tests/unit_tests/regex_tests/test_zfcp_name.py index be13a123dc9..1d671559544 100644 --- a/tests/unit_tests/regex_tests/test_zfcp_name.py +++ b/tests/unit_tests/regex_tests/test_zfcp_name.py @@ -21,6 +21,7 @@ import unittest from regexcheck import regex_match + from pyanaconda.core.regexes import ZFCP_LUN_NUMBER, ZFCP_WWPN_NUMBER diff --git a/translation-canary/tests/pylint/runpylint.py b/translation-canary/tests/pylint/runpylint.py index 76eac359be8..a17698807d4 100755 --- a/translation-canary/tests/pylint/runpylint.py +++ b/translation-canary/tests/pylint/runpylint.py @@ -1,8 +1,10 @@ #!/usr/bin/python3 import sys + from pocketlint import PocketLintConfig, PocketLinter + class TranslationCanaryLintConfig(PocketLintConfig): @property def disabledOptions(self): diff --git a/translation-canary/tests/unittests/test_translatable.py b/translation-canary/tests/unittests/test_translatable.py index ada5f67c57a..9c8e737a55a 100644 --- a/translation-canary/tests/unittests/test_translatable.py +++ b/translation-canary/tests/unittests/test_translatable.py @@ -16,15 +16,15 @@ # # Red Hat Author(s): David Shea +import tempfile import unittest import unittest.mock -from polib import POEntry, POFile -import tempfile -from translation_canary.translatable.test_markup import test_markup +from polib import POEntry, POFile +from translation_canary.translatable import testPOT, testString from translation_canary.translatable.test_comment import test_comment +from translation_canary.translatable.test_markup import test_markup -from translation_canary.translatable import testString, testPOT class TestMarkup(unittest.TestCase): def test_ok(self): diff --git a/translation-canary/tests/unittests/test_translated.py b/translation-canary/tests/unittests/test_translated.py index f38f6766832..16e866d2afb 100644 --- a/translation-canary/tests/unittests/test_translated.py +++ b/translation-canary/tests/unittests/test_translated.py @@ -16,18 +16,18 @@ # # Red Hat Author(s): David Shea +import os +import tempfile import unittest import unittest.mock -import tempfile import warnings -import polib -import os +import polib +from translation_canary.translated import testFile, testSourceTree from translation_canary.translated.test_markup import test_markup from translation_canary.translated.test_percentage import test_percentage -from translation_canary.translated.test_usability import test_usability, test_msgfmt +from translation_canary.translated.test_usability import test_msgfmt, test_usability -from translation_canary.translated import testFile, testSourceTree # convert a polib.POFile into a NamedTemporaryFile def pofile(poobj): diff --git a/translation-canary/translation_canary/translatable/__init__.py b/translation-canary/translation_canary/translatable/__init__.py index 15ead60c671..d6f006c70cc 100644 --- a/translation-canary/translation_canary/translatable/__init__.py +++ b/translation-canary/translation_canary/translatable/__init__.py @@ -35,8 +35,8 @@ raise # Gather tests from this directory -import pkgutil import importlib +import pkgutil _tests = [] for finder, mod_name, _ispkg in pkgutil.iter_modules(__path__): diff --git a/translation-canary/translation_canary/translatable/__main__.py b/translation-canary/translation_canary/translatable/__main__.py index 2c0787de3d0..bf27fe54976 100644 --- a/translation-canary/translation_canary/translatable/__main__.py +++ b/translation-canary/translation_canary/translatable/__main__.py @@ -19,6 +19,7 @@ # Red Hat Author(s): David Shea import sys + from . import testPOT if len(sys.argv) < 2: diff --git a/translation-canary/translation_canary/translatable/test_markup.py b/translation-canary/translation_canary/translatable/test_markup.py index 76ba75a3ffc..4db1f4fd02a 100644 --- a/translation-canary/translation_canary/translatable/test_markup.py +++ b/translation-canary/translation_canary/translatable/test_markup.py @@ -18,9 +18,11 @@ # # Red Hat Author(s): David Shea -from pocketlint.pangocheck import is_markup, markup_necessary import xml.etree.ElementTree as ET +from pocketlint.pangocheck import is_markup, markup_necessary + + def test_markup(poentry): # Unnecessary markup is markup applied to an entire string, such as # _("Bold Text"). This could be instead be translated as diff --git a/translation-canary/translation_canary/translated/__init__.py b/translation-canary/translation_canary/translated/__init__.py index c4e269f1631..61128468960 100644 --- a/translation-canary/translation_canary/translated/__init__.py +++ b/translation-canary/translation_canary/translated/__init__.py @@ -28,13 +28,14 @@ passes if it returns without raising an exception. """ -import os, warnings +import os +import warnings _tests = [] # Gather tests from this directory -import pkgutil import importlib +import pkgutil for finder, mod_name, _ispkg in pkgutil.iter_modules(__path__): # Skip __main__ diff --git a/translation-canary/translation_canary/translated/__main__.py b/translation-canary/translation_canary/translated/__main__.py index 0b9e4c1aff8..d6baa4080da 100644 --- a/translation-canary/translation_canary/translated/__main__.py +++ b/translation-canary/translation_canary/translated/__main__.py @@ -18,7 +18,9 @@ # # Red Hat Author(s): David Shea -import sys, argparse +import argparse +import sys + from . import testSourceTree ap = argparse.ArgumentParser(description='Validate translated strings') diff --git a/translation-canary/translation_canary/translated/test_markup.py b/translation-canary/translation_canary/translated/test_markup.py index 783f2b24669..4b3ee079d3b 100644 --- a/translation-canary/translation_canary/translated/test_markup.py +++ b/translation-canary/translation_canary/translated/test_markup.py @@ -27,9 +27,10 @@ print("You need to install the python-polib package to read translations") raise -from pocketlint.pangocheck import is_markup, markup_match import xml.etree.ElementTree as ET +from pocketlint.pangocheck import is_markup, markup_match + def test_markup(pofile): po = polib.pofile(pofile) diff --git a/translation-canary/translation_canary/translated/test_usability.py b/translation-canary/translation_canary/translated/test_usability.py index 5fbd43bd999..2352572df3e 100644 --- a/translation-canary/translation_canary/translated/test_usability.py +++ b/translation-canary/translation_canary/translated/test_usability.py @@ -22,9 +22,11 @@ # Red Hat Author(s): David Shea import gettext +import subprocess import tempfile + import polib -import subprocess + def test_usability(pofile): # Use polib to write a mofile