Commit 5f2ae145 authored by Roger Philibert's avatar Roger Philibert Committed by hydrargyrum
Browse files

woob: rename on some internal symbols

parent aaae074e
......@@ -27,7 +27,7 @@
from decimal import Decimal, InvalidOperation
from weboob.browser.browsers import APIBrowser
from weboob.browser.profiles import Weboob
from weboob.browser.profiles import Woob
from weboob.exceptions import (
BrowserHTTPError, CaptchaQuestion, DecoupledValidation,
AppValidationCancelled, AppValidationExpired,
......@@ -934,7 +934,7 @@ def do_budgea(self, line):
client = APIBrowser(baseurl='https://budgea.biapi.pro/2.0/',
proxy=getproxies(),
logger=getLogger('apibrowser', self.logger))
client.set_profile(Weboob(self.VERSION))
client.set_profile(Woob(self.VERSION))
client.TIMEOUT = 60
try:
r = client.request('auth/token', data={'username': username, 'password': password, 'application': 'woob'})
......
......@@ -405,7 +405,7 @@ def createAppbank(self, account):
appbank.enabled_backends = set()
appbank.enabled_backends.add(instance)
appbank.weboob.backend_instances[dedicatedBackendInstanceName] = instance
appbank.woob.backend_instances[dedicatedBackendInstanceName] = instance
appbank.selected_fields = ["$full"]
appbank.formatter = self.formatter
......
......@@ -32,7 +32,7 @@
import subprocess
import socket
from weboob.core import Weboob, CallErrors
from weboob.core import Woob, CallErrors
from weboob.core.scheduler import Scheduler
from weboob.capabilities.messages import CapMessages, CapMessagesPost, Thread, Message
from weboob.tools.application.repl import ReplApplication
......@@ -74,7 +74,7 @@ def run(self):
return False
# XXX Fuck, we shouldn't copy this piece of code from
# weboob.scheduler.Scheduler.run().
# woob.scheduler.Scheduler.run().
try:
while True:
self.stop_event.wait(0.1)
......@@ -107,8 +107,8 @@ class AppSmtp(ReplApplication):
def add_application_options(self, group):
group.add_option('-S', '--smtpd', help='run a fake smtpd server and set the port')
def create_weboob(self):
return Weboob(scheduler=AppSmtpScheduler(self))
def create_woob(self):
return Woob(scheduler=AppSmtpScheduler(self))
def load_default_backends(self):
self.load_backends(CapMessages, storage=self.create_storage())
......
......@@ -368,12 +368,12 @@ def __init__(self, browser):
class DirFirefoxProfile(FirefoxProfile):
def __init__(self, custom_dir):
self._weboob_dir = custom_dir
self._woob_dir = custom_dir
super(DirFirefoxProfile, self).__init__()
def _create_tempfolder(self):
if self._weboob_dir:
return self._weboob_dir
if self._woob_dir:
return self._woob_dir
return super(DirFirefoxProfile, self)._create_tempfolder()
......
......@@ -60,7 +60,7 @@ def merge_hooks(request_hooks, session_hooks, dict_class=OrderedDict):
return ret
class WeboobSession(Session):
class WoobSession(Session):
def prepare_request(self, request):
"""Constructs a :class:`PreparedRequest <PreparedRequest>` for
transmission and returns it. The :class:`PreparedRequest` has settings
......@@ -102,7 +102,10 @@ def prepare_request(self, request):
return p
class FuturesSession(WeboobSession):
WeboobSession = WoobSession
class FuturesSession(WoobSession):
def __init__(self, executor=None, max_workers=2, max_retries=2, *args, **kwargs):
"""Creates a FuturesSession
......
......@@ -92,8 +92,8 @@ def has_caps(self, *caps):
return True
return False
def create_instance(self, weboob, backend_name, config, storage, nofail=False, logger=None):
backend_instance = self.klass(weboob, backend_name, config, storage, logger=logger or self.logger, nofail=nofail)
def create_instance(self, woob, backend_name, config, storage, nofail=False, logger=None):
backend_instance = self.klass(woob, backend_name, config, storage, logger=logger or self.logger, nofail=nofail)
self.logger.debug(u'Created backend "%s" for module "%s"' % (backend_name, self.name))
return backend_instance
......
......@@ -18,7 +18,7 @@
# along with woob. If not, see <http://www.gnu.org/licenses/>.
from weboob.tools.json import json, WeboobEncoder
from weboob.tools.json import json, WoobEncoder
from .iformatter import IFormatter
......@@ -35,7 +35,7 @@ def __init__(self):
self.queue = []
def flush(self):
self.output(json.dumps(self.queue, cls=WeboobEncoder))
self.output(json.dumps(self.queue, cls=WoobEncoder))
def format_dict(self, item):
self.queue.append(item)
......@@ -51,7 +51,7 @@ class JsonLineFormatter(IFormatter):
"""
def format_dict(self, item):
self.output(json.dumps(item, cls=WeboobEncoder))
self.output(json.dumps(item, cls=WoobEncoder))
def test():
......
......@@ -21,7 +21,7 @@
import yaml
from .iconfig import ConfigError, IConfig
from .yamlconfig import WeboobDumper
from .yamlconfig import WoobDumper
try:
from yaml import CLoader as Loader
......@@ -66,7 +66,7 @@ def set(self, *args):
key = '.'.join(args[:-1])
value = args[-1]
try:
self.storage[key] = yaml.dump(value, None, Dumper=WeboobDumper, default_flow_style=False)
self.storage[key] = yaml.dump(value, None, Dumper=WoobDumper, default_flow_style=False)
except KeyError:
raise ConfigError()
except TypeError:
......
......@@ -29,7 +29,7 @@
from .iconfig import ConfigError, IConfig
from .util import replace, time_buffer
from .yamlconfig import WeboobDumper
from .yamlconfig import WoobDumper
try:
from yaml import CLoader as Loader
......@@ -216,7 +216,7 @@ def set(self, *args):
value = args[-1]
self.ensure_table(table)
try:
strvalue = yaml.dump(value, None, Dumper=WeboobDumper, default_flow_style=False)
strvalue = yaml.dump(value, None, Dumper=WoobDumper, default_flow_style=False)
cur = self.storage.cursor()
cur.execute('''INSERT OR REPLACE INTO %s VALUES (?, ?)''' % table, (key, strvalue))
except KeyError:
......
......@@ -81,7 +81,7 @@ def cut(s):
queue.append((node[k], cut(rest)))
class WeboobEncoder(json.JSONEncoder):
class WoobEncoder(json.JSONEncoder):
"""JSON encoder class for woob objects (and Decimal and dates)
>>> json.dumps(object, cls=WoobEncoder)
......@@ -92,7 +92,7 @@ def __init__(self, *args, **kwargs):
# avoid simplejson internal Decimal handling
if 'use_decimal' in kwargs:
kwargs['use_decimal'] = False
super(WeboobEncoder, self).__init__(*args, **kwargs)
super(WoobEncoder, self).__init__(*args, **kwargs)
def default(self, o):
if o is NotAvailable:
......@@ -107,7 +107,7 @@ def default(self, o):
return o.isoformat()
elif isinstance(o, timedelta):
return o.total_seconds()
return super(WeboobEncoder, self).default(o)
return super(WoobEncoder, self).default(o)
WoobEncoder = WeboobEncoder
WeboobEncoder = WoobEncoder
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment