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:
+22
-17
@@ -2,25 +2,30 @@
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
|
||||
from trytond.pool import Pool
|
||||
from .uom import *
|
||||
from .category import *
|
||||
from .product import *
|
||||
from .configuration import *
|
||||
from . import uom
|
||||
from . import category
|
||||
from . import product
|
||||
from . import configuration
|
||||
from .product import price_digits
|
||||
from .uom import uom_conversion_digits
|
||||
|
||||
__all__ = [price_digits, uom_conversion_digits]
|
||||
|
||||
|
||||
def register():
|
||||
Pool.register(
|
||||
UomCategory,
|
||||
Uom,
|
||||
Category,
|
||||
Template,
|
||||
Product,
|
||||
ProductIdentifier,
|
||||
ProductListPrice,
|
||||
ProductCostPriceMethod, # before ProductCostPrice for migration
|
||||
ProductCostPrice,
|
||||
TemplateCategory,
|
||||
TemplateCategoryAll,
|
||||
Configuration,
|
||||
ConfigurationDefaultCostPriceMethod,
|
||||
uom.UomCategory,
|
||||
uom.Uom,
|
||||
category.Category,
|
||||
product.Template,
|
||||
product.Product,
|
||||
product.ProductIdentifier,
|
||||
product.ProductListPrice,
|
||||
# before ProductCostPrice for migration
|
||||
product.ProductCostPriceMethod,
|
||||
product.ProductCostPrice,
|
||||
product.TemplateCategory,
|
||||
product.TemplateCategoryAll,
|
||||
configuration.Configuration,
|
||||
configuration.ConfigurationDefaultCostPriceMethod,
|
||||
module='product', type_='model')
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
from trytond.model import ModelView, ModelSQL, fields, tree
|
||||
|
||||
__all__ = ['Category']
|
||||
|
||||
|
||||
class Category(tree(separator=' / '), ModelSQL, ModelView):
|
||||
"Product Category"
|
||||
|
||||
@@ -6,7 +6,6 @@ from trytond.model import (ModelView, ModelSQL, ModelSingleton,
|
||||
from trytond.pool import Pool
|
||||
from trytond.tools.multivalue import migrate_property
|
||||
|
||||
__all__ = ['Configuration', 'ConfigurationDefaultCostPriceMethod']
|
||||
default_cost_price_method = fields.Selection(
|
||||
'get_cost_price_methods', "Default Cost Method")
|
||||
|
||||
|
||||
+3
-4
@@ -25,9 +25,7 @@ from trytond.modules.company.model import (
|
||||
from .exceptions import InvalidIdentifierCode
|
||||
|
||||
|
||||
__all__ = ['Template', 'Product', 'price_digits', 'TemplateFunction',
|
||||
'ProductListPrice', 'ProductCostPriceMethod', 'ProductCostPrice',
|
||||
'TemplateCategory', 'TemplateCategoryAll', 'ProductIdentifier']
|
||||
__all__ = ['price_digits', 'TemplateFunction']
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
STATES = {
|
||||
@@ -450,7 +448,8 @@ class ProductCostPriceMethod(ModelSQL, CompanyValueMixin):
|
||||
cursor = Transaction().connection.cursor()
|
||||
|
||||
exist = backend.TableHandler.table_exist(cls._table)
|
||||
cost_price_exist = backend.TableHandler.table_exist(ProductCostPrice._table)
|
||||
cost_price_exist = backend.TableHandler.table_exist(
|
||||
ProductCostPrice._table)
|
||||
|
||||
super(ProductCostPriceMethod, cls).__register__(module_name)
|
||||
|
||||
|
||||
@@ -79,8 +79,8 @@ setup(name=name,
|
||||
keywords='tryton product',
|
||||
package_dir={'trytond.modules.product': '.'},
|
||||
packages=(
|
||||
['trytond.modules.product'] +
|
||||
['trytond.modules.product.%s' % p for p in find_packages()]
|
||||
['trytond.modules.product']
|
||||
+ ['trytond.modules.product.%s' % p for p in find_packages()]
|
||||
),
|
||||
package_data={
|
||||
'trytond.modules.product': (info.get('xml', [])
|
||||
@@ -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)',
|
||||
|
||||
Reference in New Issue
Block a user