Commit 727e181a authored by Vincent A's avatar Vincent A Committed by Romain Bignon

remove weboob.tools.ordereddict

Since Python 2.7 is the minimum version supported,
collections.OrderedDict is guaranteed to exist and there is no need to
reimplement it.
parent 55ebb46a
Pipeline #168 failed with stages
in 10 minutes and 17 seconds
......@@ -17,9 +17,9 @@
# 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 collections import OrderedDict
from weboob.tools.backend import Module, BackendConfig
from weboob.tools.ordereddict import OrderedDict
from weboob.tools.value import Value
from weboob.capabilities.job import CapJob, BaseJobAdvert
from .browser import AdeccoBrowser
......
......@@ -17,10 +17,10 @@
# 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 collections import OrderedDict
from weboob.tools.backend import Module, BackendConfig
from weboob.capabilities.calendar import CapCalendarEvent, CATEGORIES
from weboob.tools.ordereddict import OrderedDict
from weboob.tools.value import Value
from .browser import AgendadulibreBrowser
......
......@@ -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 collections import OrderedDict
from weboob.capabilities.bill import CapDocument, Subscription, Bill, SubscriptionNotFound, DocumentNotFound
from weboob.capabilities.shop import CapShop, Order
from weboob.capabilities.base import find_object
from weboob.tools.backend import Module, BackendConfig
from weboob.tools.value import Value, ValueBackendPassword
from weboob.tools.ordereddict import OrderedDict
from weboob.browser.exceptions import HTTPNotFound
from .browser import Amazon
......
......@@ -17,10 +17,11 @@
# 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 collections import OrderedDict
from weboob.capabilities.job import BaseJobAdvert
from weboob.tools.backend import Module, BackendConfig
from weboob.capabilities.job import CapJob
from weboob.tools.ordereddict import OrderedDict
from weboob.tools.value import Value
from .browser import ApecBrowser
from .job import APEC_CONTRATS, APEC_EXPERIENCE
......
......@@ -19,7 +19,8 @@
import re
from weboob.tools.ordereddict import OrderedDict
from collections import OrderedDict
from weboob.capabilities.video import CapVideo, BaseVideo
from weboob.capabilities.collection import CapCollection, CollectionNotFound, Collection
from weboob.tools.backend import Module, BackendConfig
......
......@@ -22,8 +22,8 @@ from html2text import unescape
import socket
from datetime import datetime
from dateutil.parser import parse as parse_dt
from collections import OrderedDict
from weboob.tools.ordereddict import OrderedDict
from weboob.capabilities.contact import Contact as _Contact, ProfileNode
from weboob.tools.html import html2text
......
......@@ -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 collections import OrderedDict
import re
from decimal import Decimal, InvalidOperation
......@@ -30,7 +30,6 @@ from weboob.browser.filters.html import Attr
from weboob.capabilities.bank import Account, Investment
from weboob.capabilities.base import NotAvailable
from weboob.tools.capabilities.bank.transactions import FrenchTransaction
from weboob.tools.ordereddict import OrderedDict
def MyDecimal(*args, **kwargs):
......
......@@ -17,10 +17,10 @@
# 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 collections import OrderedDict
from weboob.capabilities.bank import CapBank, AccountNotFound
from weboob.tools.backend import Module, BackendConfig
from weboob.tools.ordereddict import OrderedDict
from weboob.tools.value import ValueBackendPassword, Value
from .browser import BanquePopulaire
......
......@@ -17,11 +17,10 @@
# 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 collections import OrderedDict
import re
from weboob.deprecated.browser import Page, BrowserPasswordExpired
from weboob.tools.ordereddict import OrderedDict
from weboob.capabilities.bank import TransferError
......
......@@ -21,6 +21,7 @@
from cStringIO import StringIO
import re
from decimal import Decimal
from collections import OrderedDict
from weboob.capabilities.base import NotAvailable
from weboob.capabilities.bank import Account
......@@ -31,7 +32,6 @@ from weboob.browser.filters.html import Link
from weboob.browser.filters.standard import CleanText, Regexp, Env
from weboob.exceptions import BrowserUnavailable, NoAccountsException
from weboob.tools.capabilities.bank.transactions import FrenchTransaction
from weboob.tools.ordereddict import OrderedDict
from .base import MyHTMLPage
......
......@@ -24,10 +24,10 @@ ControlNotFoundError = ClientForm.ControlNotFoundError
from decimal import Decimal, InvalidOperation
import re
from collections import OrderedDict
from weboob.deprecated.browser import Page
from weboob.tools.misc import to_unicode
from weboob.tools.ordereddict import OrderedDict
from weboob.capabilities.bank import Account
from weboob.tools.capabilities.bank.transactions import FrenchTransaction
......
......@@ -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 collections import OrderedDict
from weboob.capabilities.bank import CapBank, AccountNotFound
from weboob.capabilities.contact import CapContact
from weboob.tools.backend import Module, BackendConfig
from weboob.tools.value import Value, ValueBackendPassword
from weboob.tools.ordereddict import OrderedDict
from .browser import CaisseEpargne
......
......@@ -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 collections import OrderedDict
import re
import json
......@@ -31,7 +31,6 @@ from weboob.browser.filters.json import Dict
from weboob.capabilities import NotAvailable
from weboob.capabilities.bank import Account, Transaction, Investment
from weboob.capabilities.contact import Advisor
from weboob.tools.ordereddict import OrderedDict
from weboob.tools.capabilities.bank.transactions import FrenchTransaction
from weboob.tools.capabilities.bank.iban import is_rib_valid, rib2iban
from weboob.exceptions import NoAccountsException, BrowserUnavailable
......
......@@ -8,9 +8,10 @@
# To Public License, Version 2, as published by Sam Hocevar. See
# http://sam.zoy.org/wtfpl/COPYING for more details.
from collections import OrderedDict
import urllib
import datetime
from weboob.capabilities.base import NotAvailable
from weboob.tools.misc import to_unicode
from weboob.deprecated.browser import Page
......@@ -19,7 +20,6 @@ from weboob.deprecated.browser import Browser
from weboob.deprecated.browser.decorators import id2url
from weboob.capabilities.image import Thumbnail
from weboob.capabilities.video import BaseVideo
from weboob.tools.ordereddict import OrderedDict
__all__ = ['CappedBrowser']
......
......@@ -17,11 +17,11 @@
# 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 collections import OrderedDict
from weboob.capabilities.bank import AccountNotFound, CapBankTransfer
from weboob.capabilities.contact import CapContact
from weboob.tools.backend import Module, BackendConfig
from weboob.tools.ordereddict import OrderedDict
from weboob.tools.value import ValueBackendPassword, Value
from .web.browser import Cragr
......
......@@ -17,10 +17,10 @@
# 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 collections import OrderedDict
from weboob.capabilities.bank import CapBank, AccountNotFound
from weboob.tools.backend import Module, BackendConfig
from weboob.tools.ordereddict import OrderedDict
from weboob.tools.value import ValueBackendPassword, Value
from .browser import CreditDuNordBrowser
......
......@@ -17,11 +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 collections import OrderedDict
from weboob.capabilities.video import CapVideo, BaseVideo
from weboob.capabilities.collection import CapCollection, CollectionNotFound
from weboob.tools.backend import Module, BackendConfig
from weboob.tools.value import Value
from weboob.tools.ordereddict import OrderedDict
from .browser import DailymotionBrowser
import re
......
......@@ -17,11 +17,11 @@
# 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 collections import OrderedDict
from weboob.capabilities.bank import CapBank, AccountNotFound
from weboob.capabilities.base import find_object
from weboob.tools.backend import Module, BackendConfig
from weboob.tools.ordereddict import OrderedDict
from weboob.tools.value import ValueBackendPassword, Value
from .browser import GanAssurances
......
......@@ -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 collections import OrderedDict
import datetime
from dateutil.parser import parse as parse_date
from dateutil.relativedelta import relativedelta
......@@ -31,7 +31,6 @@ from weboob.capabilities.contact import CapContact, Contact, ProfileNode
from weboob.exceptions import BrowserHTTPError
from weboob.tools.backend import Module, BackendConfig
from weboob.tools.value import Value, ValueBackendPassword
from weboob.tools.ordereddict import OrderedDict
from weboob.tools.log import getLogger
from .browser import HappnBrowser, FacebookBrowser
......
......@@ -17,11 +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 collections import OrderedDict
from weboob.tools.backend import Module, BackendConfig
from weboob.tools.ordereddict import OrderedDict
from weboob.capabilities.job import CapJob, BaseJobAdvert
from weboob.tools.value import Value
from .browser import IndeedBrowser
__all__ = ['IndeedModule']
......
......@@ -19,11 +19,12 @@
from __future__ import unicode_literals
from collections import OrderedDict
from weboob.tools.backend import Module, BackendConfig
from weboob.capabilities.base import StringField, UserError
from weboob.capabilities.gauge import CapGauge, GaugeSensor, Gauge, GaugeMeasure, SensorNotFound
from weboob.tools.value import Value, ValueBackendPassword
from weboob.tools.ordereddict import OrderedDict
from .browser import VelibBrowser
......
......@@ -17,8 +17,9 @@
# 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 collections import OrderedDict
from weboob.tools.backend import Module, BackendConfig
from weboob.tools.ordereddict import OrderedDict
from weboob.tools.value import Value
from weboob.capabilities.job import CapJob, BaseJobAdvert
......
......@@ -17,10 +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 collections import OrderedDict
from weboob.tools.backend import Module, BackendConfig
from weboob.tools.ordereddict import OrderedDict
from weboob.tools.value import Value
from weboob.capabilities.job import CapJob, BaseJobAdvert
from .browser import ManpowerBrowser
......
......@@ -17,11 +17,11 @@
# 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 collections import OrderedDict
from weboob.tools.backend import Module, BackendConfig
from weboob.capabilities.job import CapJob, BaseJobAdvert
from weboob.tools.value import Value
from weboob.tools.ordereddict import OrderedDict
from .browser import MonsterBrowser
......
......@@ -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 collections import OrderedDict
from datetime import datetime
from html2text import unescape
......@@ -26,7 +26,6 @@ from weboob.capabilities.dating import CapDating
from weboob.capabilities.messages import CapMessages, CapMessagesPost, Message, Thread
from weboob.tools.backend import Module, BackendConfig
from weboob.tools.misc import to_unicode
from weboob.tools.ordereddict import OrderedDict
from weboob.tools.value import Value, ValueBackendPassword
from .browser import OkCBrowser
......
......@@ -16,12 +16,14 @@
#
# 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 collections import OrderedDict
from weboob.capabilities.job import BaseJobAdvert
from weboob.tools.backend import Module, BackendConfig
from weboob.capabilities.job import CapJob
from weboob.tools.value import Value
from weboob.tools.ordereddict import OrderedDict
from .browser import PopolemploiBrowser
......
......@@ -17,10 +17,10 @@
# 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 collections import OrderedDict
from weboob.tools.backend import Module, BackendConfig
from weboob.capabilities.calendar import CapCalendarEvent, CATEGORIES
from weboob.tools.ordereddict import OrderedDict
from weboob.tools.value import Value
from .browser import RazibusBrowser
......
......@@ -17,11 +17,11 @@
# 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 collections import OrderedDict
from weboob.tools.backend import Module, BackendConfig
from weboob.capabilities.job import CapJob, BaseJobAdvert
from .browser import RegionsjobBrowser
from weboob.tools.ordereddict import OrderedDict
from weboob.tools.value import Value
......
......@@ -19,6 +19,7 @@
from datetime import datetime, timedelta
import re
from collections import OrderedDict
from cStringIO import StringIO
from logging import error
from weboob.tools.json import json
......@@ -31,7 +32,6 @@ from weboob.browser.filters.standard import CleanText, Regexp, CleanDecimal, \
Env, Date
from weboob.browser.filters.html import Attr
from weboob.tools.capabilities.bank.transactions import FrenchTransaction
from weboob.tools.ordereddict import OrderedDict
from ..captcha import Captcha, TileError
from .base import BasePage
......
......@@ -18,11 +18,11 @@
# 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 collections import OrderedDict
from weboob.capabilities.video import CapVideo, BaseVideo
from weboob.capabilities.collection import CapCollection, CollectionNotFound, Collection
from weboob.tools.backend import Module, BackendConfig
from weboob.tools.ordereddict import OrderedDict
from weboob.tools.value import Value
......
......@@ -17,9 +17,9 @@
# 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 collections import OrderedDict
from weboob.tools.backend import Module, BackendConfig
from weboob.tools.ordereddict import OrderedDict
from weboob.tools.value import Value
from weboob.capabilities.travel import CapTravel, Station, Departure
from weboob.capabilities import UserError
......
......@@ -17,9 +17,10 @@
# 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 collections import OrderedDict
from weboob.capabilities.weather import CapWeather
from weboob.tools.backend import Module, BackendConfig
from weboob.tools.ordereddict import OrderedDict
from weboob.tools.value import Value
from .browser import YahooBrowser
......
......@@ -27,9 +27,9 @@ import os
import sys
import inspect
from datetime import datetime, timedelta
from collections import OrderedDict
import weboob.applications
from weboob.tools.ordereddict import OrderedDict
from weboob.tools.application.console import ConsoleApplication
......
......@@ -24,10 +24,10 @@ import re
import sys
from urlparse import urlsplit
from random import choice
from collections import OrderedDict
from weboob.capabilities.content import CapContent
from weboob.tools.application.repl import ReplApplication
from weboob.tools.ordereddict import OrderedDict
__all__ = ['Boobathon']
......
......@@ -21,12 +21,12 @@ from __future__ import print_function
import os
import re
from collections import OrderedDict
from weboob.capabilities.account import CapAccount
from weboob.exceptions import ModuleLoadError
from weboob.tools.application.repl import ReplApplication
from weboob.tools.application.console import ConsoleProgress
from weboob.tools.ordereddict import OrderedDict
from weboob.tools.application.formatters.iformatter import IFormatter
__all__ = ['WeboobCfg']
......
......@@ -19,6 +19,7 @@
from __future__ import absolute_import, print_function
from collections import OrderedDict
from functools import wraps
import re
import pickle
......@@ -47,7 +48,6 @@ except ImportError:
from weboob.exceptions import BrowserHTTPSDowngrade, ModuleInstallError
from weboob.tools.log import getLogger
from weboob.tools.ordereddict import OrderedDict
from weboob.tools.json import json
from .cookies import WeboobCookieJar
......
......@@ -19,10 +19,10 @@
import re
import sys
from collections import OrderedDict
from copy import deepcopy
from weboob.tools.log import getLogger, DEBUG_FILTERS
from weboob.tools.ordereddict import OrderedDict
from weboob.browser.pages import NextPage
from .filters.standard import _Filter, CleanText
......
......@@ -19,6 +19,7 @@
from __future__ import absolute_import
from collections import OrderedDict
from functools import wraps
import warnings
from io import BytesIO
......@@ -34,7 +35,6 @@ import requests
from weboob.exceptions import ParseError, ModuleInstallError
from weboob.tools.compat import basestring
from weboob.tools.log import getLogger
from weboob.tools.ordereddict import OrderedDict
from weboob.tools.pdf import decompress_pdf
......
......@@ -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 collections import OrderedDict
import warnings
import re
from decimal import Decimal
......@@ -25,7 +25,6 @@ from copy import deepcopy, copy
from weboob.tools.compat import unicode, long
from weboob.tools.misc import to_unicode
from weboob.tools.ordereddict import OrderedDict
__all__ = ['UserError', 'FieldNotFound', 'NotAvailable',
......
......@@ -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 weboob.tools.ordereddict import OrderedDict
from collections import OrderedDict
from .base import Capability, BaseObject, UserError, StringField, Field
......
......@@ -17,10 +17,10 @@
# 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 collections import OrderedDict
from .base import Capability, BaseObject, Field, StringField, BytesField, IntField, \
UserError
from weboob.tools.ordereddict import OrderedDict
__all__ = ['ProfileNode', 'ContactPhoto', 'Contact', 'QueryError', 'Query', 'CapContact']
......
......@@ -18,7 +18,8 @@
# 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.tools.ordereddict import OrderedDict
from collections import OrderedDict
from .base import NotLoaded, Field, BytesField
from .file import CapFile, BaseFile
......
......@@ -20,6 +20,7 @@
from __future__ import print_function
from collections import OrderedDict
from copy import copy
import getpass
import logging
......@@ -38,7 +39,6 @@ from weboob.exceptions import BrowserUnavailable, BrowserIncorrectPassword, Brow
from weboob.tools.value import Value, ValueBool, ValueFloat, ValueInt, ValueBackendPassword
from weboob.tools.misc import to_unicode
from weboob.tools.compat import check_output
from weboob.tools.ordereddict import OrderedDict
from .base import Application, MoreResultsAvailable
......
......@@ -20,6 +20,7 @@
from __future__ import print_function
from collections import OrderedDict
import os
import sys
import subprocess
......@@ -61,7 +62,6 @@ else:
from weboob.capabilities.base import BaseObject
from weboob.tools.application.console import ConsoleApplication
from weboob.tools.ordereddict import OrderedDict
from weboob.tools.misc import guess_encoding
__all__ = ['IFormatter', 'MandatoryFieldsNotFound']
......
......@@ -26,6 +26,7 @@ from PyQt5.QtGui import QTextDocument, QPixmap, QImage, QIcon
from PyQt5.QtCore import Qt, QVariant, QUrl, QThread
from PyQt5.QtCore import pyqtSignal as Signal, pyqtSlot as Slot
from collections import OrderedDict
import re
import os
from logging import warning
......@@ -36,7 +37,6 @@ from weboob.capabilities.account import CapAccount, Account, AccountRegisterErro
from weboob.exceptions import ModuleInstallError, ModuleLoadError
from .backendcfg_ui import Ui_BackendCfg
from .reposdlg_ui import Ui_RepositoriesDlg
from weboob.tools.ordereddict import OrderedDict
from weboob.tools.misc import to_unicode
from .qt import QtValue
......
......@@ -21,6 +21,7 @@ from __future__ import print_function
import atexit
from cmd import Cmd
from collections import OrderedDict
import logging
import re
from optparse import OptionGroup, OptionParser, IndentedHelpFormatter
......@@ -32,7 +33,6 @@ from weboob.core import CallErrors
from weboob.tools.application.formatters.iformatter import MandatoryFieldsNotFound
from weboob.tools.misc import to_unicode
from weboob.tools.path import WorkingPath
from weboob.tools.ordereddict import OrderedDict
from weboob.capabilities.collection import Collection, BaseCollection, CapCollection, CollectionNotFound
from .console import BackendNotGiven, ConsoleApplication
......
......@@ -19,11 +19,11 @@
from ConfigParser import RawConfigParser, DEFAULTSECT
from collections import OrderedDict
from decimal import Decimal
import logging
import os
from weboob.tools.ordereddict import OrderedDict
from .iconfig import IConfig
......
# -*- coding: utf-8 -*-
# Copyright(C) 2010-2011 Christophe Benz
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# weboob is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# 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 __future__ import absolute_import
__all__ = ['OrderedDict']
try:
from collections import OrderedDict
except ImportError:
try:
from simplejson import OrderedDict
except ImportError:
try:
from ordereddict import OrderedDict
except ImportError:
# {{{ http://code.activestate.com/recipes/576693/ (r6)
from UserDict import DictMixin
class OrderedDict(dict, DictMixin):
def __init__(self, *args, **kwds):
if len(args) > 1:
raise TypeError('expected at most 1 arguments, got %d' % len(args))
try:
self.__end
except AttributeError:
self.clear()
self.update(*args, **kwds)
def clear(self):
self.__end = end = []
end += [None, end, end] # sentinel node for doubly linked list
self.__map = {} # key --> [key, prev, next]
dict.clear(self)
def __setitem__(self, key, value):
if key not in self:
end = self.__end
curr = end[1]
curr[2] = end[1] = self.__map[key] = [key, curr, end]
dict.__setitem__(self, key, value)
def __delitem__(self, key):
dict.__delitem__(self, key)
key, prev, next = self.__map.pop(key)
prev[2] = next