From 5d3a3dc18c2cbb4ad5dd82007b2b3eb4e0bbebb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 17 Feb 2013 15:30:45 +0100 Subject: [PATCH] Fix flake8 --- account.py | 76 +++++++++++++++++++++++++++--------------------------- line.py | 15 ++++++----- setup.py | 8 +++--- 3 files changed, 50 insertions(+), 49 deletions(-) diff --git a/account.py b/account.py index 7572440f2f..252652d9f2 100644 --- a/account.py +++ b/account.py @@ -130,24 +130,24 @@ class Account(ModelSQL, ModelView): id2account[account.id] = account line_query = Line.query_get() - cursor.execute('SELECT a.id, ' \ - 'SUM((COALESCE(l.debit, 0) - COALESCE(l.credit, 0))), ' \ - 'c.currency ' \ - 'FROM analytic_account_account a ' \ - 'LEFT JOIN analytic_account_line l ' \ - 'ON (a.id = l.account) ' \ - 'LEFT JOIN account_move_line ml ' \ - 'ON (ml.id = l.move_line) ' \ - 'LEFT JOIN account_account aa ' \ - 'ON (aa.id = ml.account) ' \ - 'LEFT JOIN company_company c ' \ - 'ON (c.id = aa.company) ' \ - 'WHERE a.type != \'view\' ' \ - 'AND a.id IN (' + \ - ','.join(('%s',) * len(all_ids)) + ') ' \ - 'AND ' + line_query + ' ' \ - 'AND a.active ' \ - 'GROUP BY a.id, c.currency', all_ids) + cursor.execute('SELECT a.id, ' + 'SUM((COALESCE(l.debit, 0) - COALESCE(l.credit, 0))), ' + 'c.currency ' + 'FROM analytic_account_account a ' + 'LEFT JOIN analytic_account_line l ' + 'ON (a.id = l.account) ' + 'LEFT JOIN account_move_line ml ' + 'ON (ml.id = l.move_line) ' + 'LEFT JOIN account_account aa ' + 'ON (aa.id = ml.account) ' + 'LEFT JOIN company_company c ' + 'ON (c.id = aa.company) ' + 'WHERE a.type != \'view\' ' + 'AND a.id IN (' + + ','.join(('%s',) * len(all_ids)) + ') ' + 'AND ' + line_query + ' ' + 'AND a.active ' + 'GROUP BY a.id, c.currency', all_ids) account_sum = {} id2currency = {} for account_id, sum, currency_id in cursor.fetchall(): @@ -199,24 +199,24 @@ class Account(ModelSQL, ModelView): id2account[account.id] = account line_query = Line.query_get() - cursor.execute('SELECT a.id, ' \ - 'SUM(COALESCE(l.' + name + ', 0)), ' \ - 'c.currency ' \ - 'FROM analytic_account_account a ' \ - 'LEFT JOIN analytic_account_line l ' \ - 'ON (a.id = l.account) ' \ - 'LEFT JOIN account_move_line ml ' \ - 'ON (ml.id = l.move_line) ' \ - 'LEFT JOIN account_account aa ' \ - 'ON (aa.id = ml.account) ' \ - 'LEFT JOIN company_company c ' \ - 'ON (c.id = aa.company) ' \ - 'WHERE a.type != \'view\' ' \ - 'AND a.id IN (' + \ - ','.join(('%s',) * len(ids)) + ') ' \ - 'AND ' + line_query + ' ' \ - 'AND a.active ' \ - 'GROUP BY a.id, c.currency', ids) + cursor.execute('SELECT a.id, ' + 'SUM(COALESCE(l.' + name + ', 0)), ' + 'c.currency ' + 'FROM analytic_account_account a ' + 'LEFT JOIN analytic_account_line l ' + 'ON (a.id = l.account) ' + 'LEFT JOIN account_move_line ml ' + 'ON (ml.id = l.move_line) ' + 'LEFT JOIN account_account aa ' + 'ON (aa.id = ml.account) ' + 'LEFT JOIN company_company c ' + 'ON (c.id = aa.company) ' + 'WHERE a.type != \'view\' ' + 'AND a.id IN (' + + ','.join(('%s',) * len(ids)) + ') ' + 'AND ' + line_query + ' ' + 'AND a.active ' + 'GROUP BY a.id, c.currency', ids) id2currency = {} for account_id, sum, currency_id in cursor.fetchall(): @@ -338,8 +338,8 @@ class AccountSelection(ModelSQL, ModelView): ('check_root', 'root_account'), ] cls._error_messages.update({ - 'root_account': 'Can not have many accounts with the same ' \ - 'root or a missing mandatory root account!', + 'root_account': ('Can not have many accounts with the same ' + 'root or a missing mandatory root account!'), }) @classmethod diff --git a/line.py b/line.py index 4746014ae1..81125f86f4 100644 --- a/line.py +++ b/line.py @@ -47,9 +47,10 @@ class Line(ModelSQL, ModelView): ('check_account', 'line_on_view_inactive_account'), ] cls._error_messages.update({ - 'line_on_view_inactive_account': 'You can not create move line\n' \ - 'on view/inactive account!', - }) + 'line_on_view_inactive_account': ( + 'You can not create move line\n' + 'on view/inactive account!'), + }) cls._order.insert(0, ('date', 'ASC')) @classmethod @@ -97,13 +98,13 @@ class Line(ModelSQL, ModelView): if Transaction().context.get('start_date'): # Check start_date time.strptime(str(Transaction().context['start_date']), '%Y-%m-%d') - res += ' AND ' + obj + '.date >= date(\'' + \ - str(Transaction().context['start_date']) + '\')' + res += (' AND ' + obj + '.date >= date(\'' + + str(Transaction().context['start_date']) + '\')') if Transaction().context.get('end_date'): # Check end_date time.strptime(str(Transaction().context['end_date']), '%Y-%m-%d') - res += ' AND ' + obj + '.date <= date(\'' + \ - str(Transaction().context['end_date']) + '\')' + res += (' AND ' + obj + '.date <= date(\'' + + str(Transaction().context['end_date']) + '\')') return res def check_account(self): diff --git a/setup.py b/setup.py index 51833b295b..8964f4ef02 100644 --- a/setup.py +++ b/setup.py @@ -36,16 +36,16 @@ setup(name='trytond_analytic_account', long_description=read('README'), author='Tryton', url='http://www.tryton.org/', - download_url="http://downloads.tryton.org/" + \ - info.get('version', '0.0.1').rsplit('.', 1)[0] + '/', + download_url=("http://downloads.tryton.org/" + + info.get('version', '0.0.1').rsplit('.', 1)[0] + '/'), package_dir={'trytond.modules.analytic_account': '.'}, packages=[ 'trytond.modules.analytic_account', 'trytond.modules.analytic_account.tests', ], package_data={ - 'trytond.modules.analytic_account': info.get('xml', []) \ - + ['tryton.cfg', 'locale/*.po'], + 'trytond.modules.analytic_account': (info.get('xml', []) + + ['tryton.cfg', 'locale/*.po']), }, classifiers=[ 'Development Status :: 5 - Production/Stable',