From 34f05a009cdad8e6ffa221f703b037e1f8bf65ff Mon Sep 17 00:00:00 2001 From: Vincent A Date: Sun, 9 Jul 2017 20:04:18 +0200 Subject: [PATCH] core: use super to call parent constructors --- weboob/applications/boobathon/boobathon.py | 2 +- weboob/applications/galleroob/galleroob.py | 2 +- weboob/applications/monboob/monboob.py | 4 ++-- weboob/applications/radioob/radioob.py | 2 +- weboob/applications/videoob/videoob.py | 2 +- weboob/capabilities/account.py | 2 +- weboob/capabilities/bank.py | 6 +++--- weboob/capabilities/base.py | 15 +++++++-------- weboob/capabilities/bill.py | 4 ++-- weboob/capabilities/bugtracker.py | 10 +++++----- weboob/capabilities/chat.py | 2 +- weboob/capabilities/cinema.py | 4 ++-- weboob/capabilities/collection.py | 6 +++--- weboob/capabilities/contact.py | 6 +++--- weboob/capabilities/date.py | 6 +++--- weboob/capabilities/gallery.py | 4 ++-- weboob/capabilities/housing.py | 4 ++-- weboob/capabilities/parcel.py | 2 +- weboob/capabilities/paste.py | 2 +- weboob/capabilities/pricecomparison.py | 2 +- weboob/capabilities/recipe.py | 2 +- weboob/capabilities/shop.py | 2 +- weboob/capabilities/subtitle.py | 4 ++-- weboob/capabilities/torrent.py | 2 +- weboob/capabilities/translate.py | 4 ++-- weboob/capabilities/travel.py | 6 +++--- weboob/capabilities/weather.py | 8 ++++---- weboob/core/bcall.py | 2 +- weboob/core/ouiboube.py | 2 +- weboob/core/repositories.py | 2 +- weboob/exceptions.py | 2 +- weboob/tools/application/base.py | 1 + weboob/tools/application/console.py | 4 ++-- weboob/tools/application/formatters/iformatter.py | 2 +- weboob/tools/application/formatters/json.py | 2 +- weboob/tools/application/formatters/multiline.py | 2 +- weboob/tools/application/formatters/simple.py | 2 +- weboob/tools/application/formatters/table.py | 2 +- .../application/formatters/webkit/webkitgtk.py | 2 +- weboob/tools/application/media_player.py | 4 ++-- weboob/tools/application/qt5/backendcfg.py | 8 ++++---- weboob/tools/application/qt5/qt.py | 12 ++++++------ weboob/tools/application/repl.py | 5 ++--- weboob/tools/capabilities/bank/transactions.py | 2 +- weboob/tools/test.py | 2 +- 45 files changed, 86 insertions(+), 87 deletions(-) diff --git a/weboob/applications/boobathon/boobathon.py b/weboob/applications/boobathon/boobathon.py index e18ae25b87..092aaaecae 100644 --- a/weboob/applications/boobathon/boobathon.py +++ b/weboob/applications/boobathon/boobathon.py @@ -289,7 +289,7 @@ class Boobathon(ReplApplication): radios = [] def __init__(self, *args, **kwargs): - ReplApplication.__init__(self, *args, **kwargs) + super(Boobathon, self).__init__(*args, **kwargs) def main(self, argv): if len(argv) < 2: diff --git a/weboob/applications/galleroob/galleroob.py b/weboob/applications/galleroob/galleroob.py index ae0a7f1235..b135a02292 100644 --- a/weboob/applications/galleroob/galleroob.py +++ b/weboob/applications/galleroob/galleroob.py @@ -57,7 +57,7 @@ class Galleroob(ReplApplication): COLLECTION_OBJECTS = (BaseGallery, BaseImage, ) def __init__(self, *args, **kwargs): - ReplApplication.__init__(self, *args, **kwargs) + super(Galleroob, self).__init__(*args, **kwargs) @defaultcount(10) def do_search(self, pattern): diff --git a/weboob/applications/monboob/monboob.py b/weboob/applications/monboob/monboob.py index c06bc8a860..e5e11f84a7 100644 --- a/weboob/applications/monboob/monboob.py +++ b/weboob/applications/monboob/monboob.py @@ -47,7 +47,7 @@ class FakeSMTPD(SMTPServer): def __init__(self, app, bindaddr, port): - SMTPServer.__init__(self, (bindaddr, port), None) + super(FakeSMTPD, self).__init__((bindaddr, port), None) self.app = app def process_message(self, peer, mailfrom, rcpttos, data): @@ -57,7 +57,7 @@ def process_message(self, peer, mailfrom, rcpttos, data): class MonboobScheduler(Scheduler): def __init__(self, app): - Scheduler.__init__(self) + super(MonboobScheduler, self).__init__() self.app = app def run(self): diff --git a/weboob/applications/radioob/radioob.py b/weboob/applications/radioob/radioob.py index 2c72dc1688..b132a654aa 100644 --- a/weboob/applications/radioob/radioob.py +++ b/weboob/applications/radioob/radioob.py @@ -145,7 +145,7 @@ class Radioob(ReplApplication): PLAYLIST = [] def __init__(self, *args, **kwargs): - ReplApplication.__init__(self, *args, **kwargs) + super(Radioob, self).__init__(*args, **kwargs) self.player = MediaPlayer(self.logger) def main(self, argv): diff --git a/weboob/applications/videoob/videoob.py b/weboob/applications/videoob/videoob.py index e03f6a2d18..23a4e74513 100644 --- a/weboob/applications/videoob/videoob.py +++ b/weboob/applications/videoob/videoob.py @@ -76,7 +76,7 @@ class Videoob(ReplApplication): nsfw = True def __init__(self, *args, **kwargs): - ReplApplication.__init__(self, *args, **kwargs) + super(Videoob, self).__init__(*args, **kwargs) self.player = MediaPlayer(self.logger) def main(self, argv): diff --git a/weboob/capabilities/account.py b/weboob/capabilities/account.py index 729de02d7f..deefbb8ce0 100644 --- a/weboob/capabilities/account.py +++ b/weboob/capabilities/account.py @@ -39,7 +39,7 @@ class Account(BaseObject): properties = Field('List of key/value properties', dict) def __init__(self, id=None, url=None): - BaseObject.__init__(self, id, url) + super(Account, self).__init__(id, url) class StatusField(BaseObject): diff --git a/weboob/capabilities/bank.py b/weboob/capabilities/bank.py index 550a1e59dd..0c32e16d17 100644 --- a/weboob/capabilities/bank.py +++ b/weboob/capabilities/bank.py @@ -44,7 +44,7 @@ class AccountNotFound(UserError): """ def __init__(self, msg='Account not found'): - UserError.__init__(self, msg) + super(AccountNotFound, self).__init__(msg) class RecipientNotFound(UserError): @@ -53,7 +53,7 @@ class RecipientNotFound(UserError): """ def __init__(self, msg='Recipient not found'): - UserError.__init__(self, msg) + super(RecipientNotFound, self).__init__(msg) class TransferError(UserError): @@ -157,7 +157,7 @@ class BaseAccount(BaseObject, Currency): bank_name = StringField('Bank Name') def __init__(self, id='0', url=None): - BaseObject.__init__(self, id, url) + super(BaseAccount, self).__init__(id, url) @property def currency_text(self): diff --git a/weboob/capabilities/base.py b/weboob/capabilities/base.py index dc054e0433..0644ae1401 100644 --- a/weboob/capabilities/base.py +++ b/weboob/capabilities/base.py @@ -98,8 +98,7 @@ class FieldNotFound(Exception): """ def __init__(self, obj, field): - Exception.__init__(self, - u'Field "%s" not found for object %s' % (field, obj)) + super(FieldNotFound, self).__init__(u'Field "%s" not found for object %s' % (field, obj)) class ConversionWarning(UserWarning): @@ -225,7 +224,7 @@ class IntField(Field): """ def __init__(self, doc, **kwargs): - Field.__init__(self, doc, int, long, **kwargs) + super(IntField, self).__init__(doc, int, long, **kwargs) def convert(self, value): return int(value) @@ -237,7 +236,7 @@ class BoolField(Field): """ def __init__(self, doc, **kwargs): - Field.__init__(self, doc, bool, **kwargs) + super(BoolField, self).__init__(doc, bool, **kwargs) def convert(self, value): return bool(value) @@ -249,7 +248,7 @@ class DecimalField(Field): """ def __init__(self, doc, **kwargs): - Field.__init__(self, doc, Decimal, **kwargs) + super(DecimalField, self).__init__(doc, Decimal, **kwargs) def convert(self, value): if isinstance(value, Decimal): @@ -263,7 +262,7 @@ class FloatField(Field): """ def __init__(self, doc, **kwargs): - Field.__init__(self, doc, float, **kwargs) + super(FloatField, self).__init__(doc, float, **kwargs) def convert(self, value): return float(value) @@ -275,7 +274,7 @@ class StringField(Field): """ def __init__(self, doc, **kwargs): - Field.__init__(self, doc, unicode, **kwargs) + super(StringField, self).__init__(doc, unicode, **kwargs) def convert(self, value): return to_unicode(value) @@ -287,7 +286,7 @@ class BytesField(Field): """ def __init__(self, doc, **kwargs): - Field.__init__(self, doc, bytes, **kwargs) + super(BytesField, self).__init__(doc, bytes, **kwargs) def convert(self, value): if isinstance(value, unicode): diff --git a/weboob/capabilities/bill.py b/weboob/capabilities/bill.py index bcf64e984e..3e68308bc7 100644 --- a/weboob/capabilities/bill.py +++ b/weboob/capabilities/bill.py @@ -32,7 +32,7 @@ class SubscriptionNotFound(UserError): """ def __init__(self, msg='Subscription not found'): - UserError.__init__(self, msg) + super(SubscriptionNotFound, self).__init__(msg) class DocumentNotFound(UserError): @@ -41,7 +41,7 @@ class DocumentNotFound(UserError): """ def __init__(self, msg='Document not found'): - UserError.__init__(self, msg) + super(DocumentNotFound, self).__init__(msg) class Detail(BaseObject, Currency): diff --git a/weboob/capabilities/bugtracker.py b/weboob/capabilities/bugtracker.py index b57fa2de4f..820c1934f2 100644 --- a/weboob/capabilities/bugtracker.py +++ b/weboob/capabilities/bugtracker.py @@ -47,7 +47,7 @@ class Project(BaseObject): priorities = Field('Available priorities for issues', list) def __init__(self, id, name, url=None): - BaseObject.__init__(self, id, url) + super(Project, self).__init__(id, url) self.name = unicode(name) def __repr__(self): @@ -114,7 +114,7 @@ class User(BaseObject): name = StringField('Name of user') def __init__(self, id, name, url=None): - BaseObject.__init__(self, id, url) + super(User, self).__init__(id, url) self.name = unicode(name) def __repr__(self): @@ -128,7 +128,7 @@ class Version(BaseObject): name = StringField('Name of version') def __init__(self, id, name, url=None): - BaseObject.__init__(self, id, url) + super(Version, self).__init__(id, url) self.name = unicode(name) def __repr__(self): @@ -151,7 +151,7 @@ class Status(BaseObject): value = IntField('Value of status (constants VALUE_*)') def __init__(self, id, name, value, url=None): - BaseObject.__init__(self, id, url) + super(Status, self).__init__(id, url) self.name = unicode(name) self.value = value @@ -229,7 +229,7 @@ class Query(BaseObject): status = StringField('Filter on statuses') def __init__(self, id='', url=None): - BaseObject.__init__(self, id, url) + super(Query, self).__init__(id, url) class CapBugTracker(Capability): diff --git a/weboob/capabilities/chat.py b/weboob/capabilities/chat.py index 1b44ed3f2e..16ff7efae9 100644 --- a/weboob/capabilities/chat.py +++ b/weboob/capabilities/chat.py @@ -43,7 +43,7 @@ class ChatMessage(BaseObject): date = DateField('Date when the message has been sent') def __init__(self, id_from, id_to, message, date=None, url=None): - BaseObject.__init__(self, '%s.%s' % (id_from, id_to), url) + super(ChatMessage, self).__init__('%s.%s' % (id_from, id_to), url) self.id_from = id_from self.id_to = id_to self.message = message diff --git a/weboob/capabilities/cinema.py b/weboob/capabilities/cinema.py index 2042f26271..f8098a679c 100644 --- a/weboob/capabilities/cinema.py +++ b/weboob/capabilities/cinema.py @@ -43,7 +43,7 @@ class Movie(BaseObject): thumbnail_url = StringField('Url of movie thumbnail') def __init__(self, id, original_title, url=None): - BaseObject.__init__(self, id, url) + super(Movie, self).__init__(id, url) self.original_title = original_title def get_roles_by_person_name(self,name): @@ -79,7 +79,7 @@ class Person(BaseObject): thumbnail_url = StringField('Url of person thumbnail') def __init__(self, id, name, url=None): - BaseObject.__init__(self, id, url) + super(Person, self).__init__(id, url) self.name = name def get_roles_by_movie_title(self,title): diff --git a/weboob/capabilities/collection.py b/weboob/capabilities/collection.py index 40842a02d8..3e912bd28f 100644 --- a/weboob/capabilities/collection.py +++ b/weboob/capabilities/collection.py @@ -31,7 +31,7 @@ def __init__(self, split_path=None): msg = 'Collection not found: %s' % '/'.join(split_path) else: msg = 'Collection not found' - UserError.__init__(self, msg) + super(CollectionNotFound, self).__init__(msg) class BaseCollection(BaseObject): @@ -41,7 +41,7 @@ class BaseCollection(BaseObject): """ def __init__(self, split_path, id=None, url=None): - BaseObject.__init__(self, id, url) + super(BaseCollection, self).__init__(id, url) self.split_path = split_path @property @@ -85,7 +85,7 @@ class Collection(BaseCollection): def __init__(self, split_path=None, title=None, id=None, url=None): self.title = title - BaseCollection.__init__(self, split_path, id, url) + super(Collection, self).__init__(split_path, id, url) def __unicode__(self): if self.title and self.basename: diff --git a/weboob/capabilities/contact.py b/weboob/capabilities/contact.py index 0c9d0e1c82..0e6c0c300f 100644 --- a/weboob/capabilities/contact.py +++ b/weboob/capabilities/contact.py @@ -57,7 +57,7 @@ class ContactPhoto(BaseObject): hidden = BoolField('True if the photo is hidden on website') def __init__(self, name, url=None): - BaseObject.__init__(self, name, url) + super(ContactPhoto, self).__init__(name, url) self.name = name def __iscomplete__(self): @@ -108,7 +108,7 @@ class Contact(BaseContact): profile = Field('Contact profile', dict, default=OrderedDict()) def __init__(self, id, name, status, url=None): - BaseObject.__init__(self, id, url) + super(Contact, self).__init__(id, url) self.name = name self.status = status @@ -180,7 +180,7 @@ class Query(BaseObject): message = StringField('Message received') def __init__(self, id, message, url=None): - BaseObject.__init__(self, id, url) + super(Query, self).__init__(id, url) self.message = message diff --git a/weboob/capabilities/date.py b/weboob/capabilities/date.py index 49a631d378..a432d50e71 100644 --- a/weboob/capabilities/date.py +++ b/weboob/capabilities/date.py @@ -33,7 +33,7 @@ class DateField(Field): """ def __init__(self, doc, **kwargs): - Field.__init__(self, doc, datetime.date, datetime.datetime, **kwargs) + super(DateField, self).__init__(doc, datetime.date, datetime.datetime, **kwargs) def __setattr__(self, name, value): if name == 'value': @@ -52,7 +52,7 @@ class TimeField(Field): """ def __init__(self, doc, **kwargs): - Field.__init__(self, doc, datetime.time, datetime.datetime, **kwargs) + super(TimeField, self).__init__(doc, datetime.time, datetime.datetime, **kwargs) class DeltaField(Field): @@ -61,7 +61,7 @@ class DeltaField(Field): """ def __init__(self, doc, **kwargs): - Field.__init__(self, doc, datetime.timedelta, **kwargs) + super(DeltaField, self).__init__(doc, datetime.timedelta, **kwargs) def convert(self, value): if isinstance(value, (int, long)): diff --git a/weboob/capabilities/gallery.py b/weboob/capabilities/gallery.py index 3034a59625..5803701896 100644 --- a/weboob/capabilities/gallery.py +++ b/weboob/capabilities/gallery.py @@ -44,7 +44,7 @@ class BaseGallery(BaseObject): def __init__(self, _id, title=NotLoaded, url=NotLoaded, cardinality=NotLoaded, date=NotLoaded, rating=NotLoaded, rating_max=NotLoaded, thumbnail=NotLoaded, thumbnail_url=None, nsfw=False): - BaseObject.__init__(self, unicode(_id), url) + super(BaseGallery, self).__init__(unicode(_id), url) self.title = title self.date = date @@ -81,7 +81,7 @@ class BaseImage(CIBaseImage): def __init__(self, _id, index=None, thumbnail=NotLoaded, url=NotLoaded, ext=NotLoaded, gallery=None): - BaseObject.__init__(self, unicode(_id), url) + super(BaseImage, self).__init__(unicode(_id), url) self.index = index self.thumbnail = thumbnail diff --git a/weboob/capabilities/housing.py b/weboob/capabilities/housing.py index 2914c2ea4c..651d9b4546 100644 --- a/weboob/capabilities/housing.py +++ b/weboob/capabilities/housing.py @@ -33,7 +33,7 @@ class TypeNotSupported(UserError): def __init__(self, msg='This type of house is not supported by this module'): - UserError.__init__(self, msg) + super(TypeNotSupported, self).__init__(msg) class HousingPhoto(BaseObject): @@ -43,7 +43,7 @@ class HousingPhoto(BaseObject): data = BytesField('Data of photo') def __init__(self, url): - BaseObject.__init__(self, url.split('/')[-1], url) + super(HousingPhoto, self).__init__(url.split('/')[-1], url) def __iscomplete__(self): return self.data diff --git a/weboob/capabilities/parcel.py b/weboob/capabilities/parcel.py index 3a7376cc26..a0055e4683 100644 --- a/weboob/capabilities/parcel.py +++ b/weboob/capabilities/parcel.py @@ -64,4 +64,4 @@ class ParcelNotFound(UserError): """ def __init__(self, msg='Account not found'): - UserError.__init__(self, msg) + super(ParcelNotFound, self).__init__(msg) diff --git a/weboob/capabilities/paste.py b/weboob/capabilities/paste.py index 157149d0eb..5e403997ab 100644 --- a/weboob/capabilities/paste.py +++ b/weboob/capabilities/paste.py @@ -45,7 +45,7 @@ class BasePaste(BaseObject): def __init__(self, _id, title=NotLoaded, language=NotLoaded, contents=NotLoaded, public=NotLoaded, url=None): - BaseObject.__init__(self, unicode(_id), url) + super(BasePaste, self).__init__(unicode(_id), url) self.title = title self.language = language diff --git a/weboob/capabilities/pricecomparison.py b/weboob/capabilities/pricecomparison.py index 78bc448e2e..3af6220be4 100644 --- a/weboob/capabilities/pricecomparison.py +++ b/weboob/capabilities/pricecomparison.py @@ -31,7 +31,7 @@ class PriceNotFound(UserError): """ def __init__(self, msg='Price not found'): - UserError.__init__(self, msg) + super(PriceNotFound, self).__init__(msg) class Product(BaseObject): diff --git a/weboob/capabilities/recipe.py b/weboob/capabilities/recipe.py index 521bce8344..2375fa17b8 100644 --- a/weboob/capabilities/recipe.py +++ b/weboob/capabilities/recipe.py @@ -67,7 +67,7 @@ class Recipe(BaseObject): comments = Field('User comments about the recipe', list) def __init__(self, id='', title=u'', url=None): - BaseObject.__init__(self, id, url) + super(Recipe, self).__init__(id, url) self.title = title def toKrecipesXml(self, author=None): diff --git a/weboob/capabilities/shop.py b/weboob/capabilities/shop.py index 110236dcb9..05a128d112 100644 --- a/weboob/capabilities/shop.py +++ b/weboob/capabilities/shop.py @@ -32,7 +32,7 @@ class OrderNotFound(UserError): """ def __init__(self, msg='Order not found'): - UserError.__init__(self, msg) + super(OrderNotFound, self).__init__(msg) class Order(BaseObject): diff --git a/weboob/capabilities/subtitle.py b/weboob/capabilities/subtitle.py index 83bc80523b..52954452e8 100644 --- a/weboob/capabilities/subtitle.py +++ b/weboob/capabilities/subtitle.py @@ -30,7 +30,7 @@ class LanguageNotSupported(UserError): """ def __init__(self, msg='language is not supported'): - UserError.__init__(self, msg) + super(LanguageNotSupported, self).__init__(msg) class Subtitle(BaseObject): @@ -44,7 +44,7 @@ class Subtitle(BaseObject): description=StringField('Description of corresponding video') def __init__(self, id, name, url=None): - BaseObject.__init__(self, id, url) + super(Subtitle, self).__init__(id, url) self.name = name diff --git a/weboob/capabilities/torrent.py b/weboob/capabilities/torrent.py index 6bc1d64177..427a601487 100644 --- a/weboob/capabilities/torrent.py +++ b/weboob/capabilities/torrent.py @@ -32,7 +32,7 @@ class MagnetOnly(UserError): def __init__(self, magnet): self.magnet = magnet - UserError.__init__(self, 'Only magnet URL is available') + super(MagnetOnly, self).__init__('Only magnet URL is available') class Torrent(BaseObject): diff --git a/weboob/capabilities/translate.py b/weboob/capabilities/translate.py index a144108634..7639a5c7ee 100644 --- a/weboob/capabilities/translate.py +++ b/weboob/capabilities/translate.py @@ -30,7 +30,7 @@ class LanguageNotSupported(UserError): """ def __init__(self, msg='language is not supported'): - UserError.__init__(self, msg) + super(LanguageNotSupported, self).__init__(msg) class TranslationFail(UserError): @@ -39,7 +39,7 @@ class TranslationFail(UserError): """ def __init__(self, msg='No Translation Available'): - UserError.__init__(self, msg) + super(TranslationFail, self).__init__(msg) class Translation(BaseObject): diff --git a/weboob/capabilities/travel.py b/weboob/capabilities/travel.py index 1e4c200a95..449055f7e0 100644 --- a/weboob/capabilities/travel.py +++ b/weboob/capabilities/travel.py @@ -33,7 +33,7 @@ class Station(BaseObject): name = StringField('Name of station') def __init__(self, id=None, name=None, url=None): - BaseObject.__init__(self, id, url) + super(Station, self).__init__(id, url) self.name = name def __repr__(self): @@ -56,7 +56,7 @@ class Departure(BaseObject): currency = StringField('Currency', default=None) def __init__(self, id=None, _type=None, _time=None, url=None): - BaseObject.__init__(self, id, url) + super(Departure, self).__init__(id, url) self.type = _type self.time = _time @@ -92,7 +92,7 @@ class RoadmapFilters(BaseObject): arrival_time = DateField('Wanted arrival time') def __init__(self, id='', url=None): - BaseObject.__init__(self, id, url) + super(RoadmapFilters, self).__init__(id, url) class CapTravel(Capability): diff --git a/weboob/capabilities/weather.py b/weboob/capabilities/weather.py index c2fbc6a8c5..0248f68d83 100644 --- a/weboob/capabilities/weather.py +++ b/weboob/capabilities/weather.py @@ -35,7 +35,7 @@ class Temperature(BaseObject): unit = StringField('Input unit') def __init__(self, value=NotLoaded, unit = u'', url=None): - BaseObject.__init__(self, unicode(value), url) + super(Temperature, self).__init__(unicode(value), url) self.value = value if unit not in [u'C', u'F']: unit = u'' @@ -73,7 +73,7 @@ class Forecast(BaseObject): text = StringField('Comment on forecast') def __init__(self, date=NotLoaded, low=None, high=None, text=None, unit=None, url=None): - BaseObject.__init__(self, unicode(date), url) + super(Forecast, self).__init__(unicode(date), url) self.date = date self.low = Temperature(low, unit) self.high = Temperature(high, unit) @@ -89,7 +89,7 @@ class Current(BaseObject): temp = Field('Current temperature', Temperature) def __init__(self, date=NotLoaded, temp=None, text=None, unit=None, url=None): - BaseObject.__init__(self, unicode(date), url) + super(Current, self).__init__(unicode(date), url) self.date = date self.text = text self.temp = Temperature(temp, unit) @@ -102,7 +102,7 @@ class City(BaseObject): name = StringField('Name of city') def __init__(self, id='', name=None, url=None): - BaseObject.__init__(self, id, url) + super(City, self).__init__(id, url) self.name = name diff --git a/weboob/core/bcall.py b/weboob/core/bcall.py index 5bc01e02ac..fcf01998dd 100644 --- a/weboob/core/bcall.py +++ b/weboob/core/bcall.py @@ -40,7 +40,7 @@ def __init__(self, errors): '\n'.join(['Module(%r): %r\n%r\n' % (backend, error, backtrace) for backend, error, backtrace in errors]) - Exception.__init__(self, msg) + super(CallErrors, self).__init__(msg) self.errors = copy(errors) def __iter__(self): diff --git a/weboob/core/ouiboube.py b/weboob/core/ouiboube.py index 437c11adef..b8b9c2a190 100644 --- a/weboob/core/ouiboube.py +++ b/weboob/core/ouiboube.py @@ -121,7 +121,7 @@ class LoadError(Exception): """ def __init__(self, backend_name, exception): - Exception.__init__(self, unicode(exception)) + super(WebNip.LoadError, self).__init__(unicode(exception)) self.backend_name = backend_name def load_backend(self, module_name, name, params=None, storage=None): diff --git a/weboob/core/repositories.py b/weboob/core/repositories.py index a81cd9da1c..9a0e33a37e 100644 --- a/weboob/core/repositories.py +++ b/weboob/core/repositories.py @@ -740,7 +740,7 @@ def url2filename(url): class InvalidSignature(Exception): def __init__(self, filename): self.filename = filename - Exception.__init__(self, 'Invalid signature for %s' % filename) + super(InvalidSignature, self).__init__('Invalid signature for %s' % filename) class Keyring(object): diff --git a/weboob/exceptions.py b/weboob/exceptions.py index 38ddc82f55..d7288c9852 100644 --- a/weboob/exceptions.py +++ b/weboob/exceptions.py @@ -78,7 +78,7 @@ class ModuleInstallError(Exception): class ModuleLoadError(Exception): def __init__(self, module_name, msg): - Exception.__init__(self, msg) + super(ModuleLoadError, self).__init__(msg) self.module = module_name diff --git a/weboob/tools/application/base.py b/weboob/tools/application/base.py index ab134184ce..1963eb899a 100644 --- a/weboob/tools/application/base.py +++ b/weboob/tools/application/base.py @@ -142,6 +142,7 @@ def handle_application_options(self): # ------ Application methods ------------------------------- def __init__(self, option_parser=None): + super(Application, self).__init__() self.encoding = self.guess_encoding() self.logger = getLogger(self.APPNAME) self.weboob = self.create_weboob() diff --git a/weboob/tools/application/console.py b/weboob/tools/application/console.py index 0b26ecc3fc..acdfba0984 100644 --- a/weboob/tools/application/console.py +++ b/weboob/tools/application/console.py @@ -53,7 +53,7 @@ class BackendNotGiven(Exception): def __init__(self, id, backends): self.id = id self.backends = sorted(backends) - Exception.__init__(self, 'Please specify a backend to use for this argument (%s@backend_name). ' + super(BackendNotGiven, self).__init__('Please specify a backend to use for this argument (%s@backend_name). ' 'Availables: %s.' % (id, ', '.join(name for name, backend in backends))) @@ -94,7 +94,7 @@ class ConsoleApplication(Application): NC = '' # no color def __init__(self, option_parser=None): - Application.__init__(self, option_parser) + super(ConsoleApplication, self).__init__(option_parser) self.weboob.requests.register('login', self.login_cb) self.enabled_backends = set() diff --git a/weboob/tools/application/formatters/iformatter.py b/weboob/tools/application/formatters/iformatter.py index a7b3979920..390d49c4c9 100644 --- a/weboob/tools/application/formatters/iformatter.py +++ b/weboob/tools/application/formatters/iformatter.py @@ -71,7 +71,7 @@ def readch(): class MandatoryFieldsNotFound(Exception): def __init__(self, missing_fields): - Exception.__init__(self, u'Mandatory fields not found: %s.' % ', '.join(missing_fields)) + super(MandatoryFieldsNotFound, self).__init__(u'Mandatory fields not found: %s.' % ', '.join(missing_fields)) class IFormatter(object): diff --git a/weboob/tools/application/formatters/json.py b/weboob/tools/application/formatters/json.py index 191a8bf34f..b95e099b5d 100644 --- a/weboob/tools/application/formatters/json.py +++ b/weboob/tools/application/formatters/json.py @@ -31,7 +31,7 @@ class JsonFormatter(IFormatter): """ def __init__(self): - IFormatter.__init__(self) + super(JsonFormatter, self).__init__() self.queue = [] def flush(self): diff --git a/weboob/tools/application/formatters/multiline.py b/weboob/tools/application/formatters/multiline.py index 340422cec0..d3a5d447c0 100644 --- a/weboob/tools/application/formatters/multiline.py +++ b/weboob/tools/application/formatters/multiline.py @@ -27,7 +27,7 @@ class MultilineFormatter(IFormatter): def __init__(self, key_value_separator=u': ', after_item=u'\n'): - IFormatter.__init__(self) + super(MultilineFormatter, self).__init__() self.key_value_separator = key_value_separator self.after_item = after_item diff --git a/weboob/tools/application/formatters/simple.py b/weboob/tools/application/formatters/simple.py index c8255acb2c..c883075634 100644 --- a/weboob/tools/application/formatters/simple.py +++ b/weboob/tools/application/formatters/simple.py @@ -26,7 +26,7 @@ class SimpleFormatter(IFormatter): def __init__(self, field_separator=u'\t', key_value_separator=u'='): - IFormatter.__init__(self) + super(SimpleFormatter, self).__init__() self.field_separator = field_separator self.key_value_separator = key_value_separator diff --git a/weboob/tools/application/formatters/table.py b/weboob/tools/application/formatters/table.py index 67c0415377..751e1511a5 100644 --- a/weboob/tools/application/formatters/table.py +++ b/weboob/tools/application/formatters/table.py @@ -32,7 +32,7 @@ class TableFormatter(IFormatter): HTML = False def __init__(self): - IFormatter.__init__(self) + super(TableFormatter, self).__init__() self.queue = [] self.keys = None self.header = None diff --git a/weboob/tools/application/formatters/webkit/webkitgtk.py b/weboob/tools/application/formatters/webkit/webkitgtk.py index b3283f2f1a..780aa8e929 100644 --- a/weboob/tools/application/formatters/webkit/webkitgtk.py +++ b/weboob/tools/application/formatters/webkit/webkitgtk.py @@ -32,7 +32,7 @@ class WebBrowser(gtk.Window): def __init__(self): - gtk.Window.__init__(self) + super(WebBrowser, self).__init__() self.connect('destroy', gtk.main_quit) self.set_default_size(800, 600) self.web_view = webkit.WebView() diff --git a/weboob/tools/application/media_player.py b/weboob/tools/application/media_player.py index a5a45502ea..acd59ab7ad 100644 --- a/weboob/tools/application/media_player.py +++ b/weboob/tools/application/media_player.py @@ -44,13 +44,13 @@ class MediaPlayerNotFound(Exception): def __init__(self): - Exception.__init__(self, u'No media player found on this system. Please install one of them: %s.' % + super(MediaPlayerNotFound, self).__init__(u'No media player found on this system. Please install one of them: %s.' % ', '.join(player[0] for player in PLAYERS)) class InvalidMediaPlayer(Exception): def __init__(self, player_name): - Exception.__init__(self, u'Invalid media player: %s. Valid media players: %s.' % ( + super(InvalidMediaPlayer, self).__init__(u'Invalid media player: %s. Valid media players: %s.' % ( player_name, ', '.join(player[0] for player in PLAYERS))) diff --git a/weboob/tools/application/qt5/backendcfg.py b/weboob/tools/application/qt5/backendcfg.py index e5af408d0c..0cb209325e 100644 --- a/weboob/tools/application/qt5/backendcfg.py +++ b/weboob/tools/application/qt5/backendcfg.py @@ -44,7 +44,7 @@ class RepositoriesDialog(QDialog): def __init__(self, filename, parent=None): - QDialog.__init__(self, parent) + super(RepositoriesDialog, self).__init__(parent) self.filename = filename self.ui = Ui_RepositoriesDlg() self.ui.setupUi(self) @@ -65,7 +65,7 @@ class IconFetcher(QThread): retrieved = Signal() def __init__(self, weboob, item, minfo): - QThread.__init__(self) + super(IconFetcher, self).__init__() self.weboob = weboob self.items = [item] self.minfo = minfo @@ -77,7 +77,7 @@ def run(self): class ProgressDialog(IProgress, QProgressDialog): def __init__(self, *args, **kwargs): - QProgressDialog.__init__(self, *args, **kwargs) + super(ProgressDialog, self).__init__(*args, **kwargs) def progress(self, percent, message): self.setValue(int(percent * 100)) @@ -94,7 +94,7 @@ def prompt(self, message): class BackendCfg(QDialog): def __init__(self, weboob, caps=None, parent=None): - QDialog.__init__(self, parent) + super(BackendCfg, self).__init__(parent) self.ui = Ui_BackendCfg() self.ui.setupUi(self) diff --git a/weboob/tools/application/qt5/qt.py b/weboob/tools/application/qt5/qt.py index b720e02e06..159b5ab43e 100644 --- a/weboob/tools/application/qt5/qt.py +++ b/weboob/tools/application/qt5/qt.py @@ -102,7 +102,7 @@ def __call__(self): class LoginRequest(Request): def __init__(self, backend_name, value): - QCallbacksManager.Request.__init__(self) + super(QCallbacksManager.LoginRequest, self).__init__() self.backend_name = backend_name self.value = value @@ -117,7 +117,7 @@ def __call__(self): new_request = Signal() def __init__(self, weboob, parent=None): - QObject.__init__(self, parent) + super(QCallbacksManager, self).__init__(parent) self.weboob = weboob self.weboob.requests.register('login', self.callback(self.LoginRequest)) self.mutex = QMutex() @@ -344,7 +344,7 @@ def sizeHint(self, option, index): class _QtValueStr(QLineEdit): def __init__(self, value): - QLineEdit.__init__(self) + super(_QtValueStr, self).__init__() self._value = value if value.default: self.setText(unicode(value.default)) @@ -368,7 +368,7 @@ def get_value(self): class _QtValueBool(QCheckBox): def __init__(self, value): - QCheckBox.__init__(self) + super(_QtValueBool, self).__init__() self._value = value if value.default: self.setChecked(True) @@ -384,7 +384,7 @@ def get_value(self): class _QtValueInt(QSpinBox): def __init__(self, value): - QSpinBox.__init__(self) + super(_QtValueInt, self).__init__() self._value = value if value.default: self.setValue(int(value.default)) @@ -400,7 +400,7 @@ def get_value(self): class _QtValueChoices(QComboBox): def __init__(self, value): - QComboBox.__init__(self) + super(_QtValueChoices, self).__init__() self._value = value for k, l in value.choices.items(): self.addItem(l, QVariant(k)) diff --git a/weboob/tools/application/repl.py b/weboob/tools/application/repl.py index 4a62d7ec1b..5065a369f1 100644 --- a/weboob/tools/application/repl.py +++ b/weboob/tools/application/repl.py @@ -92,7 +92,7 @@ def inner(self, *args, **kwargs): return deco -class ReplApplication(Cmd, ConsoleApplication): +class ReplApplication(ConsoleApplication, Cmd): """ Base application class for Repl applications. """ @@ -112,8 +112,7 @@ class ReplApplication(Cmd, ConsoleApplication): hidden_commands = set(['EOF']) def __init__(self): - Cmd.__init__(self) - ConsoleApplication.__init__(self, ReplOptionParser(self.SYNOPSIS, version=self._get_optparse_version())) + super(ReplApplication, self).__init__(ReplOptionParser(self.SYNOPSIS, version=self._get_optparse_version())) copyright = self.COPYRIGHT.replace('YEAR', '%d' % datetime.today().year) self.intro = '\n'.join(('Welcome to %s%s%s v%s' % (self.BOLD, self.APPNAME, self.NC, self.VERSION), diff --git a/weboob/tools/capabilities/bank/transactions.py b/weboob/tools/capabilities/bank/transactions.py index 20ed26ce0a..d051d7506b 100644 --- a/weboob/tools/capabilities/bank/transactions.py +++ b/weboob/tools/capabilities/bank/transactions.py @@ -50,7 +50,7 @@ class FrenchTransaction(Transaction): PATTERNS = [] def __init__(self, id='', *args, **kwargs): - Transaction.__init__(self, id, *args, **kwargs) + super(FrenchTransaction, self).__init__(id, *args, **kwargs) self._logger = getLogger('FrenchTransaction') @classmethod diff --git a/weboob/tools/test.py b/weboob/tools/test.py index c624394c5b..f96f9db4fe 100644 --- a/weboob/tools/test.py +++ b/weboob/tools/test.py @@ -39,7 +39,7 @@ class BackendTest(TestCase): MODULE = None def __init__(self, *args, **kwargs): - TestCase.__init__(self, *args, **kwargs) + super(BackendTest, self).__init__(*args, **kwargs) self.backends = {} self.backend_instance = None -- GitLab