changeset 25deb36ea39f in modules/timesheet:default
details: https://hg.tryton.org/modules/timesheet?cmd=changeset;node=25deb36ea39f
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 | 26 +++++++++++++-------------
line.py | 4 ----
setup.py | 7 ++++---
user.py | 2 --
work.py | 4 +---
6 files changed, 20 insertions(+), 25 deletions(-)
diffs (120 lines):
diff -r 881c571567c8 -r 25deb36ea39f .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 881c571567c8 -r 25deb36ea39f __init__.py
--- a/__init__.py Wed Feb 19 22:55:53 2020 +0100
+++ b/__init__.py Sun Mar 01 12:33:54 2020 +0100
@@ -2,9 +2,9 @@
# this repository contains the full copyright notices and license terms.
from trytond.pool import Pool
-from .work import *
-from .line import *
-from .user import *
+from . import work
+from . import line
+from . import user
from . import routes
__all__ = ['register', 'routes']
@@ -12,16 +12,16 @@
def register():
Pool.register(
- Work,
- WorkContext,
- Line,
- EnterLinesStart,
- HoursEmployee,
- HoursEmployeeContext,
- HoursEmployeeWeekly,
- HoursEmployeeMonthly,
- UserApplication,
+ work.Work,
+ work.WorkContext,
+ line.Line,
+ line.EnterLinesStart,
+ line.HoursEmployee,
+ line.HoursEmployeeContext,
+ line.HoursEmployeeWeekly,
+ line.HoursEmployeeMonthly,
+ user.UserApplication,
module='timesheet', type_='model')
Pool.register(
- EnterLines,
+ line.EnterLines,
module='timesheet', type_='wizard')
diff -r 881c571567c8 -r 25deb36ea39f line.py
--- a/line.py Wed Feb 19 22:55:53 2020 +0100
+++ b/line.py Sun Mar 01 12:33:54 2020 +0100
@@ -16,10 +16,6 @@
from .exceptions import DurationValidationError
-__all__ = ['Line', 'EnterLinesStart', 'EnterLines',
- 'HoursEmployee', 'HoursEmployeeContext',
- 'HoursEmployeeWeekly', 'HoursEmployeeMonthly']
-
class Line(ModelSQL, ModelView):
'Timesheet Line'
diff -r 881c571567c8 -r 25deb36ea39f setup.py
--- a/setup.py Wed Feb 19 22:55:53 2020 +0100
+++ b/setup.py Sun Mar 01 12:33:54 2020 +0100
@@ -81,8 +81,8 @@
keywords='tryton timesheet',
package_dir={'trytond.modules.timesheet': '.'},
packages=(
- ['trytond.modules.timesheet'] +
- ['trytond.modules.timesheet.%s' % p for p in find_packages()]
+ ['trytond.modules.timesheet']
+ + ['trytond.modules.timesheet.%s' % p for p in find_packages()]
),
package_data={
'trytond.modules.timesheet': (info.get('xml', [])
@@ -96,7 +96,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 881c571567c8 -r 25deb36ea39f user.py
--- a/user.py Wed Feb 19 22:55:53 2020 +0100
+++ b/user.py Sun Mar 01 12:33:54 2020 +0100
@@ -2,8 +2,6 @@
# this repository contains the full copyright notices and license terms.
from trytond.pool import PoolMeta
-__all__ = ['UserApplication']
-
class UserApplication(metaclass=PoolMeta):
__name__ = 'res.user.application'
diff -r 881c571567c8 -r 25deb36ea39f work.py
--- a/work.py Wed Feb 19 22:55:53 2020 +0100
+++ b/work.py Sun Mar 01 12:33:54 2020 +0100
@@ -16,8 +16,6 @@
from .exceptions import CompanyValidationError
-__all__ = ['Work', 'WorkContext']
-
class Work(DeactivableMixin, ModelSQL, ModelView):
'Work'
@@ -113,7 +111,7 @@
# Migration from 4.0: remove timesheet_available
if table_h.column_exist('timesheet_available'):
cursor.execute(*table.delete(
- where=table.timesheet_available == False))
+ where=table.timesheet_available == Literal(False)))
table_h.drop_column('timesheet_available')
@staticmethod