changeset dd5715d16fbb in modules/production_work_timesheet:default
details: 
https://hg.tryton.org/modules/production_work_timesheet?cmd=changeset;node=dd5715d16fbb
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       |  12 ++++++------
 routing.py        |   2 --
 setup.py          |   7 ++++---
 tests/__init__.py |   2 +-
 timesheet.py      |   8 +++-----
 work.py           |   2 --
 7 files changed, 16 insertions(+), 19 deletions(-)

diffs (117 lines):

diff -r 53342cfd2ce6 -r dd5715d16fbb .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 53342cfd2ce6 -r dd5715d16fbb __init__.py
--- a/__init__.py       Wed Dec 04 11:09:36 2019 +0100
+++ b/__init__.py       Sun Mar 01 12:33:53 2020 +0100
@@ -2,14 +2,14 @@
 # this repository contains the full copyright notices and license terms.
 
 from trytond.pool import Pool
-from .work import *
-from .routing import *
-from .timesheet import *
+from . import work
+from . import routing
+from . import timesheet
 
 
 def register():
     Pool.register(
-        Work,
-        Operation,
-        TimesheetWork,
+        work.Work,
+        routing.Operation,
+        timesheet.Work,
         module='production_work_timesheet', type_='model')
diff -r 53342cfd2ce6 -r dd5715d16fbb routing.py
--- a/routing.py        Wed Dec 04 11:09:36 2019 +0100
+++ b/routing.py        Sun Mar 01 12:33:53 2020 +0100
@@ -3,8 +3,6 @@
 from trytond.pool import PoolMeta
 from trytond.model import fields
 
-__all__ = ['Operation']
-
 
 class Operation(metaclass=PoolMeta):
     __name__ = 'production.routing.operation'
diff -r 53342cfd2ce6 -r dd5715d16fbb setup.py
--- a/setup.py  Wed Dec 04 11:09:36 2019 +0100
+++ b/setup.py  Sun Mar 01 12:33:53 2020 +0100
@@ -80,8 +80,8 @@
     keywords='tryton production work timesheet',
     package_dir={'trytond.modules.production_work_timesheet': '.'},
     packages=(
-        ['trytond.modules.production_work_timesheet'] +
-        ['trytond.modules.production_work_timesheet.%s' % p
+        ['trytond.modules.production_work_timesheet']
+        + ['trytond.modules.production_work_timesheet.%s' % p
             for p in find_packages()]
         ),
     package_data={
@@ -96,7 +96,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 53342cfd2ce6 -r dd5715d16fbb 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.production_work_timesheet.tests.test_production_work_timesheet 
import suite
+    from 
trytond.modules.production_work_timesheet.tests.test_production_work_timesheet 
import suite  # noqa: E501
 except ImportError:
     from .test_production_work_timesheet import suite
 
diff -r 53342cfd2ce6 -r dd5715d16fbb timesheet.py
--- a/timesheet.py      Wed Dec 04 11:09:36 2019 +0100
+++ b/timesheet.py      Sun Mar 01 12:33:53 2020 +0100
@@ -2,20 +2,18 @@
 # this repository contains the full copyright notices and license terms.
 from trytond.pool import PoolMeta, Pool
 
-__all__ = ['TimesheetWork']
 
-
-class TimesheetWork(metaclass=PoolMeta):
+class Work(metaclass=PoolMeta):
     __name__ = 'timesheet.work'
 
     @classmethod
     def _get_origin(cls):
-        return super(TimesheetWork, cls)._get_origin() + ['production.work']
+        return super()._get_origin() + ['production.work']
 
     def _validate_company(self):
         pool = Pool()
         ProductionWork = pool.get('production.work')
-        result = super(TimesheetWork, self)._validate_company()
+        result = super()._validate_company()
         if isinstance(self.origin, ProductionWork):
             result &= self.company == self.origin.company
         return result
diff -r 53342cfd2ce6 -r dd5715d16fbb work.py
--- a/work.py   Wed Dec 04 11:09:36 2019 +0100
+++ b/work.py   Sun Mar 01 12:33:53 2020 +0100
@@ -6,8 +6,6 @@
 from trytond.model import fields
 from trytond.pyson import Eval
 
-__all__ = ['Work']
-
 
 class Work(metaclass=PoolMeta):
     __name__ = 'production.work'

Reply via email to