changeset e849161453a9 in modules/timesheet_cost:default
details: 
https://hg.tryton.org/modules/timesheet_cost?cmd=changeset;node=e849161453a9
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  |  10 +++++-----
 company.py   |   2 +-
 setup.py     |   7 ++++---
 timesheet.py |  10 ++++------
 5 files changed, 16 insertions(+), 15 deletions(-)

diffs (104 lines):

diff -r 655b943cae8f -r e849161453a9 .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 655b943cae8f -r e849161453a9 __init__.py
--- a/__init__.py       Thu Dec 05 22:37:16 2019 +0100
+++ b/__init__.py       Sun Mar 01 12:33:54 2020 +0100
@@ -2,13 +2,13 @@
 # this repository contains the full copyright notices and license terms.
 
 from trytond.pool import Pool
-from .company import *
-from .timesheet import *
+from . import company
+from . import timesheet
 
 
 def register():
     Pool.register(
-        Employee,
-        EmployeeCostPrice,
-        TimesheetLine,
+        company.Employee,
+        company.EmployeeCostPrice,
+        timesheet.Line,
         module='timesheet_cost', type_='model')
diff -r 655b943cae8f -r e849161453a9 company.py
--- a/company.py        Thu Dec 05 22:37:16 2019 +0100
+++ b/company.py        Sun Mar 01 12:33:54 2020 +0100
@@ -7,7 +7,7 @@
 from trytond.pool import Pool, PoolMeta
 from trytond.config import config
 
-__all__ = ['Employee', 'EmployeeCostPrice', 'price_digits']
+__all__ = ['price_digits']
 
 price_digits = (16, config.getint(
         'timesheet_cost', 'price_decimal', default=4))
diff -r 655b943cae8f -r e849161453a9 setup.py
--- a/setup.py  Thu Dec 05 22:37:16 2019 +0100
+++ b/setup.py  Sun Mar 01 12:33:54 2020 +0100
@@ -78,8 +78,8 @@
     keywords='tryton timesheet cost',
     package_dir={'trytond.modules.timesheet_cost': '.'},
     packages=(
-        ['trytond.modules.timesheet_cost'] +
-        ['trytond.modules.timesheet_cost.%s' % p for p in find_packages()]
+        ['trytond.modules.timesheet_cost']
+        + ['trytond.modules.timesheet_cost.%s' % p for p in find_packages()]
         ),
     package_data={
         'trytond.modules.timesheet_cost': (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 655b943cae8f -r e849161453a9 timesheet.py
--- a/timesheet.py      Thu Dec 05 22:37:16 2019 +0100
+++ b/timesheet.py      Sun Mar 01 12:33:54 2020 +0100
@@ -8,10 +8,8 @@
 
 from .company import price_digits
 
-__all__ = ['TimesheetLine']
 
-
-class TimesheetLine(metaclass=PoolMeta):
+class Line(metaclass=PoolMeta):
     __name__ = 'timesheet.line'
 
     cost_price = fields.Numeric('Cost Price',
@@ -28,7 +26,7 @@
 
         migrate_cost_price = not table_h.column_exist('cost_price')
 
-        super(TimesheetLine, cls).__register__(module_name)
+        super().__register__(module_name)
 
         # Migration from 3.6: add cost_price
         if migrate_cost_price:
@@ -55,13 +53,13 @@
         vlist = [v.copy() for v in vlist]
         for values in vlist:
             values.pop('cost_price', None)
-        lines = super(TimesheetLine, cls).create(vlist)
+        lines = super().create(vlist)
         cls.sync_cost(lines)
         return lines
 
     @classmethod
     def write(cls, *args):
-        super(TimesheetLine, cls).write(*args)
+        super().write(*args)
         cls.sync_cost(sum(args[0:None:2], []))
 
     @classmethod

Reply via email to