Commit 34f05a00 authored by ntome's avatar ntome

core: use super to call parent constructors

parent 7816b982
......@@ -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:
......
......@@ -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):
......
......@@ -47,7 +47,7 @@ __all__ = ['Monboob']
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 @@ class FakeSMTPD(SMTPServer):
class MonboobScheduler(Scheduler):
def __init__(self, app):
Scheduler.__init__(self)
super(MonboobScheduler, self).__init__()
self.app = app
def run(self):
......
......@@ -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):
......
......@@ -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):
......
......@@ -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):
......
......@@ -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):
......
......@@ -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):
......
......@@ -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):
......
......@@ -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):
......
......@@ -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
......
......@@ -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):
......
......@@ -31,7 +31,7 @@ class CollectionNotFound(UserError):
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:
......
......@@ -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
......
......@@ -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)):
......
......@@ -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
......
......@@ -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
......
......@@ -64,4 +64,4 @@ class ParcelNotFound(UserError):
"""
def __init__(self, msg='Account not found'):
UserError.__init__(self, msg)
super(ParcelNotFound, self).__init__(msg)
......@@ -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
......
......@@ -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):
......
......@@ -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):
......
......@@ -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):
......
......@@ -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
......
......@@ -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):
......
......@@ -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):
......
......@@ -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):
......
......@@ -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
......
......@@ -40,7 +40,7 @@ class CallErrors(Exception):
'\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):
......
......@@ -121,7 +121,7 @@ class WebNip(object):
"""
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):
......
......@@ -740,7 +740,7 @@ class Repositories(object):
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):
......
......@@ -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
......
......@@ -142,6 +142,7 @@ class Application(object):
# ------ 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()
......
......@@ -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()
......
......@@ -71,7 +71,7 @@ __all__ = ['IFormatter', 'MandatoryFieldsNotFound']
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):
......
......@@ -31,7 +31,7 @@ class JsonFormatter(IFormatter):
"""
def __init__(self):
IFormatter.__init__(self)
super(JsonFormatter, self).__init__()
self.queue = []
def flush(self):
......
......@@ -27,7 +27,7 @@ __all__ = ['MultilineFormatter']
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
......
......@@ -26,7 +26,7 @@ __all__ = ['SimpleFormatter']
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
......
......@@ -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
......
......@@ -32,7 +32,7 @@ __all__ = ['WebkitGtkFormatter']
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()
......
......@@ -44,13 +44,13 @@ PLAYERS = (
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)))
......
......@@ -44,7 +44,7 @@ from .qt import QtValue
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 @@ class IconFetcher(QThread):
class ProgressDialog(IProgress, QProgressDialog):
def __init__(self, *args, **kwargs):
QProgressDialog.__init__(self, *args, **kwargs)