changeset 1a0ac3ed33c1 in modules/customs:default
details: https://hg.tryton.org/modules/customs?cmd=changeset;node=1a0ac3ed33c1
description:
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
diffstat:
.flake8 | 2 ++
__init__.py | 16 ++++++++--------
customs.py | 2 --
product.py | 6 ++----
setup.py | 7 ++++---
5 files changed, 16 insertions(+), 17 deletions(-)
diffs (93 lines):
diff -r ef57bd7b12ea -r 1a0ac3ed33c1 .flake8
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/.flake8 Sun Mar 01 12:33:52 2020 +0100
@@ -0,0 +1,2 @@
+[flake8]
+ignore=E123,E124,E126,E128,W503
diff -r ef57bd7b12ea -r 1a0ac3ed33c1 __init__.py
--- a/__init__.py Fri Dec 06 17:33:46 2019 +0100
+++ b/__init__.py Sun Mar 01 12:33:52 2020 +0100
@@ -2,16 +2,16 @@
# this repository contains the full copyright notices and license terms.
from trytond.pool import Pool
-from .customs import *
-from .product import *
+from . import customs
+from . import product
def register():
Pool.register(
- TariffCode,
- DutyRate,
- Category,
- Template,
- Product_TariffCode,
- Product,
+ customs.TariffCode,
+ customs.DutyRate,
+ product.Category,
+ product.Template,
+ product.Product_TariffCode,
+ product.Product,
module='customs', type_='model')
diff -r ef57bd7b12ea -r 1a0ac3ed33c1 customs.py
--- a/customs.py Fri Dec 06 17:33:46 2019 +0100
+++ b/customs.py Sun Mar 01 12:33:52 2020 +0100
@@ -12,8 +12,6 @@
from trytond.modules.product import price_digits
-__all__ = ['TariffCode', 'DutyRate']
-
# Use 2 chars numbering to allow string comparison
MONTHS = [
(None, ''),
diff -r ef57bd7b12ea -r 1a0ac3ed33c1 product.py
--- a/product.py Fri Dec 06 17:33:46 2019 +0100
+++ b/product.py Sun Mar 01 12:33:52 2020 +0100
@@ -7,8 +7,6 @@
from trytond.transaction import Transaction
from trytond import backend
-__all__ = ['Category', 'Template', 'Product_TariffCode', 'Product']
-
class Category(metaclass=PoolMeta):
__name__ = 'product.category'
@@ -103,8 +101,8 @@
tariff_codes = fields.One2Many('product-customs.tariff.code',
'product', 'Tariff Codes', order=[('sequence', 'ASC'), ('id', 'ASC')],
states={
- 'invisible': ((Eval('type') == 'service') |
- Eval('tariff_codes_category', False)),
+ 'invisible': ((Eval('type') == 'service')
+ | Eval('tariff_codes_category', False)),
},
depends=['type', 'tariff_codes_category'])
diff -r ef57bd7b12ea -r 1a0ac3ed33c1 setup.py
--- a/setup.py Fri Dec 06 17:33:46 2019 +0100
+++ b/setup.py Sun Mar 01 12:33:52 2020 +0100
@@ -78,8 +78,8 @@
keywords='tryton customs tariff duty',
package_dir={'trytond.modules.customs': '.'},
packages=(
- ['trytond.modules.customs'] +
- ['trytond.modules.customs.%s' % p for p in find_packages()]
+ ['trytond.modules.customs']
+ + ['trytond.modules.customs.%s' % p for p in find_packages()]
),
package_data={
'trytond.modules.customs': (info.get('xml', [])
@@ -92,7 +92,8 @@
'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)',