changeset fec4c48828bc in modules/sale_subscription:default
details:
https://hg.tryton.org/modules/sale_subscription?cmd=changeset;node=fec4c48828bc
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 ++--
configuration.py | 2 --
invoice.py | 2 --
party.py | 10 ++++------
recurrence.py | 1 -
service.py | 2 --
setup.py | 7 ++++---
8 files changed, 12 insertions(+), 18 deletions(-)
diffs (125 lines):
diff -r d5fcacac5a2f -r fec4c48828bc .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 d5fcacac5a2f -r fec4c48828bc __init__.py
--- a/__init__.py Sat Jan 25 20:18:49 2020 +0100
+++ b/__init__.py Sun Mar 01 12:33:53 2020 +0100
@@ -29,8 +29,8 @@
Pool.register(
subscription.CreateLineConsumption,
subscription.CreateSubscriptionInvoice,
- party.PartyReplace,
- party.PartyErase,
+ party.Replace,
+ party.Erase,
module='sale_subscription', type_='wizard')
Pool.register(
module='sale_subscription', type_='report')
diff -r d5fcacac5a2f -r fec4c48828bc configuration.py
--- a/configuration.py Sat Jan 25 20:18:49 2020 +0100
+++ b/configuration.py Sun Mar 01 12:33:53 2020 +0100
@@ -4,8 +4,6 @@
from trytond.pool import PoolMeta, Pool
from trytond.pyson import Eval
-__all__ = ['Configuration', 'ConfigurationSequence']
-
class Configuration(metaclass=PoolMeta):
__name__ = 'sale.configuration'
diff -r d5fcacac5a2f -r fec4c48828bc invoice.py
--- a/invoice.py Sat Jan 25 20:18:49 2020 +0100
+++ b/invoice.py Sun Mar 01 12:33:53 2020 +0100
@@ -2,8 +2,6 @@
# this repository contains the full copyright notices and license terms.
from trytond.pool import Pool, PoolMeta
-__all__ = ['InvoiceLine']
-
class InvoiceLine(metaclass=PoolMeta):
__name__ = 'account.invoice.line'
diff -r d5fcacac5a2f -r fec4c48828bc party.py
--- a/party.py Sat Jan 25 20:18:49 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() + [
('sale.subscription', 'party'),
]
-class PartyErase(metaclass=PoolMeta):
+class Erase(metaclass=PoolMeta):
__name__ = 'party.erase'
def check_erase_company(self, party, company):
pool = Pool()
Subscription = pool.get('sale.subscription')
- super(PartyErase, self).check_erase_company(party, company)
+ super().check_erase_company(party, company)
subscriptions = Subscription.search([
('party', '=', party.id),
diff -r d5fcacac5a2f -r fec4c48828bc recurrence.py
--- a/recurrence.py Sat Jan 25 20:18:49 2020 +0100
+++ b/recurrence.py Sun Mar 01 12:33:53 2020 +0100
@@ -11,7 +11,6 @@
from .exceptions import RecurrenceRuleValidationError
-__all__ = ['RecurrenceRuleSet', 'RecurrenceRule']
WEEKDAYS = {
'MO': MO,
'TU': TU,
diff -r d5fcacac5a2f -r fec4c48828bc service.py
--- a/service.py Sat Jan 25 20:18:49 2020 +0100
+++ b/service.py Sun Mar 01 12:33:53 2020 +0100
@@ -3,8 +3,6 @@
from trytond.model import ModelSQL, ModelView, DeactivableMixin, fields
from trytond.pyson import Eval
-__all__ = ['Service']
-
class Service(DeactivableMixin, ModelSQL, ModelView):
"Subscription Service"
diff -r d5fcacac5a2f -r fec4c48828bc setup.py
--- a/setup.py Sat Jan 25 20:18:49 2020 +0100
+++ b/setup.py Sun Mar 01 12:33:53 2020 +0100
@@ -79,8 +79,8 @@
keywords='tryton sale subscription',
package_dir={'trytond.modules.sale_subscription': '.'},
packages=(
- ['trytond.modules.sale_subscription'] +
- ['trytond.modules.sale_subscription.%s' % p for p in find_packages()]
+ ['trytond.modules.sale_subscription']
+ + ['trytond.modules.sale_subscription.%s' % p for p in find_packages()]
),
package_data={
'trytond.modules.sale_subscription': (info.get('xml', [])
@@ -94,7 +94,8 @@
'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 :: Chinese (Simplified)',