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 91dadaad8a
commit 3cb5ce01c6
8 files changed
+12 -18

No files matched your search

+2
View File
@@ -0,0 +1,2 @@
[flake8]
ignore=E123,E124,E126,E128,W503
+2 -2
View File
@@ -29,8 +29,8 @@ def register():
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')
-2
View File
@@ -4,8 +4,6 @@ from trytond.model import fields
from trytond.pool import PoolMeta, Pool
from trytond.pyson import Eval
__all__ = ['Configuration', 'ConfigurationSequence']
class Configuration(metaclass=PoolMeta):
__name__ = 'sale.configuration'
-2
View File
@@ -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'
+4 -6
View File
@@ -5,26 +5,24 @@ from trytond.pool import PoolMeta, Pool
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),
-1
View File
@@ -11,7 +11,6 @@ from trytond.transaction import Transaction
from .exceptions import RecurrenceRuleValidationError
__all__ = ['RecurrenceRuleSet', 'RecurrenceRule']
WEEKDAYS = {
'MO': MO,
'TU': TU,
-2
View File
@@ -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"
+4 -3
View File
@@ -79,8 +79,8 @@ setup(name=name,
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 @@ 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 :: Chinese (Simplified)',