Fix flake8 errors and warnings
We add the flake8 configuration used so we ensure everyone uses the same. We remove the usage of __all__ for non public API. When possible, we rationalize the class name according to its __name__ and module. issue9082 review297061002
This commit is contained in:
1 parent
04f0c470c9
commit
605e95fc79
7 files changed
+25
-27
No files matched your search
+14
-11
@@ -2,23 +2,26 @@
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
|
||||
from trytond.pool import Pool
|
||||
from .account import *
|
||||
from .line import *
|
||||
from . import account
|
||||
from . import line
|
||||
from . import rule
|
||||
from .account import AnalyticMixin
|
||||
|
||||
__all__ = [AnalyticMixin]
|
||||
|
||||
|
||||
def register():
|
||||
Pool.register(
|
||||
Account,
|
||||
AccountDistribution,
|
||||
OpenChartAccountStart,
|
||||
AnalyticAccountEntry,
|
||||
Line,
|
||||
Move,
|
||||
MoveLine,
|
||||
account.Account,
|
||||
account.AccountDistribution,
|
||||
account.OpenChartAccountStart,
|
||||
account.AnalyticAccountEntry,
|
||||
line.Line,
|
||||
line.Move,
|
||||
line.MoveLine,
|
||||
rule.Rule,
|
||||
module='analytic_account', type_='model')
|
||||
Pool.register(
|
||||
OpenChartAccount,
|
||||
OpenAccount,
|
||||
account.OpenChartAccount,
|
||||
line.OpenAccount,
|
||||
module='analytic_account', type_='wizard')
|
||||
+4
-8
@@ -3,7 +3,7 @@
|
||||
from decimal import Decimal
|
||||
from collections import defaultdict
|
||||
|
||||
from sql import Column
|
||||
from sql import Column, Literal, Null
|
||||
from sql.aggregate import Sum
|
||||
from sql.conditionals import Coalesce
|
||||
|
||||
@@ -18,10 +18,6 @@ from trytond.pool import Pool
|
||||
|
||||
from .exceptions import AccountValidationError
|
||||
|
||||
__all__ = ['Account', 'AccountDistribution',
|
||||
'OpenChartAccountStart', 'OpenChartAccount',
|
||||
'AnalyticAccountEntry', 'AnalyticMixin']
|
||||
|
||||
|
||||
class Account(
|
||||
DeactivableMixin, tree('distribution_parents'), tree(),
|
||||
@@ -191,7 +187,7 @@ class Account(
|
||||
Sum(Coalesce(line.credit, 0) - Coalesce(line.debit, 0)),
|
||||
where=(table.type != 'view')
|
||||
& table.id.in_(all_ids)
|
||||
& (table.active == True) & line_query,
|
||||
& (table.active == Literal(True)) & line_query,
|
||||
group_by=table.id))
|
||||
account_sum = defaultdict(Decimal)
|
||||
for account_id, value in cursor.fetchall():
|
||||
@@ -245,7 +241,7 @@ class Account(
|
||||
).select(*columns,
|
||||
where=(table.type != 'view')
|
||||
& table.id.in_(ids)
|
||||
& (table.active == True) & line_query,
|
||||
& (table.active == Literal(True)) & line_query,
|
||||
group_by=table.id))
|
||||
|
||||
for row in cursor.fetchall():
|
||||
@@ -486,7 +482,7 @@ class AnalyticMixin(object):
|
||||
entry = AccountEntry.__table__()
|
||||
table = cls.__table__()
|
||||
cursor.execute(*table.select(table.id, table.analytic_accounts,
|
||||
where=table.analytic_accounts != None))
|
||||
where=table.analytic_accounts != Null))
|
||||
for line_id, selection_id in cursor.fetchall():
|
||||
cursor.execute(*entry.update(
|
||||
columns=[entry.origin],
|
||||
|
||||
@@ -11,8 +11,6 @@ from trytond.pyson import Eval, PYSONEncoder
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.pool import Pool, PoolMeta
|
||||
|
||||
__all__ = ['Line', 'Move', 'MoveLine', 'OpenAccount']
|
||||
|
||||
|
||||
class Line(ModelSQL, ModelView):
|
||||
'Analytic Line'
|
||||
|
||||
@@ -7,8 +7,6 @@ from trytond.transaction import Transaction
|
||||
|
||||
from .account import AnalyticMixin
|
||||
|
||||
__all__ = ['Rule']
|
||||
|
||||
|
||||
class Rule(sequence_ordered(), MatchMixin, AnalyticMixin, ModelSQL, ModelView):
|
||||
"Analytic Rule"
|
||||
|
||||
@@ -79,8 +79,8 @@ setup(name=name,
|
||||
keywords='tryton analytic account',
|
||||
package_dir={'trytond.modules.analytic_account': '.'},
|
||||
packages=(
|
||||
['trytond.modules.analytic_account'] +
|
||||
['trytond.modules.analytic_account.%s' % p for p in find_packages()]
|
||||
['trytond.modules.analytic_account']
|
||||
+ ['trytond.modules.analytic_account.%s' % p for p in find_packages()]
|
||||
),
|
||||
package_data={
|
||||
'trytond.modules.analytic_account': (info.get('xml', [])
|
||||
@@ -93,7 +93,8 @@ setup(name=name,
|
||||
'Intended Audience :: Developers',
|
||||
'Intended Audience :: Financial and Insurance Industry',
|
||||
'Intended Audience :: Legal Industry',
|
||||
'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
|
||||
'License :: OSI Approved :: '
|
||||
'GNU General Public License v3 or later (GPLv3+)',
|
||||
'Natural Language :: Bulgarian',
|
||||
'Natural Language :: Catalan',
|
||||
'Natural Language :: Chinese (Simplified)',
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
|
||||
try:
|
||||
from trytond.modules.analytic_account.tests.test_analytic_account import suite
|
||||
from trytond.modules.analytic_account.tests.test_analytic_account import suite # noqa: E501
|
||||
except ImportError:
|
||||
from .test_analytic_account import suite
|
||||
|
||||
|
||||
Reference in new issue
Block a user