From 437b2bd297131f00cb9db806be477c8faa7e57c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 1 Mar 2020 12:33:51 +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 | 6 +++--- payment.py | 4 +--- setup.py | 7 ++++--- tests/__init__.py | 2 +- 5 files changed, 11 insertions(+), 10 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 0be492c01f..74a506849c 100644 --- a/__init__.py +++ b/__init__.py @@ -1,11 +1,11 @@ # 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 Pool -from .payment import * +from . import payment def register(): Pool.register( - Journal, - Group, + payment.Journal, + payment.Group, module='account_payment_sepa_cfonb', type_='model') diff --git a/payment.py b/payment.py index 425dd0824a..d756cd2169 100644 --- a/payment.py +++ b/payment.py @@ -9,9 +9,6 @@ from trytond.pool import PoolMeta from trytond.modules.account_payment_sepa import payment as sepa_payment -__all__ = ['Journal', 'Group'] - - class Journal(metaclass=PoolMeta): __name__ = 'account.payment.journal' @@ -29,6 +26,7 @@ class Journal(metaclass=PoolMeta): if flavor not in field.selection: field.selection.append(flavor) + loader = genshi.template.TemplateLoader([ os.path.join(os.path.dirname(__file__), 'template'), os.path.join( diff --git a/setup.py b/setup.py index 7850c15227..ac6d391a5f 100755 --- a/setup.py +++ b/setup.py @@ -80,8 +80,8 @@ setup(name=name, keywords='tryton account payment SEPA CFONB', package_dir={'trytond.modules.account_payment_sepa_cfonb': '.'}, packages=( - ['trytond.modules.account_payment_sepa_cfonb'] + - ['trytond.modules.account_payment_sepa_cfonb.%s' % p + ['trytond.modules.account_payment_sepa_cfonb'] + + ['trytond.modules.account_payment_sepa_cfonb.%s' % p for p in find_packages()] ), package_data={ @@ -96,7 +96,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 cd209f3e01..e77012cd81 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -2,7 +2,7 @@ # this repository contains the full copyright notices and license terms. try: - from trytond.modules.account_payment_sepa_cfonb.tests.test_account_payment_sepa_cfonb import suite + from trytond.modules.account_payment_sepa_cfonb.tests.test_account_payment_sepa_cfonb import suite # noqa: E501 except ImportError: from .test_account_payment_sepa_cfonb import suite