From 1f18c67958ff73e08dfcf31c37fc9654d166e343 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 1 Mar 2020 12:33:52 +0100 Subject: [PATCH] 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 --- .flake8 | 2 ++ __init__.py | 16 ++++++++-------- account.py | 2 -- commission.py | 4 ---- invoice.py | 3 --- setup.py | 8 +++++--- tests/__init__.py | 2 +- 7 files changed, 16 insertions(+), 21 deletions(-) create mode 100644 .flake8 diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000000..bb03d08a82 --- /dev/null +++ b/.flake8 @@ -0,0 +1,2 @@ +[flake8] +ignore=E123,E124,E126,E128,W503 diff --git a/__init__.py b/__init__.py index f3a496d0f5..48242828e6 100644 --- a/__init__.py +++ b/__init__.py @@ -2,16 +2,16 @@ # this repository contains the full copyright notices and license terms. from trytond.pool import Pool -from .commission import * -from .invoice import * -from .account import * +from . import commission +from . import invoice +from . import account def register(): Pool.register( - Agent, - Commission, - Invoice, - InvoiceLine, - Move, + commission.Agent, + commission.Commission, + invoice.Invoice, + invoice.InvoiceLine, + account.Move, module='commission_waiting', type_='model') diff --git a/account.py b/account.py index efcf7af68c..ac4f94cf63 100644 --- a/account.py +++ b/account.py @@ -3,8 +3,6 @@ from trytond.pool import PoolMeta -__all__ = ['Move'] - class Move(metaclass=PoolMeta): __name__ = 'account.move' diff --git a/commission.py b/commission.py index e84b03638a..7153909ebc 100644 --- a/commission.py +++ b/commission.py @@ -1,16 +1,12 @@ # This file is part of Tryton. The COPYRIGHT file at the top level of # this repository contains the full copyright notices and license terms. - from trytond.pool import PoolMeta, Pool from trytond.model import ModelView, fields from trytond.pyson import Eval, Bool from trytond.transaction import Transaction -__all__ = ['Agent', 'Commission'] - - class Agent(metaclass=PoolMeta): __name__ = 'commission.agent' waiting_account = fields.Many2One('account.account', 'Waiting Account', diff --git a/invoice.py b/invoice.py index 561850d3dc..1f598f0b15 100644 --- a/invoice.py +++ b/invoice.py @@ -7,9 +7,6 @@ from trytond.pool import PoolMeta, Pool from trytond.model import ModelView, Workflow -__all__ = ['Invoice', 'InvoiceLine'] - - class Invoice(metaclass=PoolMeta): __name__ = 'account.invoice' diff --git a/setup.py b/setup.py index e5737f8ead..f6d6e73685 100755 --- a/setup.py +++ b/setup.py @@ -79,8 +79,9 @@ setup(name=name, keywords='tryton commission', package_dir={'trytond.modules.commission_waiting': '.'}, packages=( - ['trytond.modules.commission_waiting'] + - ['trytond.modules.commission_waiting.%s' % p for p in find_packages()] + ['trytond.modules.commission_waiting'] + + ['trytond.modules.commission_waiting.%s' % p + for p in find_packages()] ), package_data={ 'trytond.modules.commission_waiting': (info.get('xml', []) @@ -93,7 +94,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)', diff --git a/tests/__init__.py b/tests/__init__.py index be1ce2a465..850fc2d9bc 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,7 +1,7 @@ # This file is part of Tryton. The COPYRIGHT file at the top level of # this repository contains the full copyright notices and license terms. try: - from trytond.modules.commission_waiting.tests.test_commission_waiting import suite + from trytond.modules.commission_waiting.tests.test_commission_waiting import suite # noqa: E501 except ImportError: from .test_commission_waiting import suite