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 f7016e2882
commit 7b2c1ab3a0
5 files changed
+19 -21

No files matched your search

+2
View File
@@ -0,0 +1,2 @@
[flake8]
ignore=E123,E124,E126,E128,W503
+9 -9
View File
@@ -2,17 +2,17 @@
# this repository contains the full copyright notices and license terms.
from trytond.pool import Pool
from .product import *
from .stock import *
from . import product
from . import stock
def register():
Pool.register(
Template,
Product,
Configuration,
ConfigurationLotShelfLife,
Lot,
Move,
Period,
product.Template,
product.Product,
stock.Configuration,
stock.ConfigurationLotShelfLife,
stock.Lot,
stock.Move,
stock.Period,
module='stock_lot_sled', type_='model')
-2
View File
@@ -6,8 +6,6 @@ from trytond.pyson import Eval
from .stock import DATE_STATE
__all__ = ['Template', 'Product']
class Template(metaclass=PoolMeta):
__name__ = 'product.template'
+4 -3
View File
@@ -78,8 +78,8 @@ setup(name=name,
keywords='tryton stock lot',
package_dir={'trytond.modules.stock_lot_sled': '.'},
packages=(
['trytond.modules.stock_lot_sled'] +
['trytond.modules.stock_lot_sled.%s' % p for p in find_packages()]
['trytond.modules.stock_lot_sled']
+ ['trytond.modules.stock_lot_sled.%s' % p for p in find_packages()]
),
package_data={
'trytond.modules.stock_lot_sled': (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)',
+4 -7
View File
@@ -16,9 +16,6 @@ from trytond.tools import grouped_slice
from trytond.modules.stock.exceptions import PeriodCloseError
from .exceptions import LotExpiredError, LotExpiredWarning
__all__ = ['Configuration', 'ConfigurationLotShelfLife',
'Lot', 'Move', 'Period']
DATE_STATE = [
('none', 'None'),
('optional', 'Optional'),
@@ -327,10 +324,10 @@ class Move(metaclass=PoolMeta):
if add_join(sub_query.from_, lot):
# only lot expiring during the period
clause = (
(lot.shelf_life_expiration_date >=
stock_date_start)
& (lot.shelf_life_expiration_date <
stock_date_end))
(lot.shelf_life_expiration_date
>= stock_date_start)
& (lot.shelf_life_expiration_date
< stock_date_end))
if sub_query.where:
sub_query.where &= clause
else: