changeset ed796b86d3db in modules/project_invoice:default
details: 
https://hg.tryton.org/modules/project_invoice?cmd=changeset;node=ed796b86d3db
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       |  16 ++++++++--------
 invoice.py        |   2 --
 setup.py          |   7 ++++---
 tests/__init__.py |   2 +-
 timesheet.py      |  11 ++++-------
 work.py           |   3 ---
 7 files changed, 19 insertions(+), 24 deletions(-)

diffs (135 lines):

diff -r 26f24e3def35 -r ed796b86d3db .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 26f24e3def35 -r ed796b86d3db __init__.py
--- a/__init__.py       Tue Jan 28 11:45:54 2020 +0100
+++ b/__init__.py       Sun Mar 01 12:33:53 2020 +0100
@@ -2,18 +2,18 @@
 # this repository contains the full copyright notices and license terms.
 
 from trytond.pool import Pool
-from .work import *
-from .timesheet import *
-from .invoice import *
+from . import work
+from . import timesheet
+from . import invoice
 
 
 def register():
     Pool.register(
-        Work,
-        WorkInvoicedProgress,
-        TimesheetLine,
-        InvoiceLine,
+        work.Work,
+        work.WorkInvoicedProgress,
+        timesheet.Line,
+        invoice.InvoiceLine,
         module='project_invoice', type_='model')
     Pool.register(
-        OpenInvoice,
+        work.OpenInvoice,
         module='project_invoice', type_='wizard')
diff -r 26f24e3def35 -r ed796b86d3db invoice.py
--- a/invoice.py        Tue Jan 28 11:45:54 2020 +0100
+++ b/invoice.py        Sun Mar 01 12:33:53 2020 +0100
@@ -4,8 +4,6 @@
 from trytond.transaction import Transaction
 from trytond.tools import grouped_slice
 
-__all__ = ['InvoiceLine']
-
 
 class InvoiceLine(metaclass=PoolMeta):
     __name__ = 'account.invoice.line'
diff -r 26f24e3def35 -r ed796b86d3db setup.py
--- a/setup.py  Tue Jan 28 11:45:54 2020 +0100
+++ b/setup.py  Sun Mar 01 12:33:53 2020 +0100
@@ -79,8 +79,8 @@
     keywords='tryton project invoice',
     package_dir={'trytond.modules.project_invoice': '.'},
     packages=(
-        ['trytond.modules.project_invoice'] +
-        ['trytond.modules.project_invoice.%s' % p for p in find_packages()]
+        ['trytond.modules.project_invoice']
+        + ['trytond.modules.project_invoice.%s' % p for p in find_packages()]
         ),
     package_data={
         'trytond.modules.project_invoice': (info.get('xml', [])
@@ -94,7 +94,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 26f24e3def35 -r ed796b86d3db tests/__init__.py
--- a/tests/__init__.py Tue Jan 28 11:45:54 2020 +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.project_invoice.tests.test_project_invoice import 
suite
+    from trytond.modules.project_invoice.tests.test_project_invoice import 
suite  # noqa: E501
 except ImportError:
     from .test_project_invoice import suite
 
diff -r 26f24e3def35 -r ed796b86d3db timesheet.py
--- a/timesheet.py      Tue Jan 28 11:45:54 2020 +0100
+++ b/timesheet.py      Sun Mar 01 12:33:53 2020 +0100
@@ -6,10 +6,7 @@
 from trytond.pool import PoolMeta
 
 
-__all__ = ['TimesheetLine']
-
-
-class TimesheetLine(metaclass=PoolMeta):
+class Line(metaclass=PoolMeta):
     __name__ = 'timesheet.line'
     invoice_line = fields.Many2One('account.invoice.line', 'Invoice Line',
         readonly=True)
@@ -21,7 +18,7 @@
         else:
             default = default.copy()
         default.setdefault('invoice_line', None)
-        return super(TimesheetLine, cls).copy(records, default=default)
+        return super().copy(records, default=default)
 
     @classmethod
     def write(cls, *args):
@@ -31,11 +28,11 @@
                     and any(l.invoice_line for l in lines)):
                 raise AccessError(
                     gettext('project_invoice.msg_modify_invoiced_line'))
-        super(TimesheetLine, cls).write(*args)
+        super().write(*args)
 
     @classmethod
     def delete(cls, records):
         if any(r.invoice_line for r in records):
             raise AccessError(
                 gettext('project_invoice.msg_delete_invoiced_line'))
-        super(TimesheetLine, cls).delete(records)
+        super().delete(records)
diff -r 26f24e3def35 -r ed796b86d3db work.py
--- a/work.py   Tue Jan 28 11:45:54 2020 +0100
+++ b/work.py   Sun Mar 01 12:33:53 2020 +0100
@@ -22,9 +22,6 @@
 
 from .exceptions import InvoicingError
 
-
-__all__ = ['Work', 'WorkInvoicedProgress', 'OpenInvoice']
-
 INVOICE_METHODS = [
     ('manual', 'Manual'),
     ('effort', 'On Effort'),

Reply via email to