From 56090bb8df20e44d5c7835a043ecb1364a864d8d 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 | 14 +++++++------- carrier.py | 2 -- setup.py | 7 ++++--- stock.py | 2 -- 5 files changed, 13 insertions(+), 14 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 2fa35417b2..245aeb9c2c 100644 --- a/__init__.py +++ b/__init__.py @@ -3,17 +3,17 @@ from trytond.pool import Pool -from .stock import * -from .carrier import * +from . import stock +from . import carrier def register(): Pool.register( - PackageType, - Package, - ShipmentOut, - Carrier, + stock.PackageType, + stock.Package, + stock.ShipmentOut, + carrier.Carrier, module='stock_package_shipping', type_='model') Pool.register( - CreateShipping, + stock.CreateShipping, module='stock_package_shipping', type_='wizard') diff --git a/carrier.py b/carrier.py index 6644027c23..6a89e31e55 100644 --- a/carrier.py +++ b/carrier.py @@ -4,8 +4,6 @@ from trytond.model import fields from trytond.pool import PoolMeta -__all__ = ['Carrier'] - class Carrier(metaclass=PoolMeta): __name__ = 'carrier' diff --git a/setup.py b/setup.py index b284cb1c89..9f322c5612 100755 --- a/setup.py +++ b/setup.py @@ -80,8 +80,8 @@ setup(name=name, keywords='tryton stock package shipping', package_dir={'trytond.modules.stock_package_shipping': '.'}, packages=( - ['trytond.modules.stock_package_shipping'] + - ['trytond.modules.stock_package_shipping.%s' % p + ['trytond.modules.stock_package_shipping'] + + ['trytond.modules.stock_package_shipping.%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 :: Czech', diff --git a/stock.py b/stock.py index f6c830e4ca..2c940f4d06 100644 --- a/stock.py +++ b/stock.py @@ -11,8 +11,6 @@ from trytond.wizard import Wizard, StateTransition from .exceptions import PackWarning -__all__ = ['PackageType', 'Package', 'ShipmentOut', 'CreateShipping'] - class PackageType(metaclass=PoolMeta): __name__ = 'stock.package.type'