changeset 25ea90b0a229 in modules/sale_shipment_tolerance:default
details: 
https://hg.tryton.org/modules/sale_shipment_tolerance?cmd=changeset;node=25ea90b0a229
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       |  2 +-
 configuration.py  |  2 --
 sale.py           |  8 +++-----
 setup.py          |  7 ++++---
 stock.py          |  2 --
 tests/__init__.py |  2 +-
 7 files changed, 11 insertions(+), 14 deletions(-)

diffs (110 lines):

diff -r 7dd45d993df4 -r 25ea90b0a229 .flake8
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/.flake8   Sun Mar 01 12:33:53 2020 +0100
@@ -0,0 +1,2 @@
+[flake8]
+ignore=E123,E124,E126,E128,W503
diff -r 7dd45d993df4 -r 25ea90b0a229 __init__.py
--- a/__init__.py       Wed Dec 04 11:09:36 2019 +0100
+++ b/__init__.py       Sun Mar 01 12:33:53 2020 +0100
@@ -13,6 +13,6 @@
     Pool.register(
         configuration.Configuration,
         configuration.ConfigurationShipmentTolerance,
-        sale.SaleLine,
+        sale.Line,
         stock.Move,
         module='sale_shipment_tolerance', type_='model')
diff -r 7dd45d993df4 -r 25ea90b0a229 configuration.py
--- a/configuration.py  Wed Dec 04 11:09:36 2019 +0100
+++ b/configuration.py  Sun Mar 01 12:33:53 2020 +0100
@@ -4,8 +4,6 @@
 from trytond.pool import PoolMeta, Pool
 
 
-__all__ = ['Configuration', 'ConfigurationShipmentTolerance']
-
 sale_under_shipment_tolerance = fields.Float(
     "Sale Under Shipment Tolerance",
     help="The lower quantity accepted in percentage.")
diff -r 7dd45d993df4 -r 25ea90b0a229 sale.py
--- a/sale.py   Wed Dec 04 11:09:36 2019 +0100
+++ b/sale.py   Sun Mar 01 12:33:53 2020 +0100
@@ -5,10 +5,8 @@
 
 from .exceptions import OverShipmentWarning
 
-__all__ = ['SaleLine']
 
-
-class SaleLine(metaclass=PoolMeta):
+class Line(metaclass=PoolMeta):
     __name__ = 'sale.line'
 
     def _test_under_shipment_tolerance(self, quantity):
@@ -25,7 +23,7 @@
 
     @property
     def _move_remaining_quantity(self):
-        quantity = super(SaleLine, self)._move_remaining_quantity
+        quantity = super()._move_remaining_quantity
         if self._test_under_shipment_tolerance(quantity):
             return 0
         return quantity
@@ -33,7 +31,7 @@
     def get_move(self, shipment_type):
         pool = Pool()
         Uom = pool.get('product.uom')
-        move = super(SaleLine, self).get_move(shipment_type)
+        move = super().get_move(shipment_type)
         # Compute tolerance only if there is already at least one move.
         if move and set(self.moves) - set(self.moves_recreated):
             quantity = Uom.compute_qty(
diff -r 7dd45d993df4 -r 25ea90b0a229 setup.py
--- a/setup.py  Wed Dec 04 11:09:36 2019 +0100
+++ b/setup.py  Sun Mar 01 12:33:53 2020 +0100
@@ -79,8 +79,8 @@
     keywords='tryton sale shipment tolerance back-order',
     package_dir={'trytond.modules.sale_shipment_tolerance': '.'},
     packages=(
-        ['trytond.modules.sale_shipment_tolerance'] +
-        ['trytond.modules.sale_shipment_tolerance.%s' % p
+        ['trytond.modules.sale_shipment_tolerance']
+        + ['trytond.modules.sale_shipment_tolerance.%s' % p
             for p in find_packages()]
         ),
     package_data={
@@ -95,7 +95,8 @@
         'Intended Audience :: Developers',
         'Intended Audience :: Financial and Insurance Industry',
         'Intended Audience :: Legal Industry',
-        '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 :: Czech',
diff -r 7dd45d993df4 -r 25ea90b0a229 stock.py
--- a/stock.py  Wed Dec 04 11:09:36 2019 +0100
+++ b/stock.py  Sun Mar 01 12:33:53 2020 +0100
@@ -3,8 +3,6 @@
 from trytond.model import ModelView, Workflow
 from trytond.pool import PoolMeta, Pool
 
-__all__ = ['Move']
-
 
 class Move(metaclass=PoolMeta):
     __name__ = 'stock.move'
diff -r 7dd45d993df4 -r 25ea90b0a229 tests/__init__.py
--- a/tests/__init__.py Wed Dec 04 11:09:36 2019 +0100
+++ b/tests/__init__.py Sun Mar 01 12:33:53 2020 +0100
@@ -2,7 +2,7 @@
 # this repository contains the full copyright notices and license terms.
 
 try:
-    from 
trytond.modules.sale_shipment_tolerance.tests.test_sale_shipment_tolerance 
import suite
+    from 
trytond.modules.sale_shipment_tolerance.tests.test_sale_shipment_tolerance 
import suite  # noqa: E501
 except ImportError:
     from .test_sale_shipment_tolerance import suite
 

Reply via email to