changeset e77dab6ee1e1 in modules/project:default
details: https://hg.tryton.org/modules/project?cmd=changeset;node=e77dab6ee1e1
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 |   4 ++--
 party.py    |  10 ++++------
 setup.py    |   7 ++++---
 work.py     |   7 ++++---
 5 files changed, 16 insertions(+), 14 deletions(-)

diffs (100 lines):

diff -r d1e349389ead -r e77dab6ee1e1 .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 d1e349389ead -r e77dab6ee1e1 __init__.py
--- a/__init__.py       Tue Jan 28 19:10:46 2020 +0100
+++ b/__init__.py       Sun Mar 01 12:33:53 2020 +0100
@@ -18,6 +18,6 @@
         ir.ActWindow,
         module='project', type_='model')
     Pool.register(
-        party.PartyReplace,
-        party.PartyErase,
+        party.Replace,
+        party.Erase,
         module='project', type_='wizard')
diff -r d1e349389ead -r e77dab6ee1e1 party.py
--- a/party.py  Tue Jan 28 19:10:46 2020 +0100
+++ b/party.py  Sun Mar 01 12:33:53 2020 +0100
@@ -5,26 +5,24 @@
 
 from trytond.modules.party.exceptions import EraseError
 
-__all__ = ['PartyReplace', 'PartyErase']
 
-
-class PartyReplace(metaclass=PoolMeta):
+class Replace(metaclass=PoolMeta):
     __name__ = 'party.replace'
 
     @classmethod
     def fields_to_replace(cls):
-        return super(PartyReplace, cls).fields_to_replace() + [
+        return super().fields_to_replace() + [
             ('project.work', 'party'),
             ]
 
 
-class PartyErase(metaclass=PoolMeta):
+class Erase(metaclass=PoolMeta):
     __name__ = 'party.erase'
 
     def check_erase_company(self, party, company):
         pool = Pool()
         Work = pool.get('project.work')
-        super(PartyErase, self).check_erase_company(party, company)
+        super().check_erase_company(party, company)
 
         works = Work.search([
                 ('party', '=', party.id),
diff -r d1e349389ead -r e77dab6ee1e1 setup.py
--- a/setup.py  Tue Jan 28 19:10:46 2020 +0100
+++ b/setup.py  Sun Mar 01 12:33:53 2020 +0100
@@ -79,8 +79,8 @@
     keywords='tryton project',
     package_dir={'trytond.modules.project': '.'},
     packages=(
-        ['trytond.modules.project'] +
-        ['trytond.modules.project.%s' % p for p in find_packages()]
+        ['trytond.modules.project']
+        + ['trytond.modules.project.%s' % p for p in find_packages()]
         ),
     package_data={
         'trytond.modules.project': (info.get('xml', [])
@@ -95,7 +95,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 d1e349389ead -r e77dab6ee1e1 work.py
--- a/work.py   Tue Jan 28 19:10:46 2020 +0100
+++ b/work.py   Sun Mar 01 12:33:53 2020 +0100
@@ -176,7 +176,8 @@
             digits=(16, 4),
             help='Estimated total progress for this work and the sub-works.',
             states={
-                'invisible': Eval('total_progress', None) == None,
+                'invisible': (
+                    Eval('total_progress', None) == None),  # noqa: E711
                 }),
         'get_total')
     comment = fields.Text('Comment')
@@ -473,8 +474,8 @@
             total_effort = result['total_effort']
             for work in works:
                 if total_effort[work.id]:
-                    total_progress[work.id] = round(total_progress[work.id] /
-                        (total_effort[work.id].total_seconds() / 60 / 60),
+                    total_progress[work.id] = round(total_progress[work.id]
+                        / (total_effort[work.id].total_seconds() / 60 / 60),
                         digits)
                 else:
                     total_effort[work.id] = None

Reply via email to