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
This commit is contained in:
Cédric Krier committed 2020-03-01 12:33:53 +01:00
1 parent f55cfd7a3f
commit 8ff601e981
7 files changed
+16 -19

No files matched your search

+2
View File
@@ -0,0 +1,2 @@
[flake8]
ignore=E123,E124,E126,E128,W503
+6 -6
View File
@@ -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')
-2
View File
@@ -3,8 +3,6 @@
from trytond.pool import PoolMeta
from trytond.model import fields
__all__ = ['Operation']
class Operation(metaclass=PoolMeta):
__name__ = 'production.routing.operation'
+4 -3
View File
@@ -80,8 +80,8 @@ setup(name=name,
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 @@ setup(name=name,
'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',
+1 -1
View File
@@ -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
+3 -5
View File
@@ -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
-2
View File
@@ -6,8 +6,6 @@ from trytond.pool import PoolMeta, Pool
from trytond.model import fields
from trytond.pyson import Eval
__all__ = ['Work']
class Work(metaclass=PoolMeta):
__name__ = 'production.work'