From 9b19669eb6e12daea5651ddf151c2ec4f23262bf 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 | 10 +++++----- product.py | 3 --- setup.py | 7 ++++--- tests/__init__.py | 2 +- 5 files changed, 12 insertions(+), 12 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 f182213eba..41ae4c1a6c 100644 --- a/__init__.py +++ b/__init__.py @@ -2,13 +2,13 @@ # this repository contains the full copyright notices and license terms. from trytond.pool import Pool -from .product import * +from . import product def register(): Pool.register( - Template, - Product, - ClassificationDummy, - ClassificationTreeDummy, + product.Template, + product.Product, + product.ClassificationDummy, + product.ClassificationTreeDummy, module='product_classification', type_='model') diff --git a/product.py b/product.py index fe7c5a606d..1d17093547 100644 --- a/product.py +++ b/product.py @@ -5,9 +5,6 @@ from trytond.model import (ModelStorage, ModelView, DeactivableMixin, fields, from trytond.pool import PoolMeta, Pool from trytond.pyson import Eval -__all__ = ['ClassificationMixin', 'classification_tree', - 'Template', 'Product', 'ClassificationDummy', 'ClassificationTreeDummy'] - class ClassificationMixin(DeactivableMixin): __slots__ = () diff --git a/setup.py b/setup.py index 8b225ec5e0..ac1ee41d46 100755 --- a/setup.py +++ b/setup.py @@ -78,8 +78,8 @@ setup(name=name, keywords='tryton product classification', package_dir={'trytond.modules.product_classification': '.'}, packages=( - ['trytond.modules.product_classification'] + - ['trytond.modules.product_classification.%s' % p + ['trytond.modules.product_classification'] + + ['trytond.modules.product_classification.%s' % p for p in find_packages()] ), package_data={ @@ -91,7 +91,8 @@ setup(name=name, 'Environment :: Plugins', 'Framework :: Tryton', 'Intended Audience :: Developers', - '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 09b0677a63..9d3a88dae6 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.product_classification.tests.test_product_classification import suite + from trytond.modules.product_classification.tests.test_product_classification import suite # noqa: E501 except ImportError: from .test_product_classification import suite