changeset 34941a6b57cb in modules/carrier:default
details: https://hg.tryton.org/modules/carrier?cmd=changeset;node=34941a6b57cb
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 +++++-----
carrier.py | 10 ++++------
party.py | 6 ++----
setup.py | 7 ++++---
5 files changed, 17 insertions(+), 18 deletions(-)
diffs (117 lines):
diff -r cf8abdd8a2a5 -r 34941a6b57cb .flake8
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/.flake8 Sun Mar 01 12:33:52 2020 +0100
@@ -0,0 +1,2 @@
+[flake8]
+ignore=E123,E124,E126,E128,W503
diff -r cf8abdd8a2a5 -r 34941a6b57cb __init__.py
--- a/__init__.py Sat Dec 28 18:16:28 2019 +0100
+++ b/__init__.py Sun Mar 01 12:33:52 2020 +0100
@@ -2,15 +2,15 @@
# this repository contains the full copyright notices and license terms.
from trytond.pool import Pool
-from .carrier import *
-from .party import PartyReplace
+from . import carrier
+from . import party
def register():
Pool.register(
- Carrier,
- CarrierSelection,
+ carrier.Carrier,
+ carrier.Selection,
module='carrier', type_='model')
Pool.register(
- PartyReplace,
+ party.Replace,
module='carrier', type_='wizard')
diff -r cf8abdd8a2a5 -r 34941a6b57cb carrier.py
--- a/carrier.py Sat Dec 28 18:16:28 2019 +0100
+++ b/carrier.py Sun Mar 01 12:33:52 2020 +0100
@@ -7,8 +7,6 @@
from trytond.pool import Pool
from trytond.cache import Cache
-__all__ = ['Carrier', 'CarrierSelection']
-
class Carrier(ModelSQL, ModelView):
'Carrier'
@@ -76,7 +74,7 @@
CarrierSelection._get_carriers_cache.clear()
-class CarrierSelection(
+class Selection(
DeactivableMixin, sequence_ordered(), MatchMixin, ModelSQL, ModelView):
'Carrier Selection'
__name__ = 'carrier.selection'
@@ -95,18 +93,18 @@
@classmethod
def create(cls, *args, **kwargs):
- selections = super(CarrierSelection, cls).create(*args, **kwargs)
+ selections = super().create(*args, **kwargs)
cls._get_carriers_cache.clear()
return selections
@classmethod
def write(cls, *args, **kwargs):
- super(CarrierSelection, cls).write(*args, **kwargs)
+ super().write(*args, **kwargs)
cls._get_carriers_cache.clear()
@classmethod
def delete(cls, *args, **kwargs):
- super(CarrierSelection, cls).delete(*args, **kwargs)
+ super().delete(*args, **kwargs)
cls._get_carriers_cache.clear()
@classmethod
diff -r cf8abdd8a2a5 -r 34941a6b57cb party.py
--- a/party.py Sat Dec 28 18:16:28 2019 +0100
+++ b/party.py Sun Mar 01 12:33:52 2020 +0100
@@ -2,14 +2,12 @@
# this repository contains the full copyright notices and license terms.
from trytond.pool import PoolMeta
-__all__ = ['PartyReplace']
-
-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() + [
('carrier', 'party'),
]
diff -r cf8abdd8a2a5 -r 34941a6b57cb setup.py
--- a/setup.py Sat Dec 28 18:16:28 2019 +0100
+++ b/setup.py Sun Mar 01 12:33:52 2020 +0100
@@ -78,8 +78,8 @@
keywords='tryton carrier',
package_dir={'trytond.modules.carrier': '.'},
packages=(
- ['trytond.modules.carrier'] +
- ['trytond.modules.carrier.%s' % p for p in find_packages()]
+ ['trytond.modules.carrier']
+ + ['trytond.modules.carrier.%s' % p for p in find_packages()]
),
package_data={
'trytond.modules.carrier': (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)',