changeset 7e2845185199 in modules/stock_lot_sled:default
details:
https://hg.tryton.org/modules/stock_lot_sled?cmd=changeset;node=7e2845185199
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 | 18 +++++++++---------
product.py | 2 --
setup.py | 7 ++++---
stock.py | 11 ++++-------
5 files changed, 19 insertions(+), 21 deletions(-)
diffs (100 lines):
diff -r 0359eef169a0 -r 7e2845185199 .flake8
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/.flake8 Sun Mar 01 12:33:54 2020 +0100
@@ -0,0 +1,2 @@
+[flake8]
+ignore=E123,E124,E126,E128,W503
diff -r 0359eef169a0 -r 7e2845185199 __init__.py
--- a/__init__.py Wed Dec 04 11:09:37 2019 +0100
+++ b/__init__.py Sun Mar 01 12:33:54 2020 +0100
@@ -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')
diff -r 0359eef169a0 -r 7e2845185199 product.py
--- a/product.py Wed Dec 04 11:09:37 2019 +0100
+++ b/product.py Sun Mar 01 12:33:54 2020 +0100
@@ -6,8 +6,6 @@
from .stock import DATE_STATE
-__all__ = ['Template', 'Product']
-
class Template(metaclass=PoolMeta):
__name__ = 'product.template'
diff -r 0359eef169a0 -r 7e2845185199 setup.py
--- a/setup.py Wed Dec 04 11:09:37 2019 +0100
+++ b/setup.py Sun Mar 01 12:33:54 2020 +0100
@@ -78,8 +78,8 @@
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 @@
'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 0359eef169a0 -r 7e2845185199 stock.py
--- a/stock.py Wed Dec 04 11:09:37 2019 +0100
+++ b/stock.py Sun Mar 01 12:33:54 2020 +0100
@@ -16,9 +16,6 @@
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 @@
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: