rename CapBaseObject to BaseObject (refs #1424)
This commit is contained in:
parent
4529735935
commit
51958135cb
44 changed files with 183 additions and 183 deletions
|
|
@ -13,7 +13,7 @@ Prefer returning objects
|
|||
|
||||
Python is an object-oriented language, so when your capability supports entities (for example
|
||||
:class:`weboob.capabilities.video.BaseVideo` with the :class:`weboob.capabilities.video.ICapVideo` capability),
|
||||
you have to create a class derived from :class:`weboob.capabilities.base.CapBaseObject`, and create an unique method
|
||||
you have to create a class derived from :class:`weboob.capabilities.base.BaseObject`, and create an unique method
|
||||
to get it (for example :func:`get_video() <weboob.capabilities.video.ICapVideo.get_video>`), instead of several methods like
|
||||
``get_video_url()``, ``get_video_preview()``, etc.
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import urllib
|
|||
from weboob.tools.browser2.page import HTMLPage, JsonPage, method, ListElement, ItemElement, FormNotFound, pagination
|
||||
from weboob.tools.browser2.filters import CleanText, Format, Link, Regexp, Env, DateTime, Attr, Filter
|
||||
from weboob.capabilities.messages import Thread, Message
|
||||
from weboob.capabilities.base import CapBaseObject
|
||||
from weboob.capabilities.base import BaseObject
|
||||
__all__ = ['LoginPage', 'LoginErrorPage', 'ThreadPage', 'Tweet', 'TrendsPage', 'TimelinePage', 'HomeTimelinePage', 'SearchTimelinePage']
|
||||
|
||||
|
||||
|
|
@ -118,7 +118,7 @@ class TrendsPage(TwitterJsonHTMLPage):
|
|||
item_xpath = '//li[@class="trend-item js-trend-item "]'
|
||||
|
||||
class item(ItemElement):
|
||||
klass = CapBaseObject
|
||||
klass = BaseObject
|
||||
|
||||
obj_id = Attr('.', 'data-trend-name')
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
import itertools
|
||||
from nose.plugins.skip import SkipTest
|
||||
from weboob.tools.test import BackendTest
|
||||
from weboob.capabilities.base import CapBaseObject
|
||||
from weboob.capabilities.base import BaseObject
|
||||
|
||||
|
||||
class TwitterTest(BackendTest):
|
||||
|
|
@ -43,7 +43,7 @@ class TwitterTest(BackendTest):
|
|||
|
||||
def test_ls_me(self):
|
||||
if self.backend.browser.username:
|
||||
l = list(itertools.islice(self.backend.iter_resources([CapBaseObject], ['me']), 0 ,20))
|
||||
l = list(itertools.islice(self.backend.iter_resources([BaseObject], ['me']), 0 ,20))
|
||||
assert len(l)
|
||||
thread = self.backend.get_thread(l[0].id)
|
||||
assert len(thread.root.content)
|
||||
|
|
@ -51,27 +51,27 @@ class TwitterTest(BackendTest):
|
|||
raise SkipTest("User credentials not defined")
|
||||
|
||||
def test_ls_search(self):
|
||||
l = list(itertools.islice(self.backend.iter_resources([CapBaseObject], ['search', 'weboob']), 0 ,20))
|
||||
l = list(itertools.islice(self.backend.iter_resources([BaseObject], ['search', 'weboob']), 0 ,20))
|
||||
assert len(l)
|
||||
thread = self.backend.get_thread(l[0].id)
|
||||
assert len(thread.root.content)
|
||||
|
||||
def test_ls_hashtag(self):
|
||||
l = list(itertools.islice(self.backend.iter_resources([CapBaseObject], ['hashtags', 'weboob']), 0 ,20))
|
||||
l = list(itertools.islice(self.backend.iter_resources([BaseObject], ['hashtags', 'weboob']), 0 ,20))
|
||||
assert len(l)
|
||||
thread = self.backend.get_thread(l[0].id)
|
||||
assert len(thread.root.content)
|
||||
|
||||
def test_ls_profils(self):
|
||||
l = list(itertools.islice(self.backend.iter_resources([CapBaseObject], ['profils', 'jf_cope']), 0 ,20))
|
||||
l = list(itertools.islice(self.backend.iter_resources([BaseObject], ['profils', 'jf_cope']), 0 ,20))
|
||||
assert len(l)
|
||||
thread = self.backend.get_thread(l[0].id)
|
||||
assert len(thread.root.content)
|
||||
|
||||
def test_ls_trend(self):
|
||||
l = list(self.backend.iter_resources([CapBaseObject], ['trendy']))
|
||||
l = list(self.backend.iter_resources([BaseObject], ['trendy']))
|
||||
assert len(l)
|
||||
l1 = list(itertools.islice(self.backend.iter_resources([CapBaseObject], ['trendy', u'%s' % l[0].split_path[0]]), 0 ,20))
|
||||
l1 = list(itertools.islice(self.backend.iter_resources([BaseObject], ['trendy', u'%s' % l[0].split_path[0]]), 0 ,20))
|
||||
assert len(l1)
|
||||
thread = self.backend.get_thread(l1[0].id)
|
||||
assert len(thread.root.content)
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import os
|
|||
import re
|
||||
import unicodedata
|
||||
|
||||
from weboob.capabilities.base import empty, CapBaseObject
|
||||
from weboob.capabilities.base import empty, BaseObject
|
||||
from weboob.capabilities.bugtracker import ICapBugTracker, Query, Update, Project, Issue, IssueError
|
||||
from weboob.tools.application.repl import ReplApplication, defaultcount
|
||||
from weboob.tools.application.formatters.iformatter import IFormatter, PrettyFormatter
|
||||
|
|
@ -47,7 +47,7 @@ class IssueFormatter(IFormatter):
|
|||
return u''
|
||||
|
||||
value = getattr(obj, attr)
|
||||
if isinstance(value, CapBaseObject):
|
||||
if isinstance(value, BaseObject):
|
||||
value = value.name
|
||||
|
||||
return self.format_key(attr.capitalize(), value)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from .base import UserError, NotLoaded, NotAvailable, CapBaseObject, IBaseCap
|
||||
from .base import UserError, NotLoaded, NotAvailable, BaseObject, IBaseCap
|
||||
|
||||
__all__ = ['UserError', 'NotLoaded', 'NotAvailable', 'CapBaseObject', 'IBaseCap']
|
||||
__all__ = ['UserError', 'NotLoaded', 'NotAvailable', 'BaseObject', 'IBaseCap']
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from .base import IBaseCap, CapBaseObject, StringField, Field, UserError
|
||||
from .base import IBaseCap, BaseObject, StringField, Field, UserError
|
||||
|
||||
|
||||
__all__ = ['AccountRegisterError', 'Account', 'StatusField', 'ICapAccount']
|
||||
|
|
@ -30,7 +30,7 @@ class AccountRegisterError(UserError):
|
|||
"""
|
||||
|
||||
|
||||
class Account(CapBaseObject):
|
||||
class Account(BaseObject):
|
||||
"""
|
||||
Describe an account and its properties.
|
||||
"""
|
||||
|
|
@ -39,7 +39,7 @@ class Account(CapBaseObject):
|
|||
properties = Field('List of key/value properties', dict)
|
||||
|
||||
def __init__(self, id=None):
|
||||
CapBaseObject.__init__(self, id)
|
||||
BaseObject.__init__(self, id)
|
||||
|
||||
|
||||
class StatusField(object):
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import re
|
|||
from datetime import timedelta
|
||||
|
||||
from .image import BaseImage
|
||||
from .base import Field, StringField, IntField, CapBaseObject
|
||||
from .base import Field, StringField, IntField, BaseObject
|
||||
from .file import ICapFile, BaseFile
|
||||
|
||||
|
||||
|
|
@ -44,7 +44,7 @@ def decode_id(decode_id):
|
|||
return wrapper
|
||||
|
||||
|
||||
class Album(CapBaseObject):
|
||||
class Album(BaseObject):
|
||||
"""
|
||||
Represent an album
|
||||
"""
|
||||
|
|
@ -55,7 +55,7 @@ class Album(CapBaseObject):
|
|||
tracks_list = Field('list of tracks', list)
|
||||
|
||||
def __init__(self, _id):
|
||||
CapBaseObject.__init__(self, unicode("album.%s" % _id))
|
||||
BaseObject.__init__(self, unicode("album.%s" % _id))
|
||||
|
||||
@classmethod
|
||||
def decode_id(cls, _id):
|
||||
|
|
@ -66,7 +66,7 @@ class Album(CapBaseObject):
|
|||
return _id
|
||||
|
||||
|
||||
class Playlist(CapBaseObject):
|
||||
class Playlist(BaseObject):
|
||||
"""
|
||||
Represent a playlist
|
||||
"""
|
||||
|
|
@ -74,7 +74,7 @@ class Playlist(CapBaseObject):
|
|||
tracks_list = Field('list of tracks', list)
|
||||
|
||||
def __init__(self, _id):
|
||||
CapBaseObject.__init__(self, unicode("playlist.%s" % _id))
|
||||
BaseObject.__init__(self, unicode("playlist.%s" % _id))
|
||||
|
||||
@classmethod
|
||||
def decode_id(cls, _id):
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import re
|
|||
|
||||
from weboob.tools.compat import basestring, long
|
||||
|
||||
from .base import CapBaseObject, Field, StringField, DateField, DecimalField, IntField, UserError, Currency
|
||||
from .base import BaseObject, Field, StringField, DateField, DecimalField, IntField, UserError, Currency
|
||||
from .collection import ICapCollection
|
||||
|
||||
|
||||
|
|
@ -46,7 +46,7 @@ class TransferError(UserError):
|
|||
"""
|
||||
|
||||
|
||||
class Recipient(CapBaseObject, Currency):
|
||||
class Recipient(BaseObject, Currency):
|
||||
"""
|
||||
Recipient of a transfer.
|
||||
"""
|
||||
|
|
@ -55,7 +55,7 @@ class Recipient(CapBaseObject, Currency):
|
|||
currency = StringField('Currency', default=None)
|
||||
|
||||
def __init__(self):
|
||||
CapBaseObject.__init__(self, 0)
|
||||
BaseObject.__init__(self, 0)
|
||||
|
||||
@property
|
||||
def currency_text(self):
|
||||
|
|
@ -86,7 +86,7 @@ class Account(Recipient):
|
|||
return u"<Account id=%r label=%r>" % (self.id, self.label)
|
||||
|
||||
|
||||
class Transaction(CapBaseObject):
|
||||
class Transaction(BaseObject):
|
||||
"""
|
||||
Bank transaction.
|
||||
"""
|
||||
|
|
@ -131,7 +131,7 @@ class Transaction(CapBaseObject):
|
|||
return "%08x" % (crc & 0xffffffff)
|
||||
|
||||
|
||||
class Investment(CapBaseObject):
|
||||
class Investment(BaseObject):
|
||||
"""
|
||||
Investment in a financial market.
|
||||
"""
|
||||
|
|
@ -145,7 +145,7 @@ class Investment(CapBaseObject):
|
|||
diff = DecimalField('Difference between the buy cost and the current valuation')
|
||||
|
||||
|
||||
class Transfer(CapBaseObject):
|
||||
class Transfer(BaseObject):
|
||||
"""
|
||||
Transfer from an account to a recipient.
|
||||
"""
|
||||
|
|
@ -169,7 +169,7 @@ class ICapBank(ICapCollection):
|
|||
all accounts (by calling :func:`iter_accounts`).
|
||||
|
||||
:param objs: type of objects to get
|
||||
:type objs: tuple[:class:`CapBaseObject`]
|
||||
:type objs: tuple[:class:`BaseObject`]
|
||||
:param split_path: path to discover
|
||||
:type split_path: :class:`list`
|
||||
:rtype: iter[:class:`BaseCapObject`]
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ from weboob.tools.ordereddict import OrderedDict
|
|||
__all__ = ['UserError', 'FieldNotFound', 'NotAvailable',
|
||||
'NotLoaded', 'IBaseCap', 'Field', 'IntField', 'DecimalField',
|
||||
'FloatField', 'StringField', 'BytesField', 'DateField',
|
||||
'DeltaField', 'empty', 'CapBaseObject']
|
||||
'DeltaField', 'empty', 'BaseObject']
|
||||
|
||||
|
||||
def empty(value):
|
||||
|
|
@ -76,7 +76,7 @@ class FieldNotFound(Exception):
|
|||
A field isn't found.
|
||||
|
||||
:param obj: object
|
||||
:type obj: :class:`CapBaseObject`
|
||||
:type obj: :class:`BaseObject`
|
||||
:param field: field not found
|
||||
:type field: :class:`Field`
|
||||
"""
|
||||
|
|
@ -126,7 +126,7 @@ class NotLoadedType(object):
|
|||
"""
|
||||
NotLoaded is a constant to use on not loaded fields.
|
||||
|
||||
When you use :func:`weboob.tools.backend.BaseBackend.fillobj` on a object based on :class:`CapBaseObject`,
|
||||
When you use :func:`weboob.tools.backend.BaseBackend.fillobj` on a object based on :class:`BaseObject`,
|
||||
it will request all fields with this value.
|
||||
"""
|
||||
|
||||
|
|
@ -155,13 +155,13 @@ class IBaseCap(object):
|
|||
A capability may define abstract methods (which raise :class:`NotImplementedError`)
|
||||
with an explicit docstring to tell backends how to implement them.
|
||||
|
||||
Also, it may define some *objects*, using :class:`CapBaseObject`.
|
||||
Also, it may define some *objects*, using :class:`BaseObject`.
|
||||
"""
|
||||
|
||||
|
||||
class Field(object):
|
||||
"""
|
||||
Field of a :class:`CapBaseObject` class.
|
||||
Field of a :class:`BaseObject` class.
|
||||
|
||||
:param doc: docstring of the field
|
||||
:type doc: :class:`str`
|
||||
|
|
@ -284,12 +284,12 @@ class DeltaField(Field):
|
|||
Field.__init__(self, doc, datetime.timedelta, **kwargs)
|
||||
|
||||
|
||||
class _CapBaseObjectMeta(type):
|
||||
class _BaseObjectMeta(type):
|
||||
def __new__(cls, name, bases, attrs):
|
||||
fields = [(field_name, attrs.pop(field_name)) for field_name, obj in attrs.items() if isinstance(obj, Field)]
|
||||
fields.sort(key=lambda x: x[1]._creation_counter)
|
||||
|
||||
new_class = super(_CapBaseObjectMeta, cls).__new__(cls, name, bases, attrs)
|
||||
new_class = super(_BaseObjectMeta, cls).__new__(cls, name, bases, attrs)
|
||||
if new_class._fields is None:
|
||||
new_class._fields = OrderedDict()
|
||||
else:
|
||||
|
|
@ -306,7 +306,7 @@ class _CapBaseObjectMeta(type):
|
|||
return new_class
|
||||
|
||||
|
||||
class CapBaseObject(object):
|
||||
class BaseObject(object):
|
||||
"""
|
||||
This is the base class for a capability object.
|
||||
|
||||
|
|
@ -319,7 +319,7 @@ class CapBaseObject(object):
|
|||
|
||||
For example::
|
||||
|
||||
class Transfer(CapBaseObject):
|
||||
class Transfer(BaseObject):
|
||||
" Transfer from an account to a recipient. "
|
||||
|
||||
amount = DecimalField('Amount to transfer')
|
||||
|
|
@ -330,7 +330,7 @@ class CapBaseObject(object):
|
|||
The docstring is mandatory.
|
||||
"""
|
||||
|
||||
__metaclass__ = _CapBaseObjectMeta
|
||||
__metaclass__ = _BaseObjectMeta
|
||||
|
||||
id = None
|
||||
backend = None
|
||||
|
|
@ -394,7 +394,7 @@ class CapBaseObject(object):
|
|||
yield name, field.value
|
||||
|
||||
def __eq__(self, obj):
|
||||
if isinstance(obj, CapBaseObject):
|
||||
if isinstance(obj, BaseObject):
|
||||
return self.backend == obj.backend and self.id == obj.id
|
||||
else:
|
||||
return False
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from .base import CapBaseObject, StringField, DateField, DecimalField, UserError
|
||||
from .base import BaseObject, StringField, DateField, DecimalField, UserError
|
||||
from .collection import ICapCollection
|
||||
|
||||
|
||||
|
|
@ -41,7 +41,7 @@ class BillNotFound(UserError):
|
|||
UserError.__init__(self, msg)
|
||||
|
||||
|
||||
class Detail(CapBaseObject):
|
||||
class Detail(BaseObject):
|
||||
"""
|
||||
Detail of a subscription
|
||||
"""
|
||||
|
|
@ -55,10 +55,10 @@ class Detail(CapBaseObject):
|
|||
unit = StringField('Unit of the consumption')
|
||||
|
||||
def __init__(self):
|
||||
CapBaseObject.__init__(self, 0)
|
||||
BaseObject.__init__(self, 0)
|
||||
|
||||
|
||||
class Bill(CapBaseObject):
|
||||
class Bill(BaseObject):
|
||||
"""
|
||||
Bill.
|
||||
"""
|
||||
|
|
@ -73,10 +73,10 @@ class Bill(CapBaseObject):
|
|||
finishdate = DateField('The last day the bill applies to')
|
||||
|
||||
def __init__(self):
|
||||
CapBaseObject.__init__(self, 0)
|
||||
BaseObject.__init__(self, 0)
|
||||
|
||||
|
||||
class Subscription(CapBaseObject):
|
||||
class Subscription(BaseObject):
|
||||
"""
|
||||
Subscription to a service.
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from .base import IBaseCap, CapBaseObject, Field, StringField, DateField, \
|
||||
from .base import IBaseCap, BaseObject, Field, StringField, DateField, \
|
||||
IntField, DeltaField, UserError
|
||||
|
||||
|
||||
|
|
@ -32,7 +32,7 @@ class IssueError(UserError):
|
|||
"""
|
||||
|
||||
|
||||
class Project(CapBaseObject):
|
||||
class Project(BaseObject):
|
||||
"""
|
||||
Represents a project.
|
||||
"""
|
||||
|
|
@ -45,7 +45,7 @@ class Project(CapBaseObject):
|
|||
priorities = Field('Available priorities for issues', list)
|
||||
|
||||
def __init__(self, id, name):
|
||||
CapBaseObject.__init__(self, id)
|
||||
BaseObject.__init__(self, id)
|
||||
self.name = unicode(name)
|
||||
|
||||
def __repr__(self):
|
||||
|
|
@ -105,35 +105,35 @@ class Project(CapBaseObject):
|
|||
return None
|
||||
|
||||
|
||||
class User(CapBaseObject):
|
||||
class User(BaseObject):
|
||||
"""
|
||||
User.
|
||||
"""
|
||||
name = StringField('Name of user')
|
||||
|
||||
def __init__(self, id, name):
|
||||
CapBaseObject.__init__(self, id)
|
||||
BaseObject.__init__(self, id)
|
||||
self.name = unicode(name)
|
||||
|
||||
def __repr__(self):
|
||||
return '<User %r>' % self.name
|
||||
|
||||
|
||||
class Version(CapBaseObject):
|
||||
class Version(BaseObject):
|
||||
"""
|
||||
Version of a project.
|
||||
"""
|
||||
name = StringField('Name of version')
|
||||
|
||||
def __init__(self, id, name):
|
||||
CapBaseObject.__init__(self, id)
|
||||
BaseObject.__init__(self, id)
|
||||
self.name = unicode(name)
|
||||
|
||||
def __repr__(self):
|
||||
return '<Version %r>' % self.name
|
||||
|
||||
|
||||
class Status(CapBaseObject):
|
||||
class Status(BaseObject):
|
||||
"""
|
||||
Status of an issue.
|
||||
|
||||
|
|
@ -149,7 +149,7 @@ class Status(CapBaseObject):
|
|||
value = IntField('Value of status (constants VALUE_*)')
|
||||
|
||||
def __init__(self, id, name, value):
|
||||
CapBaseObject.__init__(self, id)
|
||||
BaseObject.__init__(self, id)
|
||||
self.name = unicode(name)
|
||||
self.value = value
|
||||
|
||||
|
|
@ -157,7 +157,7 @@ class Status(CapBaseObject):
|
|||
return '<Status %r>' % self.name
|
||||
|
||||
|
||||
class Attachment(CapBaseObject):
|
||||
class Attachment(BaseObject):
|
||||
"""
|
||||
Attachment of an issue.
|
||||
"""
|
||||
|
|
@ -168,7 +168,7 @@ class Attachment(CapBaseObject):
|
|||
return '<Attachment %r>' % self.filename
|
||||
|
||||
|
||||
class Change(CapBaseObject):
|
||||
class Change(BaseObject):
|
||||
"""
|
||||
A change of an update.
|
||||
"""
|
||||
|
|
@ -177,7 +177,7 @@ class Change(CapBaseObject):
|
|||
new = StringField('New value of field')
|
||||
|
||||
|
||||
class Update(CapBaseObject):
|
||||
class Update(BaseObject):
|
||||
"""
|
||||
Represents an update of an issue.
|
||||
"""
|
||||
|
|
@ -192,7 +192,7 @@ class Update(CapBaseObject):
|
|||
return '<Update %r>' % self.id
|
||||
|
||||
|
||||
class Issue(CapBaseObject):
|
||||
class Issue(BaseObject):
|
||||
"""
|
||||
Represents an issue.
|
||||
"""
|
||||
|
|
@ -215,7 +215,7 @@ class Issue(CapBaseObject):
|
|||
priority = StringField('Priority of the issue') #XXX
|
||||
|
||||
|
||||
class Query(CapBaseObject):
|
||||
class Query(BaseObject):
|
||||
"""
|
||||
Query to find an issue.
|
||||
"""
|
||||
|
|
@ -228,7 +228,7 @@ class Query(CapBaseObject):
|
|||
status = StringField('Filter on statuses')
|
||||
|
||||
def __init__(self):
|
||||
CapBaseObject.__init__(self, '')
|
||||
BaseObject.__init__(self, '')
|
||||
|
||||
|
||||
class ICapBugTracker(IBaseCap):
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from .base import CapBaseObject, StringField, DateField, IntField, FloatField, Field
|
||||
from .base import BaseObject, StringField, DateField, IntField, FloatField, Field
|
||||
from .collection import ICapCollection, CollectionNotFound, Collection
|
||||
|
||||
from datetime import time, datetime
|
||||
|
|
@ -45,7 +45,7 @@ TRANSP = enum(OPAQUE=u'OPAQUE', TRANSPARENT=u'TRANSPARENT')
|
|||
STATUS = enum(TENTATIVE=u'TENTATIVE', CONFIRMED=u'CONFIRMED', CANCELLED=u'CANCELLED')
|
||||
|
||||
|
||||
class BaseCalendarEvent(CapBaseObject):
|
||||
class BaseCalendarEvent(BaseObject):
|
||||
"""
|
||||
Represents a calendar event
|
||||
"""
|
||||
|
|
@ -85,7 +85,7 @@ class BaseCalendarEvent(CapBaseObject):
|
|||
return self.id2url(self.id)
|
||||
|
||||
|
||||
class Query(CapBaseObject):
|
||||
class Query(BaseObject):
|
||||
"""
|
||||
Query to find events
|
||||
"""
|
||||
|
|
@ -96,7 +96,7 @@ class Query(CapBaseObject):
|
|||
categories = Field('List of categories of the event', list, tuple)
|
||||
|
||||
def __init__(self):
|
||||
CapBaseObject.__init__(self, '')
|
||||
BaseObject.__init__(self, '')
|
||||
self.categories = []
|
||||
for value in CATEGORIES.values:
|
||||
self.categories.append(value)
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
import datetime
|
||||
|
||||
from .base import IBaseCap, CapBaseObject, StringField, DateField, UserError
|
||||
from .base import IBaseCap, BaseObject, StringField, DateField, UserError
|
||||
|
||||
|
||||
__all__ = ['ChatException', 'ChatMessage', 'ICapChat']
|
||||
|
|
@ -32,7 +32,7 @@ class ChatException(UserError):
|
|||
"""
|
||||
|
||||
|
||||
class ChatMessage(CapBaseObject):
|
||||
class ChatMessage(BaseObject):
|
||||
"""
|
||||
Message on the chat.
|
||||
"""
|
||||
|
|
@ -42,7 +42,7 @@ class ChatMessage(CapBaseObject):
|
|||
date = DateField('Date when the message has been sent')
|
||||
|
||||
def __init__(self, id_from, id_to, message, date=None):
|
||||
CapBaseObject.__init__(self, '%s.%s' % (id_from, id_to))
|
||||
BaseObject.__init__(self, '%s.%s' % (id_from, id_to))
|
||||
self.id_from = id_from
|
||||
self.id_to = id_to
|
||||
self.message = message
|
||||
|
|
|
|||
|
|
@ -18,13 +18,13 @@
|
|||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from .base import IBaseCap, CapBaseObject, DateField, StringField, IntField, Field
|
||||
from .base import IBaseCap, BaseObject, DateField, StringField, IntField, Field
|
||||
|
||||
|
||||
__all__ = ['Movie', 'Person', 'ICapCinema']
|
||||
|
||||
|
||||
class Movie(CapBaseObject):
|
||||
class Movie(BaseObject):
|
||||
"""
|
||||
Movie object.
|
||||
"""
|
||||
|
|
@ -42,11 +42,11 @@ class Movie(CapBaseObject):
|
|||
thumbnail_url = StringField('Url of movie thumbnail')
|
||||
|
||||
def __init__(self, id, original_title):
|
||||
CapBaseObject.__init__(self, id)
|
||||
BaseObject.__init__(self, id)
|
||||
self.original_title = original_title
|
||||
|
||||
|
||||
class Person(CapBaseObject):
|
||||
class Person(BaseObject):
|
||||
"""
|
||||
Person object.
|
||||
"""
|
||||
|
|
@ -64,7 +64,7 @@ class Person(CapBaseObject):
|
|||
thumbnail_url = StringField('Url of person thumbnail')
|
||||
|
||||
def __init__(self, id, name):
|
||||
CapBaseObject.__init__(self, id)
|
||||
BaseObject.__init__(self, id)
|
||||
self.name = name
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
from weboob.tools.ordereddict import OrderedDict
|
||||
|
||||
from .base import IBaseCap, CapBaseObject, UserError, StringField, Field
|
||||
from .base import IBaseCap, BaseObject, UserError, StringField, Field
|
||||
|
||||
|
||||
__all__ = ['ICapCollection', 'BaseCollection', 'Collection', 'CollectionNotFound']
|
||||
|
|
@ -34,13 +34,13 @@ class CollectionNotFound(UserError):
|
|||
UserError.__init__(self, msg)
|
||||
|
||||
|
||||
class BaseCollection(CapBaseObject):
|
||||
class BaseCollection(BaseObject):
|
||||
"""
|
||||
Inherit from this if you want to create an object that is *also* a Collection.
|
||||
However, this probably will not work properly for now.
|
||||
"""
|
||||
def __init__(self, split_path):
|
||||
CapBaseObject.__init__(self, None)
|
||||
BaseObject.__init__(self, None)
|
||||
self.split_path = split_path
|
||||
|
||||
@property
|
||||
|
|
@ -76,7 +76,7 @@ class Collection(BaseCollection):
|
|||
|
||||
It is a dumb object, it must not contain callbacks to a backend.
|
||||
|
||||
Do not inherit from this class if you want to make a regular CapBaseObject
|
||||
Do not inherit from this class if you want to make a regular BaseObject
|
||||
a Collection, use BaseCollection instead.
|
||||
"""
|
||||
title = StringField('Collection title')
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from .base import IBaseCap, CapBaseObject, Field, StringField, BytesField, IntField, \
|
||||
from .base import IBaseCap, BaseObject, Field, StringField, BytesField, IntField, \
|
||||
UserError
|
||||
from weboob.tools.ordereddict import OrderedDict
|
||||
|
||||
|
|
@ -44,7 +44,7 @@ class ProfileNode(object):
|
|||
return self.value[key]
|
||||
|
||||
|
||||
class ContactPhoto(CapBaseObject):
|
||||
class ContactPhoto(BaseObject):
|
||||
"""
|
||||
Photo of a contact.
|
||||
"""
|
||||
|
|
@ -56,7 +56,7 @@ class ContactPhoto(CapBaseObject):
|
|||
hidden = Field('True if the photo is hidden on website', bool)
|
||||
|
||||
def __init__(self, name):
|
||||
CapBaseObject.__init__(self, name)
|
||||
BaseObject.__init__(self, name)
|
||||
self.name = name
|
||||
|
||||
def __iscomplete__(self):
|
||||
|
|
@ -71,7 +71,7 @@ class ContactPhoto(CapBaseObject):
|
|||
len(self.thumbnail_data) if self.thumbnail_data else 0)
|
||||
|
||||
|
||||
class Contact(CapBaseObject):
|
||||
class Contact(BaseObject):
|
||||
"""
|
||||
A contact.
|
||||
"""
|
||||
|
|
@ -89,7 +89,7 @@ class Contact(CapBaseObject):
|
|||
profile = Field('Contact profile', dict)
|
||||
|
||||
def __init__(self, id, name, status):
|
||||
CapBaseObject.__init__(self, id)
|
||||
BaseObject.__init__(self, id)
|
||||
self.name = name
|
||||
self.status = status
|
||||
|
||||
|
|
@ -154,14 +154,14 @@ class QueryError(UserError):
|
|||
"""
|
||||
|
||||
|
||||
class Query(CapBaseObject):
|
||||
class Query(BaseObject):
|
||||
"""
|
||||
Query to send to a contact.
|
||||
"""
|
||||
message = StringField('Message received')
|
||||
|
||||
def __init__(self, id, message):
|
||||
CapBaseObject.__init__(self, id)
|
||||
BaseObject.__init__(self, id)
|
||||
self.message = message
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -18,13 +18,13 @@
|
|||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from .base import IBaseCap, CapBaseObject, StringField, DateField, Field
|
||||
from .base import IBaseCap, BaseObject, StringField, DateField, Field
|
||||
|
||||
|
||||
__all__ = ['Content', 'Revision', 'ICapContent']
|
||||
|
||||
|
||||
class Content(CapBaseObject):
|
||||
class Content(BaseObject):
|
||||
"""
|
||||
Content object.
|
||||
"""
|
||||
|
|
@ -34,7 +34,7 @@ class Content(CapBaseObject):
|
|||
revision = StringField('ID of revision')
|
||||
|
||||
|
||||
class Revision(CapBaseObject):
|
||||
class Revision(BaseObject):
|
||||
"""
|
||||
Revision of a change on a content.
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from .base import IBaseCap, CapBaseObject, Field, StringField, DateField, UserError
|
||||
from .base import IBaseCap, BaseObject, Field, StringField, DateField, UserError
|
||||
from .contact import Contact
|
||||
|
||||
|
||||
|
|
@ -79,7 +79,7 @@ class Optimization(object):
|
|||
raise NotImplementedError()
|
||||
|
||||
|
||||
class Event(CapBaseObject):
|
||||
class Event(BaseObject):
|
||||
"""
|
||||
A dating event (for example a visite, a query received, etc.)
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -18,13 +18,13 @@
|
|||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from .base import IBaseCap, CapBaseObject, NotAvailable, Field, StringField, DateField
|
||||
from .base import IBaseCap, BaseObject, NotAvailable, Field, StringField, DateField
|
||||
|
||||
|
||||
__all__ = ['BaseFile', 'ICapFile']
|
||||
|
||||
|
||||
class BaseFile(CapBaseObject):
|
||||
class BaseFile(BaseObject):
|
||||
"""
|
||||
Represent a file.
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -19,13 +19,13 @@
|
|||
|
||||
|
||||
from weboob.tools.capabilities.thumbnail import Thumbnail
|
||||
from .base import IBaseCap, CapBaseObject, NotLoaded, Field, StringField, \
|
||||
from .base import IBaseCap, BaseObject, NotLoaded, Field, StringField, \
|
||||
BytesField, IntField, FloatField, DateField
|
||||
|
||||
__all__ = ['BaseGallery', 'BaseImage', 'ICapGallery']
|
||||
|
||||
|
||||
class BaseGallery(CapBaseObject):
|
||||
class BaseGallery(BaseObject):
|
||||
"""
|
||||
Represents a gallery.
|
||||
|
||||
|
|
@ -42,7 +42,7 @@ class BaseGallery(CapBaseObject):
|
|||
|
||||
def __init__(self, _id, title=NotLoaded, url=NotLoaded, cardinality=NotLoaded, date=NotLoaded,
|
||||
rating=NotLoaded, rating_max=NotLoaded, thumbnail=NotLoaded, thumbnail_url=None, nsfw=False):
|
||||
CapBaseObject.__init__(self, unicode(_id))
|
||||
BaseObject.__init__(self, unicode(_id))
|
||||
|
||||
self.title = title
|
||||
self.url = url
|
||||
|
|
@ -70,7 +70,7 @@ class BaseGallery(CapBaseObject):
|
|||
raise NotImplementedError()
|
||||
|
||||
|
||||
class BaseImage(CapBaseObject):
|
||||
class BaseImage(BaseObject):
|
||||
"""
|
||||
Base class for images.
|
||||
"""
|
||||
|
|
@ -84,7 +84,7 @@ class BaseImage(CapBaseObject):
|
|||
def __init__(self, _id, index=None, thumbnail=NotLoaded, url=NotLoaded,
|
||||
ext=NotLoaded, gallery=None):
|
||||
|
||||
CapBaseObject.__init__(self, unicode(_id))
|
||||
BaseObject.__init__(self, unicode(_id))
|
||||
|
||||
self.index = index
|
||||
self.thumbnail = thumbnail
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from .base import IBaseCap, CapBaseObject, StringField, FloatField, DateField, Field, UserError, empty
|
||||
from .base import IBaseCap, BaseObject, StringField, FloatField, DateField, Field, UserError, empty
|
||||
|
||||
__all__ = ['Gauge', 'GaugeSensor', 'GaugeMeasure', 'ICapGauge', 'SensorNotFound']
|
||||
|
||||
|
|
@ -29,7 +29,7 @@ class SensorNotFound(UserError):
|
|||
"""
|
||||
|
||||
|
||||
class Gauge(CapBaseObject):
|
||||
class Gauge(BaseObject):
|
||||
"""
|
||||
Gauge class.
|
||||
"""
|
||||
|
|
@ -39,7 +39,7 @@ class Gauge(CapBaseObject):
|
|||
sensors = Field('List of sensors on the gauge', list)
|
||||
|
||||
|
||||
class GaugeMeasure(CapBaseObject):
|
||||
class GaugeMeasure(BaseObject):
|
||||
"""
|
||||
Measure of a gauge sensor.
|
||||
"""
|
||||
|
|
@ -48,7 +48,7 @@ class GaugeMeasure(CapBaseObject):
|
|||
alarm = StringField('Alarm level')
|
||||
|
||||
def __init__(self):
|
||||
CapBaseObject.__init__(self)
|
||||
BaseObject.__init__(self)
|
||||
|
||||
def __repr__(self):
|
||||
if empty(self.level):
|
||||
|
|
@ -57,7 +57,7 @@ class GaugeMeasure(CapBaseObject):
|
|||
return "<GaugeMeasure level=%f alarm=%s date=%s>" % (self.level, self.alarm, self.date)
|
||||
|
||||
|
||||
class GaugeSensor(CapBaseObject):
|
||||
class GaugeSensor(BaseObject):
|
||||
"""
|
||||
GaugeSensor class.
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -18,13 +18,13 @@
|
|||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from .base import IBaseCap, CapBaseObject, StringField, FloatField
|
||||
from .base import IBaseCap, BaseObject, StringField, FloatField
|
||||
|
||||
|
||||
__all__ = ['IpLocation', 'ICapGeolocIp']
|
||||
|
||||
|
||||
class IpLocation(CapBaseObject):
|
||||
class IpLocation(BaseObject):
|
||||
"""
|
||||
Represents the location of an IP address.
|
||||
"""
|
||||
|
|
@ -39,7 +39,7 @@ class IpLocation(CapBaseObject):
|
|||
isp = StringField('Internet Service Provider')
|
||||
|
||||
def __init__(self, ipaddr):
|
||||
CapBaseObject.__init__(self, ipaddr)
|
||||
BaseObject.__init__(self, ipaddr)
|
||||
|
||||
|
||||
class ICapGeolocIp(IBaseCap):
|
||||
|
|
|
|||
|
|
@ -18,14 +18,14 @@
|
|||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from .base import IBaseCap, CapBaseObject, Field, IntField, DecimalField, \
|
||||
from .base import IBaseCap, BaseObject, Field, IntField, DecimalField, \
|
||||
StringField, BytesField, DateField
|
||||
|
||||
|
||||
__all__ = ['HousingPhoto', 'Housing', 'Query', 'City', 'ICapHousing']
|
||||
|
||||
|
||||
class HousingPhoto(CapBaseObject):
|
||||
class HousingPhoto(BaseObject):
|
||||
"""
|
||||
Photo of a housing.
|
||||
"""
|
||||
|
|
@ -33,7 +33,7 @@ class HousingPhoto(CapBaseObject):
|
|||
data = BytesField('Data of photo')
|
||||
|
||||
def __init__(self, url):
|
||||
CapBaseObject.__init__(self, url.split('/')[-1])
|
||||
BaseObject.__init__(self, url.split('/')[-1])
|
||||
self.url = url
|
||||
|
||||
def __iscomplete__(self):
|
||||
|
|
@ -46,7 +46,7 @@ class HousingPhoto(CapBaseObject):
|
|||
return u'<HousingPhoto "%s" data=%do>' % (self.id, len(self.data) if self.data else 0)
|
||||
|
||||
|
||||
class Housing(CapBaseObject):
|
||||
class Housing(BaseObject):
|
||||
"""
|
||||
Content of a housing.
|
||||
"""
|
||||
|
|
@ -63,7 +63,7 @@ class Housing(CapBaseObject):
|
|||
details = Field('Key/values of details', dict)
|
||||
|
||||
|
||||
class Query(CapBaseObject):
|
||||
class Query(BaseObject):
|
||||
"""
|
||||
Query to find housings.
|
||||
"""
|
||||
|
|
@ -79,10 +79,10 @@ class Query(CapBaseObject):
|
|||
nb_rooms = IntField('Number of rooms')
|
||||
|
||||
def __init__(self):
|
||||
CapBaseObject.__init__(self, '')
|
||||
BaseObject.__init__(self, '')
|
||||
|
||||
|
||||
class City(CapBaseObject):
|
||||
class City(BaseObject):
|
||||
"""
|
||||
City.
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -17,12 +17,12 @@
|
|||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from .base import CapBaseObject, IBaseCap, StringField, DateField
|
||||
from .base import BaseObject, IBaseCap, StringField, DateField
|
||||
|
||||
__all__ = ['BaseJobAdvert', 'ICapJob']
|
||||
|
||||
|
||||
class BaseJobAdvert(CapBaseObject):
|
||||
class BaseJobAdvert(BaseObject):
|
||||
"""
|
||||
Represents a job announce.
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -18,13 +18,13 @@
|
|||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from .collection import ICapCollection
|
||||
from .base import CapBaseObject, Field, StringField, DateField
|
||||
from .base import BaseObject, Field, StringField, DateField
|
||||
|
||||
|
||||
__all__ = ['Book', 'Renew', 'ICapBook']
|
||||
|
||||
|
||||
class Book(CapBaseObject):
|
||||
class Book(BaseObject):
|
||||
"""
|
||||
Describes a book.
|
||||
"""
|
||||
|
|
@ -35,7 +35,7 @@ class Book(CapBaseObject):
|
|||
late = Field('Are you late?', bool)
|
||||
|
||||
|
||||
class Renew(CapBaseObject):
|
||||
class Renew(BaseObject):
|
||||
"""
|
||||
A renew message.
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -18,13 +18,13 @@
|
|||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from .base import IBaseCap, CapBaseObject, StringField
|
||||
from .base import IBaseCap, BaseObject, StringField
|
||||
|
||||
|
||||
__all__ = ['SongLyrics', 'ICapLyrics']
|
||||
|
||||
|
||||
class SongLyrics(CapBaseObject):
|
||||
class SongLyrics(BaseObject):
|
||||
"""
|
||||
Song lyrics object.
|
||||
"""
|
||||
|
|
@ -33,7 +33,7 @@ class SongLyrics(CapBaseObject):
|
|||
content = StringField('Lyrics of the song')
|
||||
|
||||
def __init__(self, id, title):
|
||||
CapBaseObject.__init__(self, id)
|
||||
BaseObject.__init__(self, id)
|
||||
self.title = title
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
import datetime
|
||||
import time
|
||||
|
||||
from .base import IBaseCap, CapBaseObject, NotLoaded, Field, StringField, \
|
||||
from .base import IBaseCap, BaseObject, NotLoaded, Field, StringField, \
|
||||
DateField, IntField, UserError
|
||||
|
||||
|
||||
|
|
@ -30,12 +30,12 @@ __all__ = ['Thread', 'Message', 'ICapMessages', 'CantSendMessage', 'ICapMessages
|
|||
|
||||
# Message and Thread's attributes refer to themselves, and it isn't possible
|
||||
# in python, so these base classes are used instead.
|
||||
class _Message(CapBaseObject):
|
||||
class _Message(BaseObject):
|
||||
""" Base message. """
|
||||
pass
|
||||
|
||||
|
||||
class _Thread(CapBaseObject):
|
||||
class _Thread(BaseObject):
|
||||
""" Base Thread. """
|
||||
pass
|
||||
|
||||
|
|
@ -71,7 +71,7 @@ class Message(_Message):
|
|||
signature=NotLoaded,
|
||||
children=NotLoaded,
|
||||
flags=0):
|
||||
CapBaseObject.__init__(self, id)
|
||||
BaseObject.__init__(self, id)
|
||||
self.thread = thread
|
||||
self.title = title
|
||||
self.sender = sender
|
||||
|
|
|
|||
|
|
@ -18,10 +18,10 @@
|
|||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from .base import IBaseCap, CapBaseObject, Field, StringField, DateField
|
||||
from .base import IBaseCap, BaseObject, Field, StringField, DateField
|
||||
|
||||
|
||||
class Event(CapBaseObject):
|
||||
class Event(BaseObject):
|
||||
date = DateField('Date')
|
||||
activity = StringField('Activity')
|
||||
location = StringField('Location')
|
||||
|
|
@ -29,7 +29,7 @@ class Event(CapBaseObject):
|
|||
def __repr__(self):
|
||||
return u'<Event date=%r activity=%r location=%r>' % (self.date, self.activity, self.location)
|
||||
|
||||
class Parcel(CapBaseObject):
|
||||
class Parcel(BaseObject):
|
||||
STATUS_UNKNOWN = 0
|
||||
STATUS_PLANNED = 1
|
||||
STATUS_IN_TRANSIT = 2
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from .base import IBaseCap, CapBaseObject, NotLoaded, Field, StringField, UserError
|
||||
from .base import IBaseCap, BaseObject, NotLoaded, Field, StringField, UserError
|
||||
|
||||
|
||||
__all__ = ['PasteNotFound', 'BasePaste', 'ICapPaste']
|
||||
|
|
@ -32,7 +32,7 @@ class PasteNotFound(UserError):
|
|||
return super(PasteNotFound, self).__init__("Paste not found")
|
||||
|
||||
|
||||
class BasePaste(CapBaseObject):
|
||||
class BasePaste(BaseObject):
|
||||
"""
|
||||
Represents a pasted text.
|
||||
"""
|
||||
|
|
@ -43,7 +43,7 @@ class BasePaste(CapBaseObject):
|
|||
|
||||
def __init__(self, _id, title=NotLoaded, language=NotLoaded, contents=NotLoaded,
|
||||
public=NotLoaded):
|
||||
CapBaseObject.__init__(self, unicode(_id))
|
||||
BaseObject.__init__(self, unicode(_id))
|
||||
|
||||
self.title = title
|
||||
self.language = language
|
||||
|
|
|
|||
|
|
@ -18,21 +18,21 @@
|
|||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from .base import IBaseCap, CapBaseObject, Field, DecimalField, \
|
||||
from .base import IBaseCap, BaseObject, Field, DecimalField, \
|
||||
StringField, DateField
|
||||
|
||||
|
||||
__all__ = ['Shop', 'Price', 'Product', 'ICapPriceComparison']
|
||||
|
||||
|
||||
class Product(CapBaseObject):
|
||||
class Product(BaseObject):
|
||||
"""
|
||||
A product.
|
||||
"""
|
||||
name = StringField('Name of product')
|
||||
|
||||
|
||||
class Shop(CapBaseObject):
|
||||
class Shop(BaseObject):
|
||||
"""
|
||||
A shop where the price is.
|
||||
"""
|
||||
|
|
@ -41,7 +41,7 @@ class Shop(CapBaseObject):
|
|||
info = StringField('Information about the shop')
|
||||
|
||||
|
||||
class Price(CapBaseObject):
|
||||
class Price(BaseObject):
|
||||
"""
|
||||
Price.
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -19,14 +19,14 @@
|
|||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from .base import IBaseCap, CapBaseObject, Field, StringField
|
||||
from .base import IBaseCap, BaseObject, Field, StringField
|
||||
from weboob.tools.capabilities.streaminfo import StreamInfo
|
||||
|
||||
|
||||
__all__ = ['Radio', 'ICapRadio']
|
||||
|
||||
|
||||
class Radio(CapBaseObject):
|
||||
class Radio(BaseObject):
|
||||
"""
|
||||
Radio object.
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from .base import IBaseCap, CapBaseObject, StringField, IntField, Field, empty
|
||||
from .base import IBaseCap, BaseObject, StringField, IntField, Field, empty
|
||||
|
||||
import lxml.etree as ET
|
||||
|
||||
|
|
@ -47,7 +47,7 @@ class Comment():
|
|||
return result
|
||||
|
||||
|
||||
class Recipe(CapBaseObject):
|
||||
class Recipe(BaseObject):
|
||||
"""
|
||||
Recipe object.
|
||||
"""
|
||||
|
|
@ -64,7 +64,7 @@ class Recipe(CapBaseObject):
|
|||
comments = Field('User comments about the recipe', list)
|
||||
|
||||
def __init__(self, id, title):
|
||||
CapBaseObject.__init__(self, id)
|
||||
BaseObject.__init__(self, id)
|
||||
self.title = title
|
||||
|
||||
def toKrecipesXml(self, author=None):
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from .base import IBaseCap, CapBaseObject, StringField, IntField, UserError
|
||||
from .base import IBaseCap, BaseObject, StringField, IntField, UserError
|
||||
|
||||
|
||||
__all__ = ['Subtitle', 'ICapSubtitle']
|
||||
|
|
@ -33,7 +33,7 @@ class LanguageNotSupported(UserError):
|
|||
UserError.__init__(self, msg)
|
||||
|
||||
|
||||
class Subtitle(CapBaseObject):
|
||||
class Subtitle(BaseObject):
|
||||
"""
|
||||
Subtitle object.
|
||||
"""
|
||||
|
|
@ -45,7 +45,7 @@ class Subtitle(CapBaseObject):
|
|||
description=StringField('Description of corresponding video')
|
||||
|
||||
def __init__(self, id, name):
|
||||
CapBaseObject.__init__(self, id)
|
||||
BaseObject.__init__(self, id)
|
||||
self.name = name
|
||||
|
||||
class ICapSubtitle(IBaseCap):
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from .base import IBaseCap, CapBaseObject, Field, StringField, FloatField, \
|
||||
from .base import IBaseCap, BaseObject, Field, StringField, FloatField, \
|
||||
DateField, IntField, UserError
|
||||
|
||||
|
||||
|
|
@ -34,7 +34,7 @@ class MagnetOnly(UserError):
|
|||
UserError.__init__(self, 'Only magnet URL is available')
|
||||
|
||||
|
||||
class Torrent(CapBaseObject):
|
||||
class Torrent(BaseObject):
|
||||
"""
|
||||
Torrent object.
|
||||
"""
|
||||
|
|
@ -50,7 +50,7 @@ class Torrent(CapBaseObject):
|
|||
filename = StringField('Name of .torrent file')
|
||||
|
||||
def __init__(self, id, name):
|
||||
CapBaseObject.__init__(self, id)
|
||||
BaseObject.__init__(self, id)
|
||||
self.name = name
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from .base import IBaseCap, CapBaseObject, StringField, UserError
|
||||
from .base import IBaseCap, BaseObject, StringField, UserError
|
||||
|
||||
|
||||
__all__ = ['TranslationFail', 'LanguageNotSupported', 'ICapTranslate']
|
||||
|
|
@ -42,7 +42,7 @@ class TranslationFail(UserError):
|
|||
UserError.__init__(self, msg)
|
||||
|
||||
|
||||
class Translation(CapBaseObject):
|
||||
class Translation(BaseObject):
|
||||
"""
|
||||
Translation.
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -20,28 +20,28 @@
|
|||
|
||||
import datetime
|
||||
|
||||
from .base import IBaseCap, CapBaseObject, StringField, TimeField, DeltaField, \
|
||||
from .base import IBaseCap, BaseObject, StringField, TimeField, DeltaField, \
|
||||
DateField, DecimalField, UserError
|
||||
|
||||
|
||||
__all__ = ['Station', 'Departure', 'RoadStep', 'RoadmapError', 'RoadmapFilters', 'ICapTravel']
|
||||
|
||||
|
||||
class Station(CapBaseObject):
|
||||
class Station(BaseObject):
|
||||
"""
|
||||
Describes a station.
|
||||
"""
|
||||
name = StringField('Name of station')
|
||||
|
||||
def __init__(self, id, name):
|
||||
CapBaseObject.__init__(self, id)
|
||||
BaseObject.__init__(self, id)
|
||||
self.name = name
|
||||
|
||||
def __repr__(self):
|
||||
return "<Station id=%r name=%r>" % (self.id, self.name)
|
||||
|
||||
|
||||
class Departure(CapBaseObject):
|
||||
class Departure(BaseObject):
|
||||
"""
|
||||
Describes a departure.
|
||||
"""
|
||||
|
|
@ -57,7 +57,7 @@ class Departure(CapBaseObject):
|
|||
currency = StringField('Currency', default=None)
|
||||
|
||||
def __init__(self, id, _type, _time):
|
||||
CapBaseObject.__init__(self, id)
|
||||
BaseObject.__init__(self, id)
|
||||
|
||||
self.type = _type
|
||||
self.time = _time
|
||||
|
|
@ -67,7 +67,7 @@ class Departure(CapBaseObject):
|
|||
self.id, self.type, self.time.strftime('%H:%M'), self.departure_station, self.arrival_station)
|
||||
|
||||
|
||||
class RoadStep(CapBaseObject):
|
||||
class RoadStep(BaseObject):
|
||||
"""
|
||||
A step on a roadmap.
|
||||
"""
|
||||
|
|
@ -85,7 +85,7 @@ class RoadmapError(UserError):
|
|||
"""
|
||||
|
||||
|
||||
class RoadmapFilters(CapBaseObject):
|
||||
class RoadmapFilters(BaseObject):
|
||||
"""
|
||||
Filters to get a roadmap.
|
||||
"""
|
||||
|
|
@ -93,7 +93,7 @@ class RoadmapFilters(CapBaseObject):
|
|||
arrival_time = DateField('Wanted arrival time')
|
||||
|
||||
def __init__(self):
|
||||
CapBaseObject.__init__(self, '')
|
||||
BaseObject.__init__(self, '')
|
||||
|
||||
|
||||
class ICapTravel(IBaseCap):
|
||||
|
|
|
|||
|
|
@ -20,20 +20,20 @@
|
|||
|
||||
from datetime import datetime, date
|
||||
|
||||
from .base import IBaseCap, CapBaseObject, Field, DateField, FloatField, \
|
||||
from .base import IBaseCap, BaseObject, Field, DateField, FloatField, \
|
||||
StringField, UserError
|
||||
|
||||
|
||||
__all__ = ['Forecast', 'Current', 'City', 'CityNotFound', 'Temperature', 'ICapWeather']
|
||||
|
||||
|
||||
class Temperature(CapBaseObject):
|
||||
class Temperature(BaseObject):
|
||||
|
||||
value = FloatField('Temperature value')
|
||||
unit = StringField('Input unit')
|
||||
|
||||
def __init__(self, value, unit = u''):
|
||||
CapBaseObject.__init__(self, value)
|
||||
BaseObject.__init__(self, value)
|
||||
self.value = value
|
||||
if unit not in [u'C', u'F']:
|
||||
unit = u''
|
||||
|
|
@ -60,7 +60,7 @@ class Temperature(CapBaseObject):
|
|||
return u'%s %s' % (self.value, self.unit)
|
||||
|
||||
|
||||
class Forecast(CapBaseObject):
|
||||
class Forecast(BaseObject):
|
||||
"""
|
||||
Weather forecast.
|
||||
"""
|
||||
|
|
@ -70,14 +70,14 @@ class Forecast(CapBaseObject):
|
|||
text = StringField('Comment on forecast')
|
||||
|
||||
def __init__(self, date, low, high, text, unit):
|
||||
CapBaseObject.__init__(self, unicode(date))
|
||||
BaseObject.__init__(self, unicode(date))
|
||||
self.date = date
|
||||
self.low = Temperature(low, unit)
|
||||
self.high = Temperature(high, unit)
|
||||
self.text = text
|
||||
|
||||
|
||||
class Current(CapBaseObject):
|
||||
class Current(BaseObject):
|
||||
"""
|
||||
Current weather.
|
||||
"""
|
||||
|
|
@ -86,20 +86,20 @@ class Current(CapBaseObject):
|
|||
temp = Field('Current temperature', Temperature)
|
||||
|
||||
def __init__(self, date, temp, text, unit):
|
||||
CapBaseObject.__init__(self, unicode(date))
|
||||
BaseObject.__init__(self, unicode(date))
|
||||
self.date = date
|
||||
self.text = text
|
||||
self.temp = Temperature(temp, unit)
|
||||
|
||||
|
||||
class City(CapBaseObject):
|
||||
class City(BaseObject):
|
||||
"""
|
||||
City where to find weather.
|
||||
"""
|
||||
name = StringField('Name of city')
|
||||
|
||||
def __init__(self, id, name):
|
||||
CapBaseObject.__init__(self, id)
|
||||
BaseObject.__init__(self, id)
|
||||
self.name = name
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ try:
|
|||
except ImportError:
|
||||
import queue as Queue
|
||||
|
||||
from weboob.capabilities.base import CapBaseObject
|
||||
from weboob.capabilities.base import BaseObject
|
||||
from weboob.tools.misc import get_backtrace
|
||||
from weboob.tools.log import getLogger
|
||||
|
||||
|
|
@ -65,7 +65,7 @@ class BackendsCall(object):
|
|||
self.tasks.put(backend)
|
||||
|
||||
def store_result(self, backend, result):
|
||||
if isinstance(result, CapBaseObject):
|
||||
if isinstance(result, BaseObject):
|
||||
result.backend = backend.name
|
||||
self.responses.put((backend, result))
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import sys
|
|||
import tempfile
|
||||
import warnings
|
||||
|
||||
from weboob.capabilities.base import ConversionWarning, CapBaseObject
|
||||
from weboob.capabilities.base import ConversionWarning, BaseObject
|
||||
from weboob.core import Weboob, CallErrors
|
||||
from weboob.core.backendscfg import BackendsConfig
|
||||
from weboob.tools.config.iconfig import ConfigError
|
||||
|
|
@ -251,7 +251,7 @@ class BaseApplication(object):
|
|||
def _do_complete_obj(self, backend, fields, obj):
|
||||
if not obj:
|
||||
return obj
|
||||
if not isinstance(obj, CapBaseObject):
|
||||
if not isinstance(obj, BaseObject):
|
||||
return obj
|
||||
|
||||
obj.backend = backend.name
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ else:
|
|||
finally:
|
||||
termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
|
||||
|
||||
from weboob.capabilities.base import CapBaseObject
|
||||
from weboob.capabilities.base import BaseObject
|
||||
from weboob.tools.application.console import ConsoleApplication
|
||||
from weboob.tools.ordereddict import OrderedDict
|
||||
|
||||
|
|
@ -139,13 +139,13 @@ class IFormatter(object):
|
|||
An object has fields which can be selected.
|
||||
|
||||
:param obj: object to format
|
||||
:type obj: CapBaseObject or dict
|
||||
:type obj: BaseObject or dict
|
||||
:param selected_fields: fields to display. If None, all fields are selected
|
||||
:type selected_fields: tuple
|
||||
:param alias: an alias to use instead of the object's ID
|
||||
:type alias: unicode
|
||||
"""
|
||||
if isinstance(obj, CapBaseObject):
|
||||
if isinstance(obj, BaseObject):
|
||||
if selected_fields: # can be an empty list (nothing to do), or None (return all fields)
|
||||
obj = obj.copy()
|
||||
for name, value in obj.iter_fields():
|
||||
|
|
@ -162,7 +162,7 @@ class IFormatter(object):
|
|||
try:
|
||||
obj = OrderedDict(obj)
|
||||
except ValueError:
|
||||
raise TypeError('Please give a CapBaseObject or a dict')
|
||||
raise TypeError('Please give a BaseObject or a dict')
|
||||
|
||||
if selected_fields:
|
||||
obj = obj.copy()
|
||||
|
|
@ -188,7 +188,7 @@ class IFormatter(object):
|
|||
This method has to be overridden in child classes.
|
||||
|
||||
:param obj: object to format
|
||||
:type obj: CapBaseObject
|
||||
:type obj: BaseObject
|
||||
:rtype: str
|
||||
"""
|
||||
return self.format_dict(obj.to_dict())
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ from optparse import OptionGroup, OptionParser, IndentedHelpFormatter
|
|||
import os
|
||||
import sys
|
||||
|
||||
from weboob.capabilities.base import FieldNotFound, CapBaseObject, UserError
|
||||
from weboob.capabilities.base import FieldNotFound, BaseObject, UserError
|
||||
from weboob.core import CallErrors
|
||||
from weboob.tools.application.formatters.iformatter import MandatoryFieldsNotFound
|
||||
from weboob.tools.misc import to_unicode
|
||||
|
|
@ -192,7 +192,7 @@ class ReplApplication(Cmd, ConsoleApplication):
|
|||
except (IndexError, ValueError):
|
||||
pass
|
||||
else:
|
||||
if isinstance(obj, CapBaseObject):
|
||||
if isinstance(obj, BaseObject):
|
||||
id = obj.fullid
|
||||
try:
|
||||
return ConsoleApplication.parse_id(self, id, unique_backend)
|
||||
|
|
@ -1147,7 +1147,7 @@ class ReplApplication(Cmd, ConsoleApplication):
|
|||
the object.
|
||||
|
||||
:param obj: object
|
||||
:type obj: CapBaseObject
|
||||
:type obj: BaseObject
|
||||
:param dest: dest given by user (default None)
|
||||
:type dest: str
|
||||
:param default: default file mask (if not given, this is '{id}-{title}.{ext}')
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import os
|
|||
from threading import RLock
|
||||
from copy import copy
|
||||
|
||||
from weboob.capabilities.base import CapBaseObject, FieldNotFound, \
|
||||
from weboob.capabilities.base import BaseObject, FieldNotFound, \
|
||||
IBaseCap, NotLoaded, NotAvailable
|
||||
from weboob.tools.misc import iter_fields
|
||||
from weboob.tools.log import getLogger
|
||||
|
|
@ -381,7 +381,7 @@ class BaseBackend(object):
|
|||
return obj
|
||||
|
||||
def not_loaded(v):
|
||||
return (v is NotLoaded or isinstance(v, CapBaseObject) and not v.__iscomplete__())
|
||||
return (v is NotLoaded or isinstance(v, BaseObject) and not v.__iscomplete__())
|
||||
|
||||
if isinstance(fields, basestring):
|
||||
fields = (fields,)
|
||||
|
|
@ -389,7 +389,7 @@ class BaseBackend(object):
|
|||
missing_fields = []
|
||||
if fields is None:
|
||||
# Select all fields
|
||||
if isinstance(obj, CapBaseObject):
|
||||
if isinstance(obj, BaseObject):
|
||||
fields = [item[0] for item in obj.iter_fields()]
|
||||
else:
|
||||
fields = [item[0] for item in iter_fields(obj)]
|
||||
|
|
|
|||
|
|
@ -18,12 +18,12 @@
|
|||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from weboob.capabilities.base import CapBaseObject, StringField
|
||||
from weboob.capabilities.base import BaseObject, StringField
|
||||
|
||||
__all__ = ['StreamInfo']
|
||||
|
||||
|
||||
class StreamInfo(CapBaseObject):
|
||||
class StreamInfo(BaseObject):
|
||||
"""
|
||||
Stream related information.
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -17,13 +17,13 @@
|
|||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from weboob.capabilities.base import CapBaseObject, NotLoaded, StringField, BytesField
|
||||
from weboob.capabilities.base import BaseObject, NotLoaded, StringField, BytesField
|
||||
|
||||
|
||||
__all__ = ['Thumbnail']
|
||||
|
||||
|
||||
class Thumbnail(CapBaseObject):
|
||||
class Thumbnail(BaseObject):
|
||||
"""
|
||||
Thumbnail of an image.
|
||||
"""
|
||||
|
|
@ -32,7 +32,7 @@ class Thumbnail(CapBaseObject):
|
|||
data = BytesField('Data')
|
||||
|
||||
def __init__(self, url):
|
||||
CapBaseObject.__init__(self, url)
|
||||
BaseObject.__init__(self, url)
|
||||
self.url = url.replace(u' ', u'%20')
|
||||
|
||||
def __str__(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue