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
This commit is contained in:
Cédric Krier
2020-03-01 12:33:52 +01:00
parent 1c42518767
commit ff3af2224b
5 changed files with 16 additions and 16 deletions
+2
View File
@@ -0,0 +1,2 @@
[flake8]
ignore=E123,E124,E126,E128,W503
+6 -6
View File
@@ -2,14 +2,14 @@
# 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(
ProductAttributeSet,
ProductAttribute,
ProductAttributeAttributeSet,
Template,
Product,
product.AttributeSet,
product.Attribute,
product.AttributeAttributeSet,
product.Template,
product.Product,
module='product_attribute', type_='model')
+3 -6
View File
@@ -4,11 +4,8 @@ from trytond.model import ModelSQL, ModelView, DictSchemaMixin, fields
from trytond.pool import PoolMeta
from trytond.pyson import Eval
__all__ = ['ProductAttributeSet', 'ProductAttribute',
'ProductAttributeAttributeSet', 'Template', 'Product']
class ProductAttributeSet(ModelSQL, ModelView, metaclass=PoolMeta):
class AttributeSet(ModelSQL, ModelView, metaclass=PoolMeta):
"Product Attribute Set"
__name__ = 'product.attribute.set'
name = fields.Char('Name', required=True, translate=True,
@@ -18,7 +15,7 @@ class ProductAttributeSet(ModelSQL, ModelView, metaclass=PoolMeta):
help="Add attributes to the set.")
class ProductAttribute(DictSchemaMixin, ModelSQL, ModelView, metaclass=PoolMeta):
class Attribute(DictSchemaMixin, ModelSQL, ModelView, metaclass=PoolMeta):
"Product Attribute"
__name__ = 'product.attribute'
sets = fields.Many2Many('product.attribute-product.attribute-set',
@@ -26,7 +23,7 @@ class ProductAttribute(DictSchemaMixin, ModelSQL, ModelView, metaclass=PoolMeta)
help="Add sets to the attribute.")
class ProductAttributeAttributeSet(ModelSQL, metaclass=PoolMeta):
class AttributeAttributeSet(ModelSQL, metaclass=PoolMeta):
"Product Attribute - Set"
__name__ = 'product.attribute-product.attribute-set'
attribute = fields.Many2One('product.attribute', 'Attribute',
+4 -3
View File
@@ -78,8 +78,8 @@ setup(name=name,
keywords='tryton product attribute',
package_dir={'trytond.modules.product_attribute': '.'},
packages=(
['trytond.modules.product_attribute'] +
['trytond.modules.product_attribute.%s' % p for p in find_packages()]
['trytond.modules.product_attribute']
+ ['trytond.modules.product_attribute.%s' % p for p in find_packages()]
),
package_data={
'trytond.modules.product_attribute': (info.get('xml', [])
@@ -93,7 +93,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)',
+1 -1
View File
@@ -2,7 +2,7 @@
# this repository contains the full copyright notices and license terms.
try:
from trytond.modules.product_attribute.tests.test_product_attribute import suite
from trytond.modules.product_attribute.tests.test_product_attribute import suite # noqa: E501
except ImportError:
from .test_product_attribute import suite