Skip to content

Commit

Permalink
Fix new ruff errors
Browse files Browse the repository at this point in the history
  • Loading branch information
adamkankovsky committed Nov 27, 2024
1 parent 62b17b1 commit 01cffcc
Show file tree
Hide file tree
Showing 58 changed files with 175 additions and 97 deletions.
2 changes: 1 addition & 1 deletion pyanaconda/core/configuration/anaconda.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

log = get_module_logger(__name__)

__all__ = ["conf", "AnacondaConfiguration"]
__all__ = ["AnacondaConfiguration", "conf"]


class AnacondaSection(Section):
Expand Down
2 changes: 1 addition & 1 deletion pyanaconda/core/dbus.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

log = get_module_logger(__name__)

__all__ = ["DBus", "SystemBus", "SessionBus", "error_mapper", "dbus_error"]
__all__ = ["DBus", "SessionBus", "SystemBus", "dbus_error", "error_mapper"]


class AnacondaMessageBus(MessageBus):
Expand Down
40 changes: 29 additions & 11 deletions pyanaconda/core/glib.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,35 @@
log = get_module_logger(__name__)


__all__ = ["create_main_loop", "create_new_context",
"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",
"GError", "Variant", "VariantType", "Bytes",
"IOCondition", "IOChannel", "SpawnFlags",
"LogWriterOutput", "LogLevelFlags",
"MAXUINT", "Cancellable"]
__all__ = [
"MAXUINT",
"Bytes",
"Cancellable",
"GError",
"IOChannel",
"IOCondition",
"LogLevelFlags",
"LogWriterOutput",
"SpawnFlags",
"Variant",
"VariantType",
"child_watch_add",
"create_main_loop",
"create_new_context",
"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",
]


def create_main_loop(main_context=None):
Expand Down
2 changes: 1 addition & 1 deletion pyanaconda/core/i18n.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# Red Hat, Inc.
#

__all__ = ["_", "N_", "P_", "C_", "CN_", "CP_"]
__all__ = ["CN_", "CP_", "C_", "N_", "P_", "_"]

import gettext

Expand Down
2 changes: 1 addition & 1 deletion pyanaconda/core/kickstart/addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

log = get_module_logger(__name__)

__all__ = ["AddonData", "AddonSection", "AddonRegistry"]
__all__ = ["AddonData", "AddonRegistry", "AddonSection"]


class AddonData(KickstartObject, metaclass=ABCMeta):
Expand Down
8 changes: 6 additions & 2 deletions pyanaconda/core/kickstart/specification.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,12 @@
from pyanaconda.core.kickstart.version import VERSION
from pyanaconda.core.kickstart.addon import AddonSection, AddonRegistry

__all__ = ["KickstartSpecification", "NoKickstartSpecification",
"KickstartSpecificationHandler", "KickstartSpecificationParser"]
__all__ = [
"KickstartSpecification",
"KickstartSpecificationHandler",
"KickstartSpecificationParser",
"NoKickstartSpecification",
]


class KickstartSpecification(object):
Expand Down
11 changes: 9 additions & 2 deletions pyanaconda/core/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,15 @@

log = get_module_logger(__name__)

__all__ = ["start_service", "stop_service", "restart_service", "is_service_running",
"is_service_installed", "enable_service", "disable_service"]
__all__ = [
"disable_service",
"enable_service",
"is_service_installed",
"is_service_running",
"restart_service",
"start_service",
"stop_service",
]


def _run_systemctl(command, service, root):
Expand Down
2 changes: 1 addition & 1 deletion pyanaconda/modules/boss/kickstart_manager/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

__all__ = ["SplitKickstartParser", "VALID_SECTIONS_ANACONDA"]
__all__ = ["VALID_SECTIONS_ANACONDA", "SplitKickstartParser"]

from pykickstart.parser import KickstartParser
from pykickstart.sections import Section
Expand Down
12 changes: 9 additions & 3 deletions pyanaconda/modules/common/base/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@
from pyanaconda.modules.common.base.base_template import ModuleInterfaceTemplate, \
KickstartModuleInterfaceTemplate

__all__ = ["BaseModule", "Service", "KickstartBaseModule", "KickstartService",
"ModuleInterfaceTemplate", "KickstartModuleInterfaceTemplate",
"KickstartModuleInterface"]
__all__ = [
"BaseModule",
"KickstartBaseModule",
"KickstartModuleInterface",
"KickstartModuleInterfaceTemplate",
"KickstartService",
"ModuleInterfaceTemplate",
"Service",
]
2 changes: 1 addition & 1 deletion pyanaconda/modules/common/base/base_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

from dasbus.server.template import InterfaceTemplate

__all__ = ["InterfaceTemplate", "ModuleInterfaceTemplate", "KickstartModuleInterfaceTemplate"]
__all__ = ["InterfaceTemplate", "KickstartModuleInterfaceTemplate", "ModuleInterfaceTemplate"]


class ModuleInterfaceTemplate(InterfaceTemplate):
Expand Down
2 changes: 1 addition & 1 deletion pyanaconda/modules/common/structures/comps.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from dasbus.structure import DBusData
from dasbus.typing import * # pylint: disable=wildcard-import

__all__ = ["CompsGroupData", "CompsEnvironmentData"]
__all__ = ["CompsEnvironmentData", "CompsGroupData"]


class CompsGroupData(DBusData):
Expand Down
2 changes: 1 addition & 1 deletion pyanaconda/modules/common/structures/device_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from dasbus.structure import DBusData
from dasbus.typing import * # pylint: disable=wildcard-import

__all__ = ["DeviceFactoryRequest", "DeviceFactoryPermissions"]
__all__ = ["DeviceFactoryPermissions", "DeviceFactoryRequest"]


class DeviceFactoryRequest(DBusData):
Expand Down
2 changes: 1 addition & 1 deletion pyanaconda/modules/common/structures/iscsi.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from dasbus.structure import DBusData
from dasbus.typing import * # pylint: disable=wildcard-import

__all__ = ["Portal", "Credentials", "Node"]
__all__ = ["Credentials", "Node", "Portal"]


class Portal(DBusData):
Expand Down
2 changes: 1 addition & 1 deletion pyanaconda/modules/common/structures/packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from pyanaconda.core.constants import MULTILIB_POLICY_BEST, RPM_LANGUAGES_ALL, \
DNF_DEFAULT_TIMEOUT, DNF_DEFAULT_RETRIES

__all__ = ["PackagesSelectionData", "PackagesConfigurationData"]
__all__ = ["PackagesConfigurationData", "PackagesSelectionData"]


class PackagesSelectionData(DBusData):
Expand Down
2 changes: 1 addition & 1 deletion pyanaconda/modules/common/structures/partitioning.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

from pyanaconda.core.configuration.anaconda import conf

__all__ = ["PartitioningRequest", "MountPointRequest"]
__all__ = ["MountPointRequest", "PartitioningRequest"]


class PartitioningRequest(DBusData):
Expand Down
2 changes: 1 addition & 1 deletion pyanaconda/modules/common/structures/secret.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

log = get_module_logger(__name__)

__all__ = ["get_public_copy", "hide_secrets", "SecretData", "SecretDataList"]
__all__ = ["SecretData", "SecretDataList", "get_public_copy", "hide_secrets"]


def get_public_copy(obj: DBusData):
Expand Down
2 changes: 1 addition & 1 deletion pyanaconda/modules/common/structures/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from dasbus.structure import DBusData
from dasbus.typing import * # pylint: disable=wildcard-import

__all__ = ["DeviceData", "DeviceFormatData", "DeviceActionData", "OSData"]
__all__ = ["DeviceActionData", "DeviceData", "DeviceFormatData", "OSData"]


class DeviceData(DBusData):
Expand Down
2 changes: 1 addition & 1 deletion pyanaconda/modules/common/structures/subscription.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

from pyanaconda.modules.common.structures.secret import SecretData, SecretDataList

__all__ = ["SystemPurposeData", "SubscriptionRequest", "AttachedSubscription"]
__all__ = ["AttachedSubscription", "SubscriptionRequest", "SystemPurposeData"]


class SystemPurposeData(DBusData):
Expand Down
2 changes: 1 addition & 1 deletion pyanaconda/modules/common/structures/timezone.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

from pyanaconda.core.constants import TIME_SOURCE_SERVER

__all__ = ["TimeSourceData", "GeolocationData"]
__all__ = ["GeolocationData", "TimeSourceData"]


class TimeSourceData(DBusData):
Expand Down
11 changes: 9 additions & 2 deletions pyanaconda/modules/common/task/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,15 @@
from pyanaconda.modules.common.task.task_interface import TaskInterface
from pyanaconda.modules.common.task.task import Task, ValidationTask, AbstractTask

__all__ = ["sync_run_task", "async_run_task", "wait_for_task", "AbstractTask", "Task",
"ValidationTask", "TaskInterface"]
__all__ = [
"AbstractTask",
"Task",
"TaskInterface",
"ValidationTask",
"async_run_task",
"sync_run_task",
"wait_for_task",
]


def sync_run_task(task_proxy, callback=None):
Expand Down
6 changes: 3 additions & 3 deletions pyanaconda/modules/network/config_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from pyanaconda.anaconda_loggers import get_module_logger
log = get_module_logger(__name__)

__all__ = ["get_config_files_content", "is_config_file_for_system", "IFCFG_DIR", "KEYFILE_DIR"]
__all__ = ["IFCFG_DIR", "KEYFILE_DIR", "get_config_files_content", "is_config_file_for_system"]

IFCFG_DIR = "/etc/sysconfig/network-scripts"
KEYFILE_DIR = "/etc/NetworkManager/system-connections"
Expand Down Expand Up @@ -58,8 +58,8 @@ def get_config_files_paths(root_path=""):
def is_config_file_for_system(filename):
"""Checks if the file stores configuration for target system."""
dirname = os.path.dirname(filename)
return (dirname == IFCFG_DIR and _has_ifcfg_basename(filename) or
dirname == KEYFILE_DIR and _has_keyfile_basename(filename))
return ((dirname == IFCFG_DIR and _has_ifcfg_basename(filename)) or
(dirname == KEYFILE_DIR and _has_keyfile_basename(filename)))


def _has_ifcfg_basename(name):
Expand Down
4 changes: 2 additions & 2 deletions pyanaconda/modules/network/kickstart.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ def update_first_network_command_activate_value(network_data_list):


def is_hostname_only_network_args(args):
return (len(args) == 1 and args[0].startswith("--hostname") or
len(args) == 2 and "--hostname" in args)
return ((len(args) == 1 and args[0].startswith("--hostname")) or
(len(args) == 2 and "--hostname" in args))


def is_hostname_only_network_data(network_data):
Expand Down
2 changes: 1 addition & 1 deletion pyanaconda/modules/payloads/installation.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

log = get_module_logger(__name__)

__all__ = ["PrepareSystemForInstallationTask", "CopyDriverDisksFilesTask"]
__all__ = ["CopyDriverDisksFilesTask", "PrepareSystemForInstallationTask"]


class PrepareSystemForInstallationTask(Task):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

log = get_module_logger(__name__)

__all__ = ["process_transaction_progress", "TransactionProgress"]
__all__ = ["TransactionProgress", "process_transaction_progress"]


def process_transaction_progress(queue, callback):
Expand Down
6 changes: 3 additions & 3 deletions pyanaconda/modules/payloads/payload/dnf/tree_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@
log = get_module_logger(__name__)

__all__ = [
"TreeInfoMetadataError",
"NoTreeInfoError",
"InvalidTreeInfoError",
"TreeInfoMetadata",
"LoadTreeInfoMetadataResult",
"LoadTreeInfoMetadataTask",
"NoTreeInfoError",
"TreeInfoMetadata",
"TreeInfoMetadataError",
]


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ def _run(self):
# actually EFI (simulating grub2-efi being installed). Second, as it's a mount point
# that's expected to already exist (so if we used copytree, we'd traceback). If it
# doesn't, we're not on a UEFI system, so we don't want to copy the data.
if not fname == 'efi' or is_efi and os.path.isdir(os.path.join(physboot, fname)):
if not fname == 'efi' or (is_efi and os.path.isdir(os.path.join(physboot, fname))):
log.info("Copying bootloader data: %s", fname)
safe_exec_with_redirect('cp', ['-r', '-p', srcpath, physboot])

Expand Down
4 changes: 2 additions & 2 deletions pyanaconda/modules/payloads/source/nfs/initialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
log = get_module_logger(__name__)

__all__ = [
"SetUpNFSSourceTask",
"SetUpNFSSourceResult"
"SetUpNFSSourceResult",
"SetUpNFSSourceTask"
]

SetUpNFSSourceResult = namedtuple(
Expand Down
2 changes: 1 addition & 1 deletion pyanaconda/modules/payloads/source/source_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
from pyanaconda.modules.payloads.source.utils import MountPointGenerator

__all__ = [
"PayloadSourceBase",
"MountingSourceMixin",
"PayloadSourceBase",
"RPMSourceMixin",
"RepositorySourceMixin"
]
Expand Down
8 changes: 6 additions & 2 deletions pyanaconda/modules/services/installation.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@
from pyanaconda.anaconda_loggers import get_module_logger
log = get_module_logger(__name__)

__all__ = ["ConfigureInitialSetupTask", "ConfigureServicesTask",
"ConfigureSystemdDefaultTargetTask", "ConfigureDefaultDesktopTask"]
__all__ = [
"ConfigureDefaultDesktopTask",
"ConfigureInitialSetupTask",
"ConfigureServicesTask",
"ConfigureSystemdDefaultTargetTask",
]


class ConfigureInitialSetupTask(Task):
Expand Down
2 changes: 1 addition & 1 deletion pyanaconda/modules/storage/bootloader/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

log = get_module_logger(__name__)

__all__ = ["BootLoaderError", "BootLoaderArguments", "BootLoader"]
__all__ = ["BootLoader", "BootLoaderArguments", "BootLoaderError"]


def _is_on_sw_iscsi(device):
Expand Down
3 changes: 2 additions & 1 deletion pyanaconda/modules/storage/bootloader/efi.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
from pyanaconda.anaconda_loggers import get_module_logger
log = get_module_logger(__name__)

__all__ = ["EFIBase", "EFIGRUB", "Aarch64EFIGRUB", "ArmEFIGRUB", "Aarch64EFISystemdBoot", "X64EFISystemdBoot"]
__all__ = ["EFIGRUB", "Aarch64EFIGRUB", "Aarch64EFISystemdBoot",
"ArmEFIGRUB", "EFIBase", "X64EFISystemdBoot"]


class EFIBase(object):
Expand Down
13 changes: 10 additions & 3 deletions pyanaconda/modules/storage/bootloader/installation.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,16 @@
log = get_module_logger(__name__)


__all__ = ["ConfigureBootloaderTask", "InstallBootloaderTask", "FixBTRFSBootloaderTask",
"FixZIPLBootloaderTask", "RecreateInitrdsTask", "CreateRescueImagesTask",
"CreateBLSEntriesTask", "CollectKernelArgumentsTask"]
__all__ = [
"CollectKernelArgumentsTask",
"ConfigureBootloaderTask",
"CreateBLSEntriesTask",
"CreateRescueImagesTask",
"FixBTRFSBootloaderTask",
"FixZIPLBootloaderTask",
"InstallBootloaderTask",
"RecreateInitrdsTask",
]


class CreateRescueImagesTask(Task):
Expand Down
Loading

0 comments on commit 01cffcc

Please sign in to comment.