Commit 34f05a00 authored by ntome's avatar ntome

core: use super to call parent constructors

parent 7816b982
...@@ -289,7 +289,7 @@ class Boobathon(ReplApplication): ...@@ -289,7 +289,7 @@ class Boobathon(ReplApplication):
radios = [] radios = []
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
ReplApplication.__init__(self, *args, **kwargs) super(Boobathon, self).__init__(*args, **kwargs)
def main(self, argv): def main(self, argv):
if len(argv) < 2: if len(argv) < 2:
......
...@@ -57,7 +57,7 @@ class Galleroob(ReplApplication): ...@@ -57,7 +57,7 @@ class Galleroob(ReplApplication):
COLLECTION_OBJECTS = (BaseGallery, BaseImage, ) COLLECTION_OBJECTS = (BaseGallery, BaseImage, )
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
ReplApplication.__init__(self, *args, **kwargs) super(Galleroob, self).__init__(*args, **kwargs)
@defaultcount(10) @defaultcount(10)
def do_search(self, pattern): def do_search(self, pattern):
......
...@@ -47,7 +47,7 @@ __all__ = ['Monboob'] ...@@ -47,7 +47,7 @@ __all__ = ['Monboob']
class FakeSMTPD(SMTPServer): class FakeSMTPD(SMTPServer):
def __init__(self, app, bindaddr, port): def __init__(self, app, bindaddr, port):
SMTPServer.__init__(self, (bindaddr, port), None) super(FakeSMTPD, self).__init__((bindaddr, port), None)
self.app = app self.app = app
def process_message(self, peer, mailfrom, rcpttos, data): def process_message(self, peer, mailfrom, rcpttos, data):
...@@ -57,7 +57,7 @@ class FakeSMTPD(SMTPServer): ...@@ -57,7 +57,7 @@ class FakeSMTPD(SMTPServer):
class MonboobScheduler(Scheduler): class MonboobScheduler(Scheduler):
def __init__(self, app): def __init__(self, app):
Scheduler.__init__(self) super(MonboobScheduler, self).__init__()
self.app = app self.app = app
def run(self): def run(self):
......
...@@ -145,7 +145,7 @@ class Radioob(ReplApplication): ...@@ -145,7 +145,7 @@ class Radioob(ReplApplication):
PLAYLIST = [] PLAYLIST = []
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
ReplApplication.__init__(self, *args, **kwargs) super(Radioob, self).__init__(*args, **kwargs)
self.player = MediaPlayer(self.logger) self.player = MediaPlayer(self.logger)
def main(self, argv): def main(self, argv):
......
...@@ -76,7 +76,7 @@ class Videoob(ReplApplication): ...@@ -76,7 +76,7 @@ class Videoob(ReplApplication):
nsfw = True nsfw = True
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
ReplApplication.__init__(self, *args, **kwargs) super(Videoob, self).__init__(*args, **kwargs)
self.player = MediaPlayer(self.logger) self.player = MediaPlayer(self.logger)
def main(self, argv): def main(self, argv):
......
...@@ -39,7 +39,7 @@ class Account(BaseObject): ...@@ -39,7 +39,7 @@ class Account(BaseObject):
properties = Field('List of key/value properties', dict) properties = Field('List of key/value properties', dict)
def __init__(self, id=None, url=None): def __init__(self, id=None, url=None):
BaseObject.__init__(self, id, url) super(Account, self).__init__(id, url)
class StatusField(BaseObject): class StatusField(BaseObject):
......
...@@ -44,7 +44,7 @@ class AccountNotFound(UserError): ...@@ -44,7 +44,7 @@ class AccountNotFound(UserError):
""" """
def __init__(self, msg='Account not found'): def __init__(self, msg='Account not found'):
UserError.__init__(self, msg) super(AccountNotFound, self).__init__(msg)
class RecipientNotFound(UserError): class RecipientNotFound(UserError):
...@@ -53,7 +53,7 @@ class RecipientNotFound(UserError): ...@@ -53,7 +53,7 @@ class RecipientNotFound(UserError):
""" """
def __init__(self, msg='Recipient not found'): def __init__(self, msg='Recipient not found'):
UserError.__init__(self, msg) super(RecipientNotFound, self).__init__(msg)
class TransferError(UserError): class TransferError(UserError):
...@@ -157,7 +157,7 @@ class BaseAccount(BaseObject, Currency): ...@@ -157,7 +157,7 @@ class BaseAccount(BaseObject, Currency):
bank_name = StringField('Bank Name') bank_name = StringField('Bank Name')
def __init__(self, id='0', url=None): def __init__(self, id='0', url=None):
BaseObject.__init__(self, id, url) super(BaseAccount, self).__init__(id, url)
@property @property
def currency_text(self): def currency_text(self):
......
...@@ -98,8 +98,7 @@ class FieldNotFound(Exception): ...@@ -98,8 +98,7 @@ class FieldNotFound(Exception):
""" """
def __init__(self, obj, field): def __init__(self, obj, field):
Exception.__init__(self, super(FieldNotFound, self).__init__(u'Field "%s" not found for object %s' % (field, obj))
u'Field "%s" not found for object %s' % (field, obj))
class ConversionWarning(UserWarning): class ConversionWarning(UserWarning):
...@@ -225,7 +224,7 @@ class IntField(Field): ...@@ -225,7 +224,7 @@ class IntField(Field):
""" """
def __init__(self, doc, **kwargs): def __init__(self, doc, **kwargs):
Field.__init__(self, doc, int, long, **kwargs) super(IntField, self).__init__(doc, int, long, **kwargs)
def convert(self, value): def convert(self, value):
return int(value) return int(value)
...@@ -237,7 +236,7 @@ class BoolField(Field): ...@@ -237,7 +236,7 @@ class BoolField(Field):
""" """
def __init__(self, doc, **kwargs): def __init__(self, doc, **kwargs):
Field.__init__(self, doc, bool, **kwargs) super(BoolField, self).__init__(doc, bool, **kwargs)
def convert(self, value): def convert(self, value):
return bool(value) return bool(value)
...@@ -249,7 +248,7 @@ class DecimalField(Field): ...@@ -249,7 +248,7 @@ class DecimalField(Field):
""" """
def __init__(self, doc, **kwargs): def __init__(self, doc, **kwargs):
Field.__init__(self, doc, Decimal, **kwargs) super(DecimalField, self).__init__(doc, Decimal, **kwargs)
def convert(self, value): def convert(self, value):
if isinstance(value, Decimal): if isinstance(value, Decimal):
...@@ -263,7 +262,7 @@ class FloatField(Field): ...@@ -263,7 +262,7 @@ class FloatField(Field):
""" """
def __init__(self, doc, **kwargs): def __init__(self, doc, **kwargs):
Field.__init__(self, doc, float, **kwargs) super(FloatField, self).__init__(doc, float, **kwargs)
def convert(self, value): def convert(self, value):
return float(value) return float(value)
...@@ -275,7 +274,7 @@ class StringField(Field): ...@@ -275,7 +274,7 @@ class StringField(Field):
""" """
def __init__(self, doc, **kwargs): def __init__(self, doc, **kwargs):
Field.__init__(self, doc, unicode, **kwargs) super(StringField, self).__init__(doc, unicode, **kwargs)
def convert(self, value): def convert(self, value):
return to_unicode(value) return to_unicode(value)
...@@ -287,7 +286,7 @@ class BytesField(Field): ...@@ -287,7 +286,7 @@ class BytesField(Field):
""" """
def __init__(self, doc, **kwargs): def __init__(self, doc, **kwargs):
Field.__init__(self, doc, bytes, **kwargs) super(BytesField, self).__init__(doc, bytes, **kwargs)
def convert(self, value): def convert(self, value):
if isinstance(value, unicode): if isinstance(value, unicode):
......
...@@ -32,7 +32,7 @@ class SubscriptionNotFound(UserError): ...@@ -32,7 +32,7 @@ class SubscriptionNotFound(UserError):
""" """
def __init__(self, msg='Subscription not found'): def __init__(self, msg='Subscription not found'):
UserError.__init__(self, msg) super(SubscriptionNotFound, self).__init__(msg)
class DocumentNotFound(UserError): class DocumentNotFound(UserError):
...@@ -41,7 +41,7 @@ class DocumentNotFound(UserError): ...@@ -41,7 +41,7 @@ class DocumentNotFound(UserError):
""" """
def __init__(self, msg='Document not found'): def __init__(self, msg='Document not found'):
UserError.__init__(self, msg) super(DocumentNotFound, self).__init__(msg)
class Detail(BaseObject, Currency): class Detail(BaseObject, Currency):
......
...@@ -47,7 +47,7 @@ class Project(BaseObject): ...@@ -47,7 +47,7 @@ class Project(BaseObject):
priorities = Field('Available priorities for issues', list) priorities = Field('Available priorities for issues', list)
def __init__(self, id, name, url=None): def __init__(self, id, name, url=None):
BaseObject.__init__(self, id, url) super(Project, self).__init__(id, url)
self.name = unicode(name) self.name = unicode(name)
def __repr__(self): def __repr__(self):
...@@ -114,7 +114,7 @@ class User(BaseObject): ...@@ -114,7 +114,7 @@ class User(BaseObject):
name = StringField('Name of user') name = StringField('Name of user')
def __init__(self, id, name, url=None): def __init__(self, id, name, url=None):
BaseObject.__init__(self, id, url) super(User, self).__init__(id, url)
self.name = unicode(name) self.name = unicode(name)
def __repr__(self): def __repr__(self):
...@@ -128,7 +128,7 @@ class Version(BaseObject): ...@@ -128,7 +128,7 @@ class Version(BaseObject):
name = StringField('Name of version') name = StringField('Name of version')
def __init__(self, id, name, url=None): def __init__(self, id, name, url=None):
BaseObject.__init__(self, id, url) super(Version, self).__init__(id, url)
self.name = unicode(name) self.name = unicode(name)
def __repr__(self): def __repr__(self):
...@@ -151,7 +151,7 @@ class Status(BaseObject): ...@@ -151,7 +151,7 @@ class Status(BaseObject):
value = IntField('Value of status (constants VALUE_*)') value = IntField('Value of status (constants VALUE_*)')
def __init__(self, id, name, value, url=None): def __init__(self, id, name, value, url=None):
BaseObject.__init__(self, id, url) super(Status, self).__init__(id, url)
self.name = unicode(name) self.name = unicode(name)
self.value = value self.value = value
...@@ -229,7 +229,7 @@ class Query(BaseObject): ...@@ -229,7 +229,7 @@ class Query(BaseObject):
status = StringField('Filter on statuses') status = StringField('Filter on statuses')
def __init__(self, id='', url=None): def __init__(self, id='', url=None):
BaseObject.__init__(self, id, url) super(Query, self).__init__(id, url)
class CapBugTracker(Capability): class CapBugTracker(Capability):
......
...@@ -43,7 +43,7 @@ class ChatMessage(BaseObject): ...@@ -43,7 +43,7 @@ class ChatMessage(BaseObject):
date = DateField('Date when the message has been sent') date = DateField('Date when the message has been sent')
def __init__(self, id_from, id_to, message, date=None, url=None): 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_from = id_from
self.id_to = id_to self.id_to = id_to
self.message = message self.message = message
......
...@@ -43,7 +43,7 @@ class Movie(BaseObject): ...@@ -43,7 +43,7 @@ class Movie(BaseObject):
thumbnail_url = StringField('Url of movie thumbnail') thumbnail_url = StringField('Url of movie thumbnail')
def __init__(self, id, original_title, url=None): def __init__(self, id, original_title, url=None):
BaseObject.__init__(self, id, url) super(Movie, self).__init__(id, url)
self.original_title = original_title self.original_title = original_title
def get_roles_by_person_name(self,name): def get_roles_by_person_name(self,name):
...@@ -79,7 +79,7 @@ class Person(BaseObject): ...@@ -79,7 +79,7 @@ class Person(BaseObject):
thumbnail_url = StringField('Url of person thumbnail') thumbnail_url = StringField('Url of person thumbnail')
def __init__(self, id, name, url=None): def __init__(self, id, name, url=None):
BaseObject.__init__(self, id, url) super(Person, self).__init__(id, url)
self.name = name self.name = name
def get_roles_by_movie_title(self,title): def get_roles_by_movie_title(self,title):
......
...@@ -31,7 +31,7 @@ class CollectionNotFound(UserError): ...@@ -31,7 +31,7 @@ class CollectionNotFound(UserError):
msg = 'Collection not found: %s' % '/'.join(split_path) msg = 'Collection not found: %s' % '/'.join(split_path)
else: else:
msg = 'Collection not found' msg = 'Collection not found'
UserError.__init__(self, msg) super(CollectionNotFound, self).__init__(msg)
class BaseCollection(BaseObject): class BaseCollection(BaseObject):
...@@ -41,7 +41,7 @@ class BaseCollection(BaseObject): ...@@ -41,7 +41,7 @@ class BaseCollection(BaseObject):
""" """
def __init__(self, split_path, id=None, url=None): 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 self.split_path = split_path
@property @property
...@@ -85,7 +85,7 @@ class Collection(BaseCollection): ...@@ -85,7 +85,7 @@ class Collection(BaseCollection):
def __init__(self, split_path=None, title=None, id=None, url=None): def __init__(self, split_path=None, title=None, id=None, url=None):
self.title = title self.title = title
BaseCollection.__init__(self, split_path, id, url) super(Collection, self).__init__(split_path, id, url)
def __unicode__(self): def __unicode__(self):
if self.title and self.basename: if self.title and self.basename:
......
...@@ -57,7 +57,7 @@ class ContactPhoto(BaseObject): ...@@ -57,7 +57,7 @@ class ContactPhoto(BaseObject):
hidden = BoolField('True if the photo is hidden on website') hidden = BoolField('True if the photo is hidden on website')
def __init__(self, name, url=None): def __init__(self, name, url=None):
BaseObject.__init__(self, name, url) super(ContactPhoto, self).__init__(name, url)
self.name = name self.name = name
def __iscomplete__(self): def __iscomplete__(self):
...@@ -108,7 +108,7 @@ class Contact(BaseContact): ...@@ -108,7 +108,7 @@ class Contact(BaseContact):
profile = Field('Contact profile', dict, default=OrderedDict()) profile = Field('Contact profile', dict, default=OrderedDict())
def __init__(self, id, name, status, url=None): def __init__(self, id, name, status, url=None):
BaseObject.__init__(self, id, url) super(Contact, self).__init__(id, url)
self.name = name self.name = name
self.status = status self.status = status
...@@ -180,7 +180,7 @@ class Query(BaseObject): ...@@ -180,7 +180,7 @@ class Query(BaseObject):
message = StringField('Message received') message = StringField('Message received')
def __init__(self, id, message, url=None): def __init__(self, id, message, url=None):
BaseObject.__init__(self, id, url) super(Query, self).__init__(id, url)
self.message = message self.message = message
......
...@@ -33,7 +33,7 @@ class DateField(Field): ...@@ -33,7 +33,7 @@ class DateField(Field):
""" """
def __init__(self, doc, **kwargs): 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): def __setattr__(self, name, value):
if name == 'value': if name == 'value':
...@@ -52,7 +52,7 @@ class TimeField(Field): ...@@ -52,7 +52,7 @@ class TimeField(Field):
""" """
def __init__(self, doc, **kwargs): 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): class DeltaField(Field):
...@@ -61,7 +61,7 @@ class DeltaField(Field): ...@@ -61,7 +61,7 @@ class DeltaField(Field):
""" """
def __init__(self, doc, **kwargs): def __init__(self, doc, **kwargs):
Field.__init__(self, doc, datetime.timedelta, **kwargs) super(DeltaField, self).__init__(doc, datetime.timedelta, **kwargs)
def convert(self, value): def convert(self, value):
if isinstance(value, (int, long)): if isinstance(value, (int, long)):
......
...@@ -44,7 +44,7 @@ class BaseGallery(BaseObject): ...@@ -44,7 +44,7 @@ class BaseGallery(BaseObject):
def __init__(self, _id, title=NotLoaded, url=NotLoaded, cardinality=NotLoaded, date=NotLoaded, def __init__(self, _id, title=NotLoaded, url=NotLoaded, cardinality=NotLoaded, date=NotLoaded,
rating=NotLoaded, rating_max=NotLoaded, thumbnail=NotLoaded, thumbnail_url=None, nsfw=False): 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.title = title
self.date = date self.date = date
...@@ -81,7 +81,7 @@ class BaseImage(CIBaseImage): ...@@ -81,7 +81,7 @@ class BaseImage(CIBaseImage):
def __init__(self, _id, index=None, thumbnail=NotLoaded, url=NotLoaded, def __init__(self, _id, index=None, thumbnail=NotLoaded, url=NotLoaded,
ext=NotLoaded, gallery=None): ext=NotLoaded, gallery=None):
BaseObject.__init__(self, unicode(_id), url) super(BaseImage, self).__init__(unicode(_id), url)
self.index = index self.index = index
self.thumbnail = thumbnail self.thumbnail = thumbnail
......
...@@ -33,7 +33,7 @@ class TypeNotSupported(UserError): ...@@ -33,7 +33,7 @@ class TypeNotSupported(UserError):
def __init__(self, def __init__(self,
msg='This type of house is not supported by this module'): msg='This type of house is not supported by this module'):
UserError.__init__(self, msg) super(TypeNotSupported, self).__init__(msg)
class HousingPhoto(BaseObject): class HousingPhoto(BaseObject):
...@@ -43,7 +43,7 @@ class HousingPhoto(BaseObject): ...@@ -43,7 +43,7 @@ class HousingPhoto(BaseObject):
data = BytesField('Data of photo') data = BytesField('Data of photo')
def __init__(self, url): def __init__(self, url):
BaseObject.__init__(self, url.split('/')[-1], url) super(HousingPhoto, self).__init__(url.split('/')[-1], url)
def __iscomplete__(self): def __iscomplete__(self):
return self.data return self.data
......
...@@ -64,4 +64,4 @@ class ParcelNotFound(UserError): ...@@ -64,4 +64,4 @@ class ParcelNotFound(UserError):
""" """
def __init__(self, msg='Account not found'): def __init__(self, msg='Account not found'):
UserError.__init__(self, msg) super(ParcelNotFound, self).__init__(msg)
...@@ -45,7 +45,7 @@ class BasePaste(BaseObject): ...@@ -45,7 +45,7 @@ class BasePaste(BaseObject):
def __init__(self, _id, title=NotLoaded, language=NotLoaded, contents=NotLoaded, def __init__(self, _id, title=NotLoaded, language=NotLoaded, contents=NotLoaded,
public=NotLoaded, url=None): public=NotLoaded, url=None):
BaseObject.__init__(self, unicode(_id), url) super(BasePaste, self).__init__(unicode(_id), url)
self.title = title self.title = title
self.language = language self.language = language
......
...@@ -31,7 +31,7 @@ class PriceNotFound(UserError): ...@@ -31,7 +31,7 @@ class PriceNotFound(UserError):
""" """
def __init__(self, msg='Price not found'): def __init__(self, msg='Price not found'):
UserError.__init__(self, msg) super(PriceNotFound, self).__init__(msg)
class Product(BaseObject): class Product(BaseObject):
......
...@@ -67,7 +67,7 @@ class Recipe(BaseObject): ...@@ -67,7 +67,7 @@ class Recipe(BaseObject):
comments = Field('User comments about the recipe', list) comments = Field('User comments about the recipe', list)
def __init__(self, id='', title=u'', url=None): def __init__(self, id='', title=u'', url=None):
BaseObject.__init__(self, id, url) super(Recipe, self).__init__(id, url)
self.title = title self.title = title
def toKrecipesXml(self, author=None): def toKrecipesXml(self, author=None):
......
...@@ -32,7 +32,7 @@ class OrderNotFound(UserError): ...@@ -32,7 +32,7 @@ class OrderNotFound(UserError):
""" """
def __init__(self, msg='Order not found'): def __init__(self, msg='Order not found'):
UserError.__init__(self, msg) super(OrderNotFound, self).__init__(msg)
class Order(BaseObject): class Order(BaseObject):
......
...@@ -30,7 +30,7 @@ class LanguageNotSupported(UserError): ...@@ -30,7 +30,7 @@ class LanguageNotSupported(UserError):
""" """
def __init__(self, msg='language is not supported'): def __init__(self, msg='language is not supported'):
UserError.__init__(self, msg) super(LanguageNotSupported, self).__init__(msg)
class Subtitle(BaseObject): class Subtitle(BaseObject):
...@@ -44,7 +44,7 @@ class Subtitle(BaseObject): ...@@ -44,7 +44,7 @@ class Subtitle(BaseObject):
description=StringField('Description of corresponding video') description=StringField('Description of corresponding video')
def __init__(self, id, name, url=None): def __init__(self, id, name, url=None):
BaseObject.__init__(self, id, url) super(Subtitle, self).__init__(id, url)
self.name = name self.name = name
......
...@@ -32,7 +32,7 @@ class MagnetOnly(UserError): ...@@ -32,7 +32,7 @@ class MagnetOnly(UserError):
def __init__(self, magnet): def __init__(self, magnet):
self.magnet = magnet self.magnet = magnet
UserError.__init__(self, 'Only magnet URL is available') super(MagnetOnly, self).__init__('Only magnet URL is available')
class Torrent(BaseObject): class Torrent(BaseObject):
......
...@@ -30,7 +30,7 @@ class LanguageNotSupported(UserError): ...@@ -30,7 +30,7 @@ class LanguageNotSupported(UserError):
""" """
def __init__(self, msg='language is not supported'): def __init__(self, msg='language is not supported'):
UserError.__init__(self, msg) super(LanguageNotSupported, self).__init__(msg)
class TranslationFail(UserError): class TranslationFail(UserError):
...@@ -39,7 +39,7 @@ class TranslationFail(UserError): ...@@ -39,7 +39,7 @@ class TranslationFail(UserError):
""" """
def __init__(self, msg='No Translation Available'): def __init__(self, msg='No Translation Available'):
UserError.__init__(self, msg) super(TranslationFail, self).__init__(msg)
class Translation(BaseObject): class Translation(BaseObject):
......
...@@ -33,7 +33,7 @@ class Station(BaseObject): ...@@ -33,7 +33,7 @@ class Station(BaseObject):
name = StringField('Name of station') name = StringField('Name of station')