[elbe-devel] [PATCH] treewide: unify calls to super methods

Thomas Weißschuh thomas.weissschuh at linutronix.de
Mon Aug 19 11:28:58 CEST 2024


super() has various advantages over its open-coded variants. It
* always picks the correct superclass
* has obvious semantics
* needs less characters

Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
 elbepack/aptpkgutils.py                 | 28 ++++++++++-----------
 elbepack/aptprogress.py                 |  6 ++---
 elbepack/asyncworker.py                 | 26 ++++++++++----------
 elbepack/commands/parselicence.py       |  2 +-
 elbepack/daemons/soap/__init__.py       |  2 +-
 elbepack/daemons/soap/authentication.py |  6 ++---
 elbepack/daemons/soap/esoap.py          | 16 ++++--------
 elbepack/db.py                          |  5 ++--
 elbepack/debinstaller.py                |  4 +--
 elbepack/efilesystem.py                 |  4 +--
 elbepack/elbeproject.py                 | 12 ++++-----
 elbepack/elbexml.py                     |  2 +-
 elbepack/filesystem.py                  |  2 +-
 elbepack/fstab.py                       |  2 +-
 elbepack/log.py                         |  6 ++---
 elbepack/pkgutils.py                    |  3 +--
 elbepack/projectmanager.py              |  8 +++---
 elbepack/repomanager.py                 | 43 +++++----------------------------
 elbepack/rfs.py                         |  2 +-
 elbepack/rpcaptcache.py                 |  4 +--
 elbepack/treeutils.py                   |  2 +-
 elbepack/updated.py                     |  2 +-
 elbepack/updated_monitors.py            |  8 +++---
 test/updated.py                         |  2 +-
 24 files changed, 76 insertions(+), 121 deletions(-)

diff --git a/elbepack/aptpkgutils.py b/elbepack/aptpkgutils.py
index 47609d0c5de7..3409128f983d 100644
--- a/elbepack/aptpkgutils.py
+++ b/elbepack/aptpkgutils.py
@@ -265,13 +265,13 @@ class APTPackage(PackageBase):
         else:
             self.installed_deb = None
 
-        PackageBase.__init__(self, pkg.name,
-                             iver, cver,
-                             ihashes, chashes,
-                             iprio, cprio,
-                             iarch, carch,
-                             pkgstate(pkg), pkg.is_auto_installed,
-                             origin)
+        super().__init__(pkg.name,
+                         iver, cver,
+                         ihashes, chashes,
+                         iprio, cprio,
+                         iarch, carch,
+                         pkgstate(pkg), pkg.is_auto_installed,
+                         origin)
 
 
 class XMLPackage(PackageBase):
@@ -288,10 +288,10 @@ class XMLPackage(PackageBase):
                         site=None,
                         component=None)
 
-        PackageBase.__init__(self, node.et.text,
-                             node.et.get('version'), None,
-                             hashes, None,
-                             node.et.get('prio'), None,
-                             node.et.get('arch'), None,
-                             INSTALLED, node.et.get('auto') == 'true',
-                             origin)
+        super().__init__(node.et.text,
+                         node.et.get('version'), None,
+                         hashes, None,
+                         node.et.get('prio'), None,
+                         node.et.get('arch'), None,
+                         INSTALLED, node.et.get('auto') == 'true',
+                         origin)
diff --git a/elbepack/aptprogress.py b/elbepack/aptprogress.py
index e85ed130c3a5..8dd74c3275bf 100644
--- a/elbepack/aptprogress.py
+++ b/elbepack/aptprogress.py
@@ -12,7 +12,7 @@ from apt_pkg import size_to_str
 class ElbeInstallProgress (InstallProgress):
 
     def __init__(self, cb=None, fileno=2):
-        InstallProgress.__init__(self)
+        super().__init__()
         self.cb = cb
         self.fileno = fileno
 
@@ -65,7 +65,7 @@ class ElbeInstallProgress (InstallProgress):
 class ElbeAcquireProgress (AcquireProgress):
 
     def __init__(self, cb=None):
-        AcquireProgress.__init__(self)
+        super().__init__()
         self._id = 1
         self.cb = cb
 
@@ -105,7 +105,7 @@ class ElbeAcquireProgress (AcquireProgress):
 class ElbeOpProgress (OpProgress):
 
     def __init__(self, cb=None):
-        OpProgress.__init__(self)
+        super().__init__()
         self._id = 1
         self.cb = cb
 
diff --git a/elbepack/asyncworker.py b/elbepack/asyncworker.py
index 02208c37c90a..4c1f5f79f48d 100644
--- a/elbepack/asyncworker.py
+++ b/elbepack/asyncworker.py
@@ -37,7 +37,7 @@ class BuildSysrootJob(AsyncWorkerJob):
                     ['empty_project', 'needs_build', 'has_changes',
                      'build_done', 'build_failed'])
         logging.info('Enqueueing project for building sysroot')
-        AsyncWorkerJob.enqueue(self, queue, db)
+        super().enqueue(queue, db)
 
     def execute(self, db):
         success = self.build_failed
@@ -65,7 +65,7 @@ class BuildSDKJob(AsyncWorkerJob):
                     ['empty_project', 'needs_build', 'has_changes',
                      'build_done', 'build_failed'])
         logging.info('Enqueueing project for building SDK')
-        AsyncWorkerJob.enqueue(self, queue, db)
+        super().enqueue(queue, db)
 
     def execute(self, db):
         success = self.build_failed
@@ -87,7 +87,7 @@ class BuildSDKJob(AsyncWorkerJob):
 
 class BuildCDROMsJob(AsyncWorkerJob):
     def __init__(self, project, build_bin, build_src):
-        AsyncWorkerJob.__init__(self, project)
+        super().__init__(project)
         self.build_bin = build_bin
         self.build_src = build_src
 
@@ -96,7 +96,7 @@ class BuildCDROMsJob(AsyncWorkerJob):
                     ['empty_project', 'needs_build', 'has_changes',
                      'build_done', 'build_failed'])
         logging.info('Enqueueing project for building CDROMs')
-        AsyncWorkerJob.enqueue(self, queue, db)
+        super().enqueue(queue, db)
 
     def execute(self, db):
         success = self.build_failed
@@ -123,7 +123,7 @@ class BuildChrootTarJob(AsyncWorkerJob):
                     ['empty_project', 'needs_build', 'has_changes',
                      'build_done', 'build_failed'])
         logging.info('Enqueueing project for building croot tar')
-        AsyncWorkerJob.enqueue(self, queue, db)
+        super().enqueue(queue, db)
 
     def execute(self, db):
         success = self.build_failed
@@ -145,7 +145,7 @@ class BuildChrootTarJob(AsyncWorkerJob):
 
 class BuildJob(AsyncWorkerJob):
     def __init__(self, project, build_bin, build_src, skip_pbuilder):
-        AsyncWorkerJob.__init__(self, project)
+        super().__init__(project)
         self.build_bin = build_bin
         self.build_src = build_src
         self.skip_pbuilder = skip_pbuilder
@@ -155,7 +155,7 @@ class BuildJob(AsyncWorkerJob):
                     ['empty_project', 'needs_build', 'has_changes',
                      'build_done', 'build_failed'])
         logging.info('Enqueueing project for build')
-        AsyncWorkerJob.enqueue(self, queue, db)
+        super().enqueue(queue, db)
 
     def execute(self, db):
 
@@ -193,7 +193,7 @@ class BuildJob(AsyncWorkerJob):
 
 class PdebuildJob(AsyncWorkerJob):
     def __init__(self, project, profile='', cross=False):
-        AsyncWorkerJob.__init__(self, project)
+        super().__init__(project)
         self.profile = profile
         self.cross = cross
 
@@ -202,7 +202,7 @@ class PdebuildJob(AsyncWorkerJob):
                     ['empty_project', 'needs_build', 'has_changes',
                      'build_done', 'build_failed'])
         logging.info('Enqueueing project for pdebuild')
-        AsyncWorkerJob.enqueue(self, queue, db)
+        super().enqueue(queue, db)
 
     def execute(self, db):
         success = self.build_failed
@@ -224,7 +224,7 @@ class PdebuildJob(AsyncWorkerJob):
 
 class CreatePbuilderJob(AsyncWorkerJob):
     def __init__(self, project, ccachesize, cross=False, noccache=False):
-        AsyncWorkerJob.__init__(self, project)
+        super().__init__(project)
         self.cross = cross
         self.noccache = noccache
         self.ccachesize = ccachesize
@@ -234,7 +234,7 @@ class CreatePbuilderJob(AsyncWorkerJob):
                     ['empty_project', 'needs_build', 'has_changes',
                      'build_done', 'build_failed'])
         logging.info('Enqueueing project to have the pbuilder built')
-        AsyncWorkerJob.enqueue(self, queue, db)
+        super().enqueue(queue, db)
 
     def execute(self, db):
         success = self.build_failed
@@ -259,7 +259,7 @@ class UpdatePbuilderJob(AsyncWorkerJob):
                     ['empty_project', 'needs_build', 'has_changes',
                      'build_done', 'build_failed'])
         logging.info('Enqueueing project to update the pbuilder')
-        AsyncWorkerJob.enqueue(self, queue, db)
+        super().enqueue(queue, db)
 
     def execute(self, db):
         success = self.build_done
@@ -290,7 +290,7 @@ def savecwd():
 
 class AsyncWorker(Thread):
     def __init__(self, db):
-        Thread.__init__(self, name='AsyncWorker')
+        super().__init__(name='AsyncWorker')
         self.db = db
         self.queue = Queue()
         self.start()
diff --git a/elbepack/commands/parselicence.py b/elbepack/commands/parselicence.py
index 5c37894fc129..0e9d61b6111d 100644
--- a/elbepack/commands/parselicence.py
+++ b/elbepack/commands/parselicence.py
@@ -16,7 +16,7 @@ from elbepack.version import elbe_version
 
 class license_dep5_to_spdx (dict):
     def __init__(self, xml_fname=None):
-        dict.__init__(self)
+        super().__init__()
 
         self.perpackage_mapping = {}
         self.perpackage_override = {}
diff --git a/elbepack/daemons/soap/__init__.py b/elbepack/daemons/soap/__init__.py
index 2a371394b856..1b95d9eef93c 100644
--- a/elbepack/daemons/soap/__init__.py
+++ b/elbepack/daemons/soap/__init__.py
@@ -27,7 +27,7 @@ logging.getLogger('spyne').setLevel(logging.INFO)
 
 class EsoapApp(Application):
     def __init__(self, *args, **kargs):
-        Application.__init__(self, *args, **kargs)
+        super().__init__(*args, **kargs)
         self.pm = ProjectManager('/var/cache/elbe')
 
 
diff --git a/elbepack/daemons/soap/authentication.py b/elbepack/daemons/soap/authentication.py
index b056396321e0..121ec2e00fc4 100644
--- a/elbepack/daemons/soap/authentication.py
+++ b/elbepack/daemons/soap/authentication.py
@@ -9,8 +9,7 @@ from spyne.model.fault import Fault
 
 class SoapElbeNotLoggedIn(Fault):
     def __init__(self):
-        Fault.__init__(
-            self,
+        super().__init__(
             faultcode='ElbeNotLoggedIn',
             faultstring='Not authenticated ! '
                         'Cant let you perform this command.')
@@ -18,8 +17,7 @@ class SoapElbeNotLoggedIn(Fault):
 
 class SoapElbeNotAuthorized(Fault):
     def __init__(self):
-        Fault.__init__(
-            self,
+        super().__init__(
             faultcode='ElbeNotAuthorized',
             faultstring='Not Authorized ! Cant let you perform this command.')
 
diff --git a/elbepack/daemons/soap/esoap.py b/elbepack/daemons/soap/esoap.py
index d85f9f18125c..274872f13cb6 100644
--- a/elbepack/daemons/soap/esoap.py
+++ b/elbepack/daemons/soap/esoap.py
@@ -27,29 +27,23 @@ from .datatypes import SoapFile, SoapProject
 
 class SoapElbeDBError(Fault):
     def __init__(self, dberr):
-        Fault.__init__(self, faultcode='ElbeDBError', faultstring=str(dberr))
+        super().__init__(faultcode='ElbeDBError', faultstring=str(dberr))
 
 
 class SoapElbeProjectError(Fault):
     def __init__(self, err):
-        Fault.__init__(
-            self,
-            faultcode='ElbeProjectError',
-            faultstring=str(err))
+        super().__init__(faultcode='ElbeProjectError', faultstring=str(err))
 
 
 class SoapElbeValidationError(Fault):
     def __init__(self, exc):
-        Fault.__init__(
-            self,
-            faultcode='ElbeValidationError',
-            faultstring=exc.__repr__())
+        super().__init__(faultcode='ElbeValidationError', faultstring=exc.__repr__())
 
 
 class SoapElbeInvalidState(Fault):
     def __init__(self):
-        Fault.__init__(self, faultcode='ElbeInvalidState',
-                       faultstring='Project is Busy ! Operation Invalid')
+        super().__init__(faultcode='ElbeInvalidState',
+                         faultstring='Project is Busy ! Operation Invalid')
 
 
 class ESoap (ServiceBase):
diff --git a/elbepack/db.py b/elbepack/db.py
index 400c410689f6..a67ca495d4a5 100644
--- a/elbepack/db.py
+++ b/elbepack/db.py
@@ -50,13 +50,12 @@ class Base(metaclass=DeclarativeMeta):
 
 
 class ElbeDBError(Exception):
-    def __init__(self, message):
-        Exception.__init__(self, message)
+    pass
 
 
 class InvalidLogin(Exception):
     def __init__(self):
-        Exception.__init__(self, 'Invalid login')
+        super().__init__('Invalid login')
 
 
 @contextmanager
diff --git a/elbepack/debinstaller.py b/elbepack/debinstaller.py
index 53cf916c19b6..ef850346a8e6 100644
--- a/elbepack/debinstaller.py
+++ b/elbepack/debinstaller.py
@@ -29,7 +29,7 @@ class NoKinitrdException(Exception):
 class ReleaseFile(HashValidator):
     def __init__(self, base_url, fname, fname_list):
 
-        HashValidator.__init__(self, base_url)
+        super().__init__(base_url)
 
         header_re = re.compile(r'(\w+):(.*)')
         hash_re = re.compile(r' ([0-9a-f]+)\s+([0-9]+)\s+(\S+)')
@@ -57,7 +57,7 @@ class ReleaseFile(HashValidator):
 class SHA256SUMSFile(HashValidator):
     def __init__(self, base_url, fname, fname_list):
 
-        HashValidator.__init__(self, base_url)
+        super().__init__(base_url)
 
         hash_re = re.compile(r'([0-9a-f]+)\s+(\S+)')
 
diff --git a/elbepack/efilesystem.py b/elbepack/efilesystem.py
index 3319ff2f8732..840da50a520c 100644
--- a/elbepack/efilesystem.py
+++ b/elbepack/efilesystem.py
@@ -303,7 +303,7 @@ class Excursion:
 class ChRootFilesystem(ElbeFilesystem):
 
     def __init__(self, path, interpreter=None, clean=False):
-        ElbeFilesystem.__init__(self, path, clean)
+        super().__init__(path, clean)
         self.interpreter = interpreter
         self.cwd = os.open('/', os.O_RDONLY)
         self.inchroot = False
@@ -393,7 +393,7 @@ class ChRootFilesystem(ElbeFilesystem):
 
 class TargetFs(ChRootFilesystem):
     def __init__(self, path, xml, clean=True):
-        ChRootFilesystem.__init__(self, path, xml.defs['userinterpr'], clean)
+        super().__init__(path, xml.defs['userinterpr'], clean)
         self.xml = xml
         self.images = []
         self.image_packers = {}
diff --git a/elbepack/elbeproject.py b/elbepack/elbeproject.py
index 46fba25c81c4..d0422a038779 100644
--- a/elbepack/elbeproject.py
+++ b/elbepack/elbeproject.py
@@ -46,25 +46,23 @@ _xz_env = {
 
 class IncompatibleArchitectureException(Exception):
     def __init__(self, oldarch, newarch):
-        Exception.__init__(
-            self,
-            f'Cannot change architecture from {oldarch} to {newarch} in '
-            'existing project')
+        super().__init__(f'Cannot change architecture from {oldarch} to {newarch} in '
+                         'existing project')
 
 
 class AptCacheUpdateError(Exception):
     def __init__(self, e):
-        Exception.__init__(self, f'Error Updating rpcaptcache: {e}')
+        super().__init__(f'Error Updating rpcaptcache: {e}')
 
 
 class AptCacheCommitError(Exception):
     def __init__(self, msg=''):
-        Exception.__init__(self, f'Error Committing rpcaptcache {msg}')
+        super().__init__(f'Error Committing rpcaptcache {msg}')
 
 
 class UnsupportedSDKException(Exception):
     def __init__(self, triplet):
-        Exception.__init__(self, f'SDK for {triplet} currently unsupported')
+        super().__init__(f'SDK for {triplet} currently unsupported')
 
 
 def test_gen_sdk_scripts():
diff --git a/elbepack/elbexml.py b/elbepack/elbexml.py
index ac68cdea861b..a64ef98e66fb 100644
--- a/elbepack/elbexml.py
+++ b/elbepack/elbexml.py
@@ -23,7 +23,7 @@ from elbepack.xmldefaults import ElbeDefaults
 
 class ValidationError(Exception):
     def __init__(self, validation):
-        Exception.__init__(self)
+        super().__init__()
         self.validation = validation
 
     def __repr__(self):
diff --git a/elbepack/filesystem.py b/elbepack/filesystem.py
index 024c1bdc80d4..dd4678006950 100644
--- a/elbepack/filesystem.py
+++ b/elbepack/filesystem.py
@@ -426,7 +426,7 @@ class Filesystem:
 class TmpdirFilesystem (Filesystem):
     def __init__(self, debug=False):
         tmpdir = mkdtemp()
-        Filesystem.__init__(self, tmpdir)
+        super().__init__(tmpdir)
         self.debug = debug
 
     def __del__(self):
diff --git a/elbepack/fstab.py b/elbepack/fstab.py
index cad1715ad5ac..03fa158c3fa8 100644
--- a/elbepack/fstab.py
+++ b/elbepack/fstab.py
@@ -42,7 +42,7 @@ def get_devicelabel(xml, node):
 
 class mountpoint_dict (dict):
     def __init__(self):
-        dict.__init__(self)
+        super().__init__()
         self.id_count = 0
 
     def register(self, fstab_entry):
diff --git a/elbepack/log.py b/elbepack/log.py
index 7823b3d08199..88e331f2eb1f 100644
--- a/elbepack/log.py
+++ b/elbepack/log.py
@@ -23,7 +23,7 @@ validation = logging.getLogger('validation')
 
 class LoggingQueue(collections.deque):
     def __init__(self):
-        super(LoggingQueue, self).__init__(maxlen=1024)
+        super().__init__(maxlen=1024)
         self.max_level = logging.NOTSET
 
     def note_level(self, level):
@@ -36,7 +36,7 @@ class QHandler(logging.Handler):
     queues: dict[str, LoggingQueue] = {}
 
     def __init__(self, target, *args, **kwargs):
-        super(QHandler, self).__init__(*args, **kwargs)
+        super().__init__(*args, **kwargs)
         if target not in QHandler.queues:
             QHandler.queues[target] = LoggingQueue()
         self.Q = QHandler.queues[target]
@@ -82,7 +82,7 @@ def reset_level(proj):
 class ThreadFilter(logging.Filter):
 
     def __init__(self, allowed, *args, **kwargs):
-        super(ThreadFilter, self).__init__(*args, **kwargs)
+        super().__init__(*args, **kwargs)
         self.allowed = {a.name for a in allowed}
         self.thread = threading.current_thread().ident
 
diff --git a/elbepack/pkgutils.py b/elbepack/pkgutils.py
index 465305d5031f..b46a719462f3 100644
--- a/elbepack/pkgutils.py
+++ b/elbepack/pkgutils.py
@@ -68,8 +68,7 @@ def get_dsc_size(fname):
 
 class ChangelogNeedsDependency(Exception):
     def __init__(self, pkgname):
-        Exception.__init__(
-            self, f'Changelog extraction depends on "{pkgname}"')
+        super().__init__(f'Changelog extraction depends on "{pkgname}"')
         self.pkgname = pkgname
 
 
diff --git a/elbepack/projectmanager.py b/elbepack/projectmanager.py
index c571d9f53773..46c7671fb4e6 100644
--- a/elbepack/projectmanager.py
+++ b/elbepack/projectmanager.py
@@ -29,19 +29,17 @@ class ProjectManagerError(Exception):
 
 class AlreadyOpen(ProjectManagerError):
     def __init__(self, builddir, username):
-        ProjectManagerError.__init__(
-            self, f'project in {builddir} is already opened by {username}')
+        super().__init__(f'project in {builddir} is already opened by {username}')
 
 
 class PermissionDenied(ProjectManagerError):
     def __init__(self, builddir):
-        ProjectManagerError.__init__(
-            self, f'permission denied for project in {builddir}')
+        super().__init__(f'permission denied for project in {builddir}')
 
 
 class NoOpenProject(ProjectManagerError):
     def __init__(self):
-        ProjectManagerError.__init__(self, 'must open a project first')
+        super().__init__(self, 'must open a project first')
 
 
 class InvalidState(ProjectManagerError):
diff --git a/elbepack/repomanager.py b/elbepack/repomanager.py
index ddaa19cd4477..a8e314c29a83 100644
--- a/elbepack/repomanager.py
+++ b/elbepack/repomanager.py
@@ -355,12 +355,7 @@ class UpdateRepo(RepoBase):
 
         repo_attrs = RepoAttributes(codename, arch, 'main')
 
-        RepoBase.__init__(self,
-                          path,
-                          None,
-                          repo_attrs,
-                          'Update',
-                          'Update')
+        super().__init__(path, None, repo_attrs, 'Update', 'Update')
 
 
 class CdromInitRepo(RepoBase):
@@ -371,12 +366,7 @@ class CdromInitRepo(RepoBase):
             init_codename, 'amd64', [
                 'main', 'main/debian-installer'], mirror)
 
-        RepoBase.__init__(self,
-                          path,
-                          None,
-                          init_attrs,
-                          'Elbe',
-                          'Elbe InitVM Cdrom Repo')
+        super().__init__(path, None, init_attrs, 'Elbe', 'Elbe InitVM Cdrom Repo')
 
 
 class CdromBinRepo(RepoBase):
@@ -396,12 +386,7 @@ class CdromBinRepo(RepoBase):
         else:
             init_attrs = None
 
-        RepoBase.__init__(self,
-                          path,
-                          init_attrs,
-                          repo_attrs,
-                          'Elbe',
-                          'Elbe Binary Cdrom Repo')
+        super().__init__(path, init_attrs, repo_attrs, 'Elbe', 'Elbe Binary Cdrom Repo')
 
 
 class CdromSrcRepo(RepoBase):
@@ -425,32 +410,16 @@ class CdromSrcRepo(RepoBase):
         else:
             init_attrs = None
 
-        RepoBase.__init__(self,
-                          path,
-                          init_attrs,
-                          repo_attrs,
-                          'Elbe',
-                          'Elbe Source Cdrom Repo',
-                          maxsize)
+        super().__init__(path, init_attrs, repo_attrs, 'Elbe', 'Elbe Source Cdrom Repo', maxsize)
 
 
 class ToolchainRepo(RepoBase):
     def __init__(self, arch, codename, path):
         repo_attrs = RepoAttributes(codename, arch, 'main')
-        RepoBase.__init__(self,
-                          path,
-                          None,
-                          repo_attrs,
-                          'toolchain',
-                          'Toolchain binary packages Repo')
+        super().__init__(path, None, repo_attrs, 'toolchain', 'Toolchain binary packages Repo')
 
 
 class ProjectRepo(RepoBase):
     def __init__(self, arch, codename, path):
         repo_attrs = RepoAttributes(codename, [arch, 'amd64', 'source'], 'main')
-        RepoBase.__init__(self,
-                          path,
-                          None,
-                          repo_attrs,
-                          'Local',
-                          'Self build packages Repo')
+        super().__init__(path, None, repo_attrs, 'Local', 'Self build packages Repo')
diff --git a/elbepack/rfs.py b/elbepack/rfs.py
index fc4231b6bada..2212e69d7f3d 100644
--- a/elbepack/rfs.py
+++ b/elbepack/rfs.py
@@ -54,7 +54,7 @@ def create_apt_prefs(xml, rfs):
 
 class DebootstrapException (Exception):
     def __init__(self):
-        Exception.__init__(self, 'Debootstrap Failed')
+        super().__init__('Debootstrap Failed')
 
 
 class BuildEnv:
diff --git a/elbepack/rpcaptcache.py b/elbepack/rpcaptcache.py
index c6fe489fc6f8..d918c53d23aa 100644
--- a/elbepack/rpcaptcache.py
+++ b/elbepack/rpcaptcache.py
@@ -52,7 +52,7 @@ class MyMan(BaseManager):
         """Redirect outputs of the process to an async logging thread"""
         alog = async_logging()
         self.log_finalizer = Finalize(self, alog.shutdown)
-        super(MyMan, self).start(MyMan.redirect_outputs, [alog.write_fd])
+        super().start(MyMan.redirect_outputs, [alog.write_fd])
 
 
 class InChRootObject:
@@ -68,7 +68,7 @@ class RPCAPTCache(InChRootObject):
     def __init__(self, rfs, arch,
                  notifier=None, norecommend=False, noauth=True):
 
-        InChRootObject.__init__(self, rfs)
+        super().__init__(rfs)
 
         self.notifier = notifier
         config.set('APT::Architecture', arch)
diff --git a/elbepack/treeutils.py b/elbepack/treeutils.py
index 9a36be568346..5b3d2ed8ee69 100644
--- a/elbepack/treeutils.py
+++ b/elbepack/treeutils.py
@@ -139,7 +139,7 @@ class etree(ebase):
         else:
             et = ElementTree(file=None)
 
-        ebase.__init__(self, et)
+        super().__init__(et)
 
     def write(self, fname, encoding=None):
         # Make sure, that we end with a newline
diff --git a/elbepack/updated.py b/elbepack/updated.py
index a413e55975f0..8e77028ef63f 100644
--- a/elbepack/updated.py
+++ b/elbepack/updated.py
@@ -93,7 +93,7 @@ class UpdateStatus:
 
 class UpdateApplication (Application):
     def __init__(self, *args, monitor_timeout, **kargs):
-        Application.__init__(self, *args, **kargs)
+        super().__init__(*args, **kargs)
         self.status = UpdateStatus()
         self.monitor_timeout = monitor_timeout
 
diff --git a/elbepack/updated_monitors.py b/elbepack/updated_monitors.py
index 5f6a7e95037c..706bfe028e49 100644
--- a/elbepack/updated_monitors.py
+++ b/elbepack/updated_monitors.py
@@ -29,7 +29,7 @@ class UpdateMonitor:
 
 class USBMonitor (UpdateMonitor):
     def __init__(self, status, recursive=False):
-        super(USBMonitor, self).__init__(status)
+        super().__init__(status)
         self.recursive = recursive
         self.context = pyudev.Context()
         self.monitor = pyudev.Monitor.from_netlink(self.context)
@@ -91,7 +91,7 @@ class FileMonitor (UpdateMonitor):
 
     class EventHandler (pyinotify.ProcessEvent):
         def __init__(self, status):
-            pyinotify.ProcessEvent.__init__(self)
+            super().__init__()
             self.status = status
 
         def process_IN_CLOSE_WRITE(self, event):
@@ -99,7 +99,7 @@ class FileMonitor (UpdateMonitor):
 
     class ObserverThread (threading.Thread):
         def __init__(self, status, monitor):
-            threading.Thread.__init__(self, name='ObserverThread')
+            super().__init__(name='ObserverThread')
             self.status = status
             self.monitor = monitor
 
@@ -117,7 +117,7 @@ class FileMonitor (UpdateMonitor):
                     return
 
     def __init__(self, status, update_dir):
-        super(FileMonitor, self).__init__(status)
+        super().__init__(status)
         self.wm = pyinotify.WatchManager()
         self.notifier = pyinotify.Notifier(self.wm)
 
diff --git a/test/updated.py b/test/updated.py
index 489a54fd2775..649b8b8465aa 100755
--- a/test/updated.py
+++ b/test/updated.py
@@ -26,7 +26,7 @@ class MonitorService (ServiceBase):
 
 class MonitorThread (threading.Thread):
     def __init__(self, port):
-        threading.Thread.__init__(self, name='MonitorThread')
+        super().__init__(name='MonitorThread')
         self.port = port
         self.server = None
 

---
base-commit: e769c034419472b9f0486e007184a20fa40e5566
change-id: 20240819-super-0a9a39fab5fc

Best regards,
-- 
Thomas Weißschuh <thomas.weissschuh at linutronix.de>



More information about the elbe-devel mailing list