From 2abc41bb019a0ebef73e48f2a50990d8e5038e51 Mon Sep 17 00:00:00 2001 From: Tomas Fratrik Date: Mon, 18 Aug 2025 15:16:36 +0200 Subject: [PATCH 41/55] pylint: enable super-with-arguments Jira: RHELMISC-16038 --- .pylintrc | 1 - .../unit_test_applytransactionworkarounds.py | 2 +- .../common/files/rhel_upgrade.py | 4 +-- .../common/libraries/mounting.py | 28 +++++++++++-------- .../common/libraries/repofileutils.py | 2 +- 5 files changed, 20 insertions(+), 17 deletions(-) diff --git a/.pylintrc b/.pylintrc index 0cba1129..4cfc49e0 100644 --- a/.pylintrc +++ b/.pylintrc @@ -40,7 +40,6 @@ disable= too-many-positional-arguments, # new for python3 version of pylint unnecessary-pass, - super-with-arguments, # required in python 2 raise-missing-from, # no 'raise from' in python 2 use-a-generator, # cannot be modified because of Python2 support consider-using-f-string, # sorry, not gonna happen, still have to support py2 diff --git a/repos/system_upgrade/common/actors/applytransactionworkarounds/tests/unit_test_applytransactionworkarounds.py b/repos/system_upgrade/common/actors/applytransactionworkarounds/tests/unit_test_applytransactionworkarounds.py index 369514fc..96b8094f 100644 --- a/repos/system_upgrade/common/actors/applytransactionworkarounds/tests/unit_test_applytransactionworkarounds.py +++ b/repos/system_upgrade/common/actors/applytransactionworkarounds/tests/unit_test_applytransactionworkarounds.py @@ -7,7 +7,7 @@ from leapp.models import DNFWorkaround class ShowMessageCurrentActorMocked(CurrentActorMocked): def __init__(self, *args, **kwargs): - super(ShowMessageCurrentActorMocked, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self._show_messages = [] @property diff --git a/repos/system_upgrade/common/files/rhel_upgrade.py b/repos/system_upgrade/common/files/rhel_upgrade.py index a5d7045b..63910fe0 100644 --- a/repos/system_upgrade/common/files/rhel_upgrade.py +++ b/repos/system_upgrade/common/files/rhel_upgrade.py @@ -40,7 +40,7 @@ class RhelUpgradeCommand(dnf.cli.Command): summary = 'Plugin for upgrading to the next RHEL major release' def __init__(self, cli): - super(RhelUpgradeCommand, self).__init__(cli) + super().__init__(cli) self.plugin_data = {} @staticmethod @@ -225,6 +225,6 @@ class RhelUpgradePlugin(dnf.Plugin): name = 'rhel-upgrade' def __init__(self, base, cli): - super(RhelUpgradePlugin, self).__init__(base, cli) + super().__init__(base, cli) if cli: cli.register_command(RhelUpgradeCommand) diff --git a/repos/system_upgrade/common/libraries/mounting.py b/repos/system_upgrade/common/libraries/mounting.py index ae3885cf..279d31dc 100644 --- a/repos/system_upgrade/common/libraries/mounting.py +++ b/repos/system_upgrade/common/libraries/mounting.py @@ -46,7 +46,7 @@ class MountError(Exception): """ Exception that is thrown when a mount related operation failed """ def __init__(self, message, details): - super(MountError, self).__init__(message) + super().__init__(message) self.details = details @@ -75,7 +75,7 @@ class IsolationType: """ systemd-nspawn implementation """ def __init__(self, target, binds=(), env_vars=None): - super(IsolationType.NSPAWN, self).__init__(target=target) + super().__init__(target=target) self.binds = list(binds) + ALWAYS_BIND self.env_vars = env_vars or get_all_envs() @@ -98,7 +98,7 @@ class IsolationType: """ chroot implementation """ def __init__(self, target): - super(IsolationType.CHROOT, self).__init__(target) + super().__init__(target) self.context = None def create(self): @@ -262,14 +262,14 @@ class ChrootActions(IsolatedActions): """ Isolation with chroot """ def __init__(self, base_dir): - super(ChrootActions, self).__init__(base_dir=base_dir, implementation=IsolationType.CHROOT) + super().__init__(base_dir=base_dir, implementation=IsolationType.CHROOT) class NspawnActions(IsolatedActions): """ Isolation with systemd-nspawn """ def __init__(self, base_dir, binds=(), env_vars=None): - super(NspawnActions, self).__init__( + super().__init__( base_dir=base_dir, implementation=IsolationType.NSPAWN, binds=binds, env_vars=env_vars) @@ -278,7 +278,7 @@ class NotIsolatedActions(IsolatedActions): _isolated = False def __init__(self, base_dir): - super(NotIsolatedActions, self).__init__(base_dir=base_dir, implementation=IsolationType.NONE) + super().__init__(base_dir=base_dir, implementation=IsolationType.NONE) class MountConfig: @@ -375,7 +375,7 @@ class NullMount(MountingBase): """ This is basically a NoOp for compatibility with other mount operations, in case a mount is optional """ def __init__(self, target, config=MountConfig.AttachOnly): - super(NullMount, self).__init__(source=target, target=target, mode=MountingMode.NONE, config=config) + super().__init__(source=target, target=target, mode=MountingMode.NONE, config=config) def __enter__(self): return self @@ -388,21 +388,21 @@ class LoopMount(MountingBase): """ Performs loop mounts """ def __init__(self, source, target, config=MountConfig.Mount): - super(LoopMount, self).__init__(source=source, target=target, mode=MountingMode.LOOP, config=config) + super().__init__(source=source, target=target, mode=MountingMode.LOOP, config=config) class BindMount(MountingBase): """ Performs bind mounts """ def __init__(self, source, target, config=MountConfig.Mount): - super(BindMount, self).__init__(source=source, target=target, mode=MountingMode.BIND, config=config) + super().__init__(source=source, target=target, mode=MountingMode.BIND, config=config) class TypedMount(MountingBase): """ Performs a typed mounts """ def __init__(self, fstype, source, target, config=MountConfig.Mount): - super(TypedMount, self).__init__(source=source, target=target, mode=MountingMode.FSTYPE, config=config) + super().__init__(source=source, target=target, mode=MountingMode.FSTYPE, config=config) self.fstype = fstype def _mount_options(self): @@ -416,8 +416,12 @@ class OverlayMount(MountingBase): """ Performs an overlayfs mount """ def __init__(self, name, source, workdir, config=MountConfig.Mount): - super(OverlayMount, self).__init__(source=source, target=os.path.join(workdir, name), - mode=MountingMode.OVERLAY, config=config) + super().__init__( + source=source, + target=os.path.join(workdir, name), + mode=MountingMode.OVERLAY, + config=config + ) self._upper_dir = os.path.join(workdir, 'upper') self._work_dir = os.path.join(workdir, 'work') self.additional_directories = (self._upper_dir, self._work_dir) diff --git a/repos/system_upgrade/common/libraries/repofileutils.py b/repos/system_upgrade/common/libraries/repofileutils.py index cab3c42b..376473a4 100644 --- a/repos/system_upgrade/common/libraries/repofileutils.py +++ b/repos/system_upgrade/common/libraries/repofileutils.py @@ -16,7 +16,7 @@ class InvalidRepoDefinition(Exception): def __init__(self, msg, repofile, repoid): message = 'Invalid repository definition: {repoid} in: {repofile}: {msg}'.format( repoid=repoid, repofile=repofile, msg=msg) - super(InvalidRepoDefinition, self).__init__(message) + super().__init__(message) self.repofile = repofile self.repoid = repoid -- 2.51.1