Do not make object inheritance

This patch removes these lintian warnings:

Warning R0205: Class 'X' inherits from object,
can be safely removed from bases in python3 (useless-object-inheritance)
This commit is contained in:
Rodolfo García Peñas (kix) 2020-08-29 21:44:18 +02:00
parent ddfc2a766c
commit e77440552c
16 changed files with 27 additions and 27 deletions

View File

@ -39,7 +39,7 @@ def goTo(path):
return False return False
class Author(object): class Author():
def __init__(self, name, count, email): def __init__(self, name, count, email):
self.name = name self.name = name
self.count = count self.count = count
@ -55,7 +55,7 @@ class Author(object):
return self.email return self.email
class Git(object): class Git():
@staticmethod @staticmethod
def getShortlog(ref): def getShortlog(ref):
shortlog = "" shortlog = ""
@ -199,7 +199,7 @@ class Git(object):
chdir(topLevel) chdir(topLevel)
class OfflineimapInfo(object): class OfflineimapInfo():
def getVersion(self): def getVersion(self):
cmd = shlex.split("./offlineimap.py --version") cmd = shlex.split("./offlineimap.py --version")
return run(cmd).rstrip().decode(FS_ENCODING) return run(cmd).rstrip().decode(FS_ENCODING)
@ -209,7 +209,7 @@ class OfflineimapInfo(object):
class User(object): class User():
"""Interact with the user.""" """Interact with the user."""
@staticmethod @staticmethod
@ -235,7 +235,7 @@ class User(object):
return False return False
class Tester(object): class Tester():
def __init__(self, name, email, feedback): def __init__(self, name, email, feedback):
self.name = name self.name = name
self.email = email self.email = email
@ -264,7 +264,7 @@ class Tester(object):
self.feedback = not self.feedback self.feedback = not self.feedback
class Testers(object): class Testers():
def __init__(self): def __init__(self):
self.testers = None self.testers = None
self._read() self._read()

View File

@ -89,7 +89,7 @@ Have fun! ,-)
""" """
class State(object): class State():
def __init__(self): def __init__(self):
self.master = None self.master = None
self.next = None self.next = None
@ -129,7 +129,7 @@ class State(object):
goTo('..') goTo('..')
class Changelog(object): class Changelog():
def __init__(self): def __init__(self):
self.shouldUsePrevious = False self.shouldUsePrevious = False
@ -214,7 +214,7 @@ class Changelog(object):
return dict_Content return dict_Content
class Announce(object): class Announce():
def __init__(self, version): def __init__(self, version):
self.fd = open(ANNOUNCE_FILE, 'w') self.fd = open(ANNOUNCE_FILE, 'w')
self.version = version self.version = version
@ -258,7 +258,7 @@ Pip:
self.fd.close() self.fd.close()
class Website(object): class Website():
def updateUploads(self): def updateUploads(self):
req = ("add new archive to uploads/ on the website? " req = ("add new archive to uploads/ on the website? "
"(warning: checksums will change if it already exists)") "(warning: checksums will change if it already exists)")
@ -333,7 +333,7 @@ Then, commit and push changes of the website.""".format(SPHINXBUILD, DOCSDIR)))
return branchName return branchName
class Release(object): class Release():
def __init__(self): def __init__(self):
self.state = State() self.state = State()
self.offlineimapInfo = OfflineimapInfo() self.offlineimapInfo = OfflineimapInfo()

View File

@ -14,7 +14,7 @@ import argparse
from helpers import CACHEDIR, EDITOR, Testers, User, Git from helpers import CACHEDIR, EDITOR, Testers, User, Git
class App(object): class App():
def __init__(self): def __init__(self):
self.args = None self.args = None
self.testers = Testers() self.testers = Testers()

View File

@ -157,7 +157,7 @@ def CustomConfigDefault():
pass pass
class ConfigHelperMixin(object): class ConfigHelperMixin():
"""Allow comfortable retrieving of config values pertaining """Allow comfortable retrieving of config values pertaining
to a section. to a section.

View File

@ -26,7 +26,7 @@ from offlineimap.error import OfflineImapError
import offlineimap.accounts import offlineimap.accounts
class BaseFolder(object): class BaseFolder():
__hash__ = None __hash__ = None
def __init__(self, name, repository): def __init__(self, name, repository):

View File

@ -25,7 +25,7 @@ import six
from .Base import BaseFolder from .Base import BaseFolder
class DatabaseFileLock(object): class DatabaseFileLock():
"""Lock at database file level.""" """Lock at database file level."""
def __init__(self): def __init__(self):

View File

@ -32,7 +32,7 @@ from offlineimap.ui import getglobalui
from offlineimap.virtual_imaplib2 import IMAP4, IMAP4_SSL, InternalDate from offlineimap.virtual_imaplib2 import IMAP4, IMAP4_SSL, InternalDate
class UsefulIMAPMixIn(object): class UsefulIMAPMixIn():
def __getselectedfolder(self): def __getselectedfolder(self):
if self.state == 'SELECTED': if self.state == 'SELECTED':
return self.mailbox return self.mailbox

View File

@ -42,7 +42,7 @@ except ImportError:
have_gss = False have_gss = False
class IMAPServer(object): class IMAPServer():
"""Initializes all variables from an IMAPRepository() instance """Initializes all variables from an IMAPRepository() instance
Various functions, such as acquireconnection() return an IMAP4 Various functions, such as acquireconnection() return an IMAP4
@ -770,7 +770,7 @@ class IMAPServer(object):
self.semaphore.release() self.semaphore.release()
class IdleThread(object): class IdleThread():
def __init__(self, parent, folder=None): def __init__(self, parent, folder=None):
"""If invoked without 'folder', perform a NOOP and wait for """If invoked without 'folder', perform a NOOP and wait for
self.stop() to be called. If invoked with folder, switch to IDLE self.stop() to be called. If invoked with folder, switch to IDLE

View File

@ -62,7 +62,7 @@ def syncitall(list_accounts, config):
threads.wait() # Blocks until all accounts are processed. threads.wait() # Blocks until all accounts are processed.
class OfflineImap(object): class OfflineImap():
"""The main class that encapsulates the high level use of OfflineImap. """The main class that encapsulates the high level use of OfflineImap.
To invoke OfflineImap you would call it with:: To invoke OfflineImap you would call it with::

View File

@ -19,7 +19,7 @@
import imp import imp
class LocalEval(object): class LocalEval():
"""Here is a powerfull but very dangerous option, of course.""" """Here is a powerfull but very dangerous option, of course."""
def __init__(self, path=None): def __init__(self, path=None):

View File

@ -78,7 +78,7 @@ def writeIntermediateFile(accountname):
_mbnames.write() _mbnames.write()
class _IntermediateMbnames(object): class _IntermediateMbnames():
"""mbnames data for one account.""" """mbnames data for one account."""
def __init__(self, accountname, folder_root, mbnamesdir, folderfilter, def __init__(self, accountname, folder_root, mbnamesdir, folderfilter,
@ -120,7 +120,7 @@ class _IntermediateMbnames(object):
json.dump(itemlist, intermediateFD) json.dump(itemlist, intermediateFD)
class _Mbnames(object): class _Mbnames():
def __init__(self, config, ui, dry_run): def __init__(self, config, ui, dry_run):
self._config = config self._config = config

View File

@ -510,7 +510,7 @@ class IMAPRepository(BaseRepository):
"""Converts a cmp= function into a key= function """Converts a cmp= function into a key= function
We need to keep cmp functions for backward compatibility""" We need to keep cmp functions for backward compatibility"""
class K(object): class K():
def __init__(self, obj, *args): def __init__(self, obj, *args):
self.obj = obj self.obj = obj

View File

@ -30,7 +30,7 @@ from offlineimap.repository.LocalStatus import LocalStatusRepository
from offlineimap.error import OfflineImapError from offlineimap.error import OfflineImapError
class Repository(object): class Repository():
"""Abstract class that returns the correct Repository type """Abstract class that returns the correct Repository type
instance based on 'account' and 'reqtype', e.g. a instance based on 'account' and 'reqtype', e.g. a
class:`ImapRepository` instance.""" class:`ImapRepository` instance."""

View File

@ -37,7 +37,7 @@ def semaphorereset(semaphore, originalstate):
semaphore.release() semaphore.release()
class accountThreads(object): class accountThreads():
"""Store the list of all threads in the software so it can be used to find out """Store the list of all threads in the software so it can be used to find out
what's running and what's not.""" what's running and what's not."""

View File

@ -50,7 +50,7 @@ def getglobalui():
return globalui return globalui
class UIBase(object): class UIBase():
def __init__(self, config, loglevel=logging.INFO): def __init__(self, config, loglevel=logging.INFO):
self.config = config self.config = config
# Is this a 'dryrun'? # Is this a 'dryrun'?

View File

@ -6,7 +6,7 @@
import copy import copy
class ConstProxy(object): class ConstProxy():
"""Implements read-only access to a given object """Implements read-only access to a given object
that can be attached to each instance only once.""" that can be attached to each instance only once."""