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 committed 2020-03-01 12:33:54 +01:00
1 parent 51bf414e3b
commit b84bf9598e
9 files changed
+26 -36

No files matched your search

+2
View File
@@ -0,0 +1,2 @@
[flake8]
ignore=E123,E124,E126,E128,W503
+16 -16
View File
@@ -2,27 +2,27 @@
# this repository contains the full copyright notices and license terms.
from trytond.pool import Pool
from .order_point import *
from .product import *
from .purchase_request import *
from .shipment import *
from .location import *
from . import order_point
from . import product
from . import purchase_request
from . import shipment
from . import location
from . import stock
def register():
Pool.register(
OrderPoint,
Product,
ProductSupplier,
PurchaseConfiguration,
PurchaseConfigurationSupplyPeriod,
PurchaseRequest,
ShipmentInternal,
Location,
LocationLeadTime,
stock.StockSupplyStart,
order_point.OrderPoint,
product.Product,
product.ProductSupplier,
purchase_request.PurchaseConfiguration,
purchase_request.PurchaseConfigurationSupplyPeriod,
purchase_request.PurchaseRequest,
shipment.ShipmentInternal,
location.Location,
location.LocationLeadTime,
stock.SupplyStart,
module='stock_supply', type_='model')
Pool.register(
stock.StockSupply,
stock.Supply,
module='stock_supply', type_='wizard')
-3
View File
@@ -7,9 +7,6 @@ from trytond.model import fields
from trytond.pyson import Eval
__all__ = ['Location', 'LocationLeadTime']
class Location(metaclass=PoolMeta):
__name__ = 'stock.location'
+2 -4
View File
@@ -9,8 +9,6 @@ from trytond.transaction import Transaction
from .exceptions import OrderPointValidationError
__all__ = ['OrderPoint']
class OrderPoint(ModelSQL, ModelView):
"""
@@ -53,7 +51,7 @@ class OrderPoint(ModelSQL, ModelView):
states={
'invisible': Not(Equal(Eval('type'), 'internal')),
'required': ((Eval('type') == 'internal')
& (Eval('min_quantity', None) != None)),
& (Eval('min_quantity', None) != None)), # noqa: E711
},
depends=['type', 'min_quantity'])
overflowing_location = fields.Many2One(
@@ -62,7 +60,7 @@ class OrderPoint(ModelSQL, ModelView):
states={
'invisible': Eval('type') != 'internal',
'required': ((Eval('type') == 'internal')
& (Eval('max_quantity', None) != None)),
& (Eval('max_quantity', None) != None)), # noqa: E711
},
depends=['type', 'max_quantity'])
type = fields.Selection(
-2
View File
@@ -5,8 +5,6 @@ import datetime
from trytond.model import fields
from trytond.pool import PoolMeta, Pool
__all__ = ['Product', 'ProductSupplier']
class Product(metaclass=PoolMeta):
__name__ = "product.product"
-2
View File
@@ -9,8 +9,6 @@ from trytond.transaction import Transaction
from trytond.pool import Pool, PoolMeta
from trytond.tools import grouped_slice
__all__ = ['PurchaseRequest', 'PurchaseConfiguration',
'PurchaseConfigurationSupplyPeriod']
supply_period = fields.TimeDelta("Supply Period")
+4 -3
View File
@@ -78,8 +78,8 @@ setup(name=name,
keywords='tryton stock supply',
package_dir={'trytond.modules.stock_supply': '.'},
packages=(
['trytond.modules.stock_supply'] +
['trytond.modules.stock_supply.%s' % p for p in find_packages()]
['trytond.modules.stock_supply']
+ ['trytond.modules.stock_supply.%s' % p for p in find_packages()]
),
package_data={
'trytond.modules.stock_supply': (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)',
-2
View File
@@ -6,8 +6,6 @@ from trytond.model import ModelView, ModelSQL
from trytond.transaction import Transaction
from trytond.pool import Pool
__all__ = ['ShipmentInternal']
class ShipmentInternal(ModelSQL, ModelView):
__name__ = 'stock.shipment.internal'
+2 -4
View File
@@ -8,10 +8,8 @@ from trytond.wizard import (Wizard, StateView, StateAction, StateTransition,
from .exceptions import SupplyWarning
__all__ = ['StockSupply', 'StockSupplyStart']
class StockSupply(Wizard):
class Supply(Wizard):
"Supply Stock"
__name__ = 'stock.supply'
start = StateView(
@@ -109,6 +107,6 @@ class StockSupply(Wizard):
return self.next_action('purchase')
class StockSupplyStart(ModelView):
class SupplyStart(ModelView):
"Supply Stock"
__name__ = 'stock.supply.start'