changeset e5de0a46c056 in modules/production:default
details:
https://hg.tryton.org/modules/production?cmd=changeset;node=e5de0a46c056
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 | 46 +++++++++++++++++++++++-----------------------
bom.py | 4 ----
configuration.py | 2 --
product.py | 7 +++----
setup.py | 7 ++++---
stock.py | 3 ---
7 files changed, 32 insertions(+), 39 deletions(-)
diffs (155 lines):
diff -r e0fa1b9e2ce4 -r e5de0a46c056 .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 e0fa1b9e2ce4 -r e5de0a46c056 __init__.py
--- a/__init__.py Sun Jan 26 15:29:23 2020 +0100
+++ b/__init__.py Sun Mar 01 12:33:52 2020 +0100
@@ -2,35 +2,35 @@
# this repository contains the full copyright notices and license terms.
from trytond.pool import Pool
-from .configuration import *
-from .bom import *
-from .product import *
-from .production import *
-from .stock import *
+from . import configuration
+from . import bom
+from . import product
+from . import production
+from . import stock
from . import ir
def register():
Pool.register(
- Configuration,
- ConfigurationProductionSequence,
- BOM,
- BOMInput,
- BOMOutput,
- BOMTree,
- OpenBOMTreeStart,
- OpenBOMTreeTree,
- Production,
- AssignFailed,
- Template,
- Product,
- ProductBom,
- ProductionLeadTime,
- Location,
- Move,
+ configuration.Configuration,
+ configuration.ConfigurationProductionSequence,
+ bom.BOM,
+ bom.BOMInput,
+ bom.BOMOutput,
+ bom.BOMTree,
+ bom.OpenBOMTreeStart,
+ bom.OpenBOMTreeTree,
+ production.Production,
+ production.AssignFailed,
+ product.Template,
+ product.Product,
+ product.ProductBom,
+ product.ProductionLeadTime,
+ stock.Location,
+ stock.Move,
ir.Cron,
module='production', type_='model')
Pool.register(
- Assign,
- OpenBOMTree,
+ production.Assign,
+ bom.OpenBOMTree,
module='production', type_='wizard')
diff -r e0fa1b9e2ce4 -r e5de0a46c056 bom.py
--- a/bom.py Sun Jan 26 15:29:23 2020 +0100
+++ b/bom.py Sun Mar 01 12:33:52 2020 +0100
@@ -7,10 +7,6 @@
from trytond.pool import Pool
-__all__ = ['BOM', 'BOMInput', 'BOMOutput', 'BOMTree', 'OpenBOMTreeStart',
- 'OpenBOMTreeTree', 'OpenBOMTree']
-
-
class BOM(DeactivableMixin, ModelSQL, ModelView):
"Bill of Material"
__name__ = 'production.bom'
diff -r e0fa1b9e2ce4 -r e5de0a46c056 configuration.py
--- a/configuration.py Sun Jan 26 15:29:23 2020 +0100
+++ b/configuration.py Sun Mar 01 12:33:52 2020 +0100
@@ -8,8 +8,6 @@
from trytond.modules.company.model import (
CompanyMultiValueMixin, CompanyValueMixin)
-__all__ = ['Configuration', 'ConfigurationProductionSequence']
-
class Configuration(
ModelSingleton, ModelSQL, ModelView, CompanyMultiValueMixin):
diff -r e0fa1b9e2ce4 -r e5de0a46c056 product.py
--- a/product.py Sun Jan 26 15:29:23 2020 +0100
+++ b/product.py Sun Mar 01 12:33:52 2020 +0100
@@ -7,8 +7,6 @@
from trytond.pyson import Eval, Get, If, Bool
from trytond.pool import PoolMeta
-__all__ = ['Template', 'Product', 'ProductBom', 'ProductionLeadTime']
-
class Template(metaclass=PoolMeta):
__name__ = 'product.template'
@@ -50,8 +48,9 @@
product = self
for product_bom in self.boms:
for input_ in product_bom.bom.inputs:
- if (input_.product == product or
- input_.product.check_bom_recursion(product=product)):
+ if (input_.product == product
+ or input_.product.check_bom_recursion(
+ product=product)):
raise RecursionError(
gettext('production.msg_recursive_bom',
product=product.rec_name))
diff -r e0fa1b9e2ce4 -r e5de0a46c056 setup.py
--- a/setup.py Sun Jan 26 15:29:23 2020 +0100
+++ b/setup.py Sun Mar 01 12:33:52 2020 +0100
@@ -79,8 +79,8 @@
keywords='tryton production',
package_dir={'trytond.modules.production': '.'},
packages=(
- ['trytond.modules.production'] +
- ['trytond.modules.production.%s' % p for p in find_packages()]
+ ['trytond.modules.production']
+ + ['trytond.modules.production.%s' % p for p in find_packages()]
),
package_data={
'trytond.modules.production': (info.get('xml', [])
@@ -95,7 +95,8 @@
'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)',
diff -r e0fa1b9e2ce4 -r e5de0a46c056 stock.py
--- a/stock.py Sun Jan 26 15:29:23 2020 +0100
+++ b/stock.py Sun Mar 01 12:33:52 2020 +0100
@@ -5,9 +5,6 @@
from trytond.pool import PoolMeta
-__all__ = ['Location', 'Move']
-
-
class Location(metaclass=PoolMeta):
__name__ = 'stock.location'
production_location = fields.Many2One('stock.location', 'Production',