The new woob repository is here: https://gitlab.com/woob/woob. This gitlab will be removed soon.

The new woob repository is here: https://gitlab.com/woob/woob. This gitlab will be removed soon.

Commit c4b64727 authored by ROLY Dorian's avatar ROLY Dorian Committed by Vincent A

[axa] Formatted pages/bank.py for from future import unicode_litterals to work

parent 24bc726c
......@@ -17,6 +17,8 @@
# You should have received a copy of the GNU Lesser General Public License
# along with this weboob module. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
from collections import OrderedDict
import re
from decimal import Decimal, InvalidOperation
......@@ -120,7 +122,7 @@ def get_list(self):
for table in self.has_accounts():
tds = table.xpath('./tbody/tr')[0].findall('td')
if len(tds) < 3:
if tds[0].text_content() == u'Pr\xeat Personnel':
if tds[0].text_content() == 'Prêt Personnel':
account = Account()
args = self.js2args(table.xpath('.//a')[0].attrib['onclick'])
......@@ -152,7 +154,7 @@ def get_list(self):
if len(box.xpath('.//a')) != 0 and 'onclick' in box.xpath('.//a')[0].attrib:
args = self.js2args(box.xpath('.//a')[0].attrib['onclick'])
account.label = u'{0} {1}'.format(unicode(table.xpath('./caption')[0].text.strip()), unicode(box.xpath('.//a')[0].text.strip()))
account.label = '%s %s' % (table.xpath('./caption')[0].text.strip(), box.xpath('.//a')[0].text.strip())
elif len(foot[0].xpath('.//a')) != 0 and 'onclick' in foot[0].xpath('.//a')[0].attrib:
args = self.js2args(foot[0].xpath('.//a')[0].attrib['onclick'])
account.label = table.xpath('./caption')[0].text.strip()
......@@ -207,8 +209,8 @@ def get_list(self):
account.number = Regexp(CleanText('./td[contains(@class,"libelle")]', replace=[(' ', ''), ('x', 'X')]), r'(X{12}\d{4})')(box)
account.id += Regexp(CleanText('./td[contains(@class,"libelle")]'), r'(\d+)')(box)
if u'Valorisation' in account.label or u'Liquidités' in account.label:
account.id += args[next(k for k in args.keys() if "_idcl" in k)].split('Jsp')[-1]
if 'Valorisation' in account.label or 'Liquidités' in account.label:
account.id += args[next(k for k in args.keys() if '_idcl' in k)].split('Jsp')[-1]
# get accounts balance
try:
......@@ -216,7 +218,7 @@ def get_list(self):
# skip debit card
# some cards don't have information in balance tab, skip them
if balance_value == u'Débit immédiat' or balance_value == '':
if balance_value == 'Débit immédiat' or balance_value == '':
account._is_debit_card = True
else:
account._is_debit_card = False
......@@ -254,7 +256,7 @@ def get_profile_name(self):
class IbanPage(PDFPage):
def get_iban(self):
iban = u''
iban = ''
# according to re module doc, list returned by re.findall always
# be in the same order as they are in the source text
......@@ -333,12 +335,12 @@ class iter_investment(TableElement):
item_xpath = '//table[contains(@id, "titres") or contains(@id, "OPCVM")]/tbody/tr'
head_xpath = '//table[contains(@id, "titres") or contains(@id, "OPCVM")]/thead/tr/th[not(caption)]'
col_label = u'Intitulé'
col_quantity = u'NB'
col_unitprice = re.compile(u'Prix de revient')
col_unitvalue = u'Dernier cours'
col_diff = re.compile(u'\+/\- Values latentes')
col_valuation = re.compile(u'Montant')
col_label = 'Intitulé'
col_quantity = 'NB'
col_unitprice = re.compile('Prix de revient')
col_unitvalue = 'Dernier cours'
col_diff = re.compile('\+/- Values latentes')
col_valuation = re.compile('Montant')
class item(ItemElement):
klass = Investment
......@@ -435,10 +437,10 @@ def get_history(self):
continue
t = BankTransaction()
date = u''.join([txt.strip() for txt in tds[self.COL_DATE].itertext()])
raw = u''.join([txt.strip() for txt in tds[self.COL_TEXT].itertext()])
debit = self.parse_number(u''.join([txt.strip() for txt in tds[self.COL_DEBIT].itertext()]))
credit = self.parse_number(u''.join([txt.strip() for txt in tds[self.COL_CREDIT].itertext()]))
date = ''.join([txt.strip() for txt in tds[self.COL_DATE].itertext()])
raw = ''.join([txt.strip() for txt in tds[self.COL_TEXT].itertext()])
debit = self.parse_number(''.join([txt.strip() for txt in tds[self.COL_DEBIT].itertext()]))
credit = self.parse_number(''.join([txt.strip() for txt in tds[self.COL_CREDIT].itertext()]))
t.parse(date, re.sub(r'[ ]+', ' ', raw), vdate=date)
t.set_amount(credit, debit)
......@@ -460,9 +462,9 @@ def get_summary(self):
continue
t = BankTransaction()
date = u''.join([txt.strip() for txt in tds[self.COL_DATE].itertext()])
raw = self.parse_number(u''.join([txt.strip() for txt in tds[self.COL_TEXT].itertext()]))
credit = self.parse_number(u''.join([txt.strip() for txt in tds[self.COL_CB_CREDIT].itertext()]))
date = ''.join([txt.strip() for txt in tds[self.COL_DATE].itertext()])
raw = self.parse_number(''.join([txt.strip() for txt in tds[self.COL_TEXT].itertext()]))
credit = self.parse_number(''.join([txt.strip() for txt in tds[self.COL_CB_CREDIT].itertext()]))
debit = ""
t.parse(date, re.sub(r'[ ]+', ' ', raw))
......@@ -529,8 +531,8 @@ class iter_history(TableElement):
head_xpath = '//table[@id="ctl00_ContentPlaceHolderMain_PaymentListing_gvInfos"]/tr[@class="Header"]/th'
col_date = 'Date'
col_label = re.compile(u'^Nature')
col_amount = re.compile(u'^Montant net de frais')
col_label = re.compile('^Nature')
col_amount = re.compile('^Montant net de frais')
class item(ItemElement):
klass = BankTransaction
......@@ -550,11 +552,11 @@ class iter_transaction_investments(TableElement):
item_xpath = '//table[@id="ctl00_ContentPlaceHolderPopin_UcDetailMouvement_UcInvestissement_gvInfos"]/tr[not(contains(@class, "Header"))]'
head_xpath = '//table[@id="ctl00_ContentPlaceHolderPopin_UcDetailMouvement_UcInvestissement_gvInfos"]/tr[@class="Header"]/th'
col_label = u'Support'
col_vdate = u'Date de valeur'
col_unitprice = u"Valeur de l'UC"
col_quantity = u"Nombre d'UC"
col_valuation = u'Montant'
col_label = 'Support'
col_vdate = 'Date de valeur'
col_unitprice = "Valeur de l'UC"
col_quantity = "Nombre d'UC"
col_valuation = 'Montant'
class item(ItemElement):
klass = Investment
......
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