From 71f699b4c43eec208cc9bfa52347c85ac41b192d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 1 Mar 2020 12:33:54 +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 | 4 ++-- purchase_request.py | 6 ++---- 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 b963e194af..85cf38c4c7 100644 --- a/__init__.py +++ b/__init__.py @@ -2,10 +2,10 @@ # this repository contains the full copyright notices and license terms. from trytond.pool import Pool -from .purchase_request import * +from . import purchase_request def register(): Pool.register( - PurchaseRequest, + purchase_request.Request, module='stock_supply_forecast', type_='model') diff --git a/purchase_request.py b/purchase_request.py index c5dc26df24..e7cada7434 100644 --- a/purchase_request.py +++ b/purchase_request.py @@ -2,10 +2,8 @@ # this repository contains the full copyright notices and license terms. from trytond.pool import Pool, PoolMeta -__all__ = ['PurchaseRequest'] - -class PurchaseRequest(metaclass=PoolMeta): +class Request(metaclass=PoolMeta): __name__ = 'purchase.request' @classmethod @@ -21,5 +19,5 @@ class PurchaseRequest(metaclass=PoolMeta): ('state', '=', 'done'), ]) Forecast.create_moves(forecasts) - super(PurchaseRequest, cls).generate_requests(*args, **kwargs) + super().generate_requests(*args, **kwargs) Forecast.delete_moves(forecasts) diff --git a/setup.py b/setup.py index 7c1db672ad..7a4bf384ce 100755 --- a/setup.py +++ b/setup.py @@ -79,8 +79,8 @@ setup(name=name, keywords='tryton stock supply forecast', package_dir={'trytond.modules.stock_supply_forecast': '.'}, packages=( - ['trytond.modules.stock_supply_forecast'] + - ['trytond.modules.stock_supply_forecast.%s' % p + ['trytond.modules.stock_supply_forecast'] + + ['trytond.modules.stock_supply_forecast.%s' % p for p in find_packages()] ), package_data={ @@ -95,7 +95,8 @@ setup(name=name, 'Intended Audience :: Financial and Insurance Industry', 'Intended Audience :: Legal Industry', 'Intended Audience :: Manufacturing', - '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 0dfe67c672..9643ae091f 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.stock_supply_forecast.tests.test_stock_supply_forecast import suite + from trytond.modules.stock_supply_forecast.tests.test_stock_supply_forecast import suite # noqa: E501 except ImportError: from .test_stock_supply_forecast import suite