From 71770b9285351406a1e111e93a5a013e68795fd4 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 | 20 ++++++++++---------- product.py | 2 -- production.py | 2 -- routing.py | 4 +--- setup.py | 8 +++++--- 6 files changed, 18 insertions(+), 20 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 3b1184cd1c..a8d7347269 100644 --- a/__init__.py +++ b/__init__.py @@ -2,18 +2,18 @@ # this repository contains the full copyright notices and license terms. from trytond.pool import Pool -from .routing import * -from .production import * -from .product import * +from . import routing +from . import production +from . import product def register(): Pool.register( - Routing, - Operation, - RoutingStep, - Routing_BOM, - Production, - ProductBom, - ProductionLeadTime, + routing.Routing, + routing.RoutingOperation, + routing.RoutingStep, + routing.Routing_BOM, + production.Production, + product.ProductBom, + product.ProductionLeadTime, module='production_routing', type_='model') diff --git a/product.py b/product.py index ed7f76da46..885a75b10a 100644 --- a/product.py +++ b/product.py @@ -4,8 +4,6 @@ from trytond.pool import PoolMeta from trytond.model import fields from trytond.pyson import Eval -__all__ = ['ProductBom', 'ProductionLeadTime'] - class ProductBom(metaclass=PoolMeta): __name__ = 'product.product-production.bom' diff --git a/production.py b/production.py index e12e9fd32b..c9e0e3d968 100644 --- a/production.py +++ b/production.py @@ -4,8 +4,6 @@ from trytond.pool import PoolMeta from trytond.model import fields from trytond.pyson import Eval -__all__ = ['Production'] - class Production(metaclass=PoolMeta): __name__ = 'production' diff --git a/routing.py b/routing.py index fa09366e86..634a20d584 100644 --- a/routing.py +++ b/routing.py @@ -3,8 +3,6 @@ from trytond.model import ( ModelSQL, ModelView, DeactivableMixin, fields, sequence_ordered) -__all__ = ['Routing', 'Operation', 'RoutingStep', 'Routing_BOM'] - class Routing(DeactivableMixin, ModelSQL, ModelView): 'Routing' @@ -15,7 +13,7 @@ class Routing(DeactivableMixin, ModelSQL, ModelView): 'production.routing-production.bom', 'routing', 'bom', 'BOMs') -class Operation(DeactivableMixin, ModelSQL, ModelView): +class RoutingOperation(DeactivableMixin, ModelSQL, ModelView): 'Operation' __name__ = 'production.routing.operation' name = fields.Char('Operation', required=True, translate=True) diff --git a/setup.py b/setup.py index 2e0e871c1d..3b9e1f3d1d 100755 --- a/setup.py +++ b/setup.py @@ -79,8 +79,9 @@ setup(name=name, keywords='tryton production routing', package_dir={'trytond.modules.production_routing': '.'}, packages=( - ['trytond.modules.production_routing'] + - ['trytond.modules.production_routing.%s' % p for p in find_packages()] + ['trytond.modules.production_routing'] + + ['trytond.modules.production_routing.%s' % p + for p in find_packages()] ), package_data={ 'trytond.modules.production_routing': (info.get('xml', []) @@ -94,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)',