changeset 8542a1d21208 in modules/account_payment:default
details:
https://hg.tryton.org/modules/account_payment?cmd=changeset;node=8542a1d21208
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 ++--
account.py | 7 ++-----
party.py | 9 ++++-----
payment.py | 4 +---
setup.py | 7 ++++---
tests/__init__.py | 2 +-
7 files changed, 16 insertions(+), 19 deletions(-)
diffs (138 lines):
diff -r 07504d252670 -r 8542a1d21208 .flake8
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/.flake8 Sun Mar 01 12:33:51 2020 +0100
@@ -0,0 +1,2 @@
+[flake8]
+ignore=E123,E124,E126,E128,W503
diff -r 07504d252670 -r 8542a1d21208 __init__.py
--- a/__init__.py Mon Feb 17 11:18:17 2020 +0100
+++ b/__init__.py Sun Mar 01 12:33:51 2020 +0100
@@ -26,6 +26,6 @@
Pool.register(
payment.ProcessPayment,
account.PayLine,
- party.PartyReplace,
- party.PartyErase,
+ party.Replace,
+ party.Erase,
module='account_payment', type_='wizard')
diff -r 07504d252670 -r 8542a1d21208 account.py
--- a/account.py Mon Feb 17 11:18:17 2020 +0100
+++ b/account.py Sun Mar 01 12:33:51 2020 +0100
@@ -22,10 +22,6 @@
from .exceptions import BlockedWarning, GroupWarning
from .payment import KINDS
-__all__ = ['MoveLine', 'PayLine', 'PayLineAskJournal',
- 'Configuration', 'ConfigurationPaymentGroupSequence',
- 'Invoice']
-
class MoveLine(metaclass=PoolMeta):
__name__ = 'account.move.line'
@@ -64,7 +60,8 @@
super(MoveLine, cls).__setup__()
cls._buttons.update({
'pay': {
- 'invisible':
~Eval('payment_kind').in_(list(dict(KINDS).keys())),
+ 'invisible': ~Eval('payment_kind').in_(
+ list(dict(KINDS).keys())),
'depends': ['payment_kind'],
},
'payment_block': {
diff -r 07504d252670 -r 8542a1d21208 party.py
--- a/party.py Mon Feb 17 11:18:17 2020 +0100
+++ b/party.py Sun Mar 01 12:33:51 2020 +0100
@@ -6,7 +6,6 @@
from trytond.modules.company.model import CompanyValueMixin
from trytond.modules.party.exceptions import EraseError
-__all__ = ['Party', 'PartyPaymentDirectDebit', 'PartyReplace', 'PartyErase']
payment_direct_debit = fields.Boolean(
"Direct Debit", help="Check if supplier does direct debit.")
@@ -31,23 +30,23 @@
payment_direct_debit = payment_direct_debit
-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() + [
('account.payment', 'party'),
]
-class PartyErase(metaclass=PoolMeta):
+class Erase(metaclass=PoolMeta):
__name__ = 'party.erase'
def check_erase_company(self, party, company):
pool = Pool()
Payment = pool.get('account.payment')
- super(PartyErase, self).check_erase_company(party, company)
+ super().check_erase_company(party, company)
payments = Payment.search([
('party', '=', party.id),
diff -r 07504d252670 -r 8542a1d21208 payment.py
--- a/payment.py Mon Feb 17 11:18:17 2020 +0100
+++ b/payment.py Sun Mar 01 12:33:51 2020 +0100
@@ -13,9 +13,6 @@
from .exceptions import OverpayWarning
-__all__ = ['Journal', 'Group', 'Payment',
- 'ProcessPaymentStart', 'ProcessPayment']
-
KINDS = [
('payable', 'Payable'),
('receivable', 'Receivable'),
@@ -106,6 +103,7 @@
default.setdefault('payments', None)
return super(Group, cls).copy(groups, default=default)
+
_STATES = {
'readonly': Eval('state') != 'draft',
}
diff -r 07504d252670 -r 8542a1d21208 setup.py
--- a/setup.py Mon Feb 17 11:18:17 2020 +0100
+++ b/setup.py Sun Mar 01 12:33:51 2020 +0100
@@ -81,8 +81,8 @@
keywords='tryton account payment',
package_dir={'trytond.modules.account_payment': '.'},
packages=(
- ['trytond.modules.account_payment'] +
- ['trytond.modules.account_payment.%s' % p for p in find_packages()]
+ ['trytond.modules.account_payment']
+ + ['trytond.modules.account_payment.%s' % p for p in find_packages()]
),
package_data={
'trytond.modules.account_payment': (info.get('xml', [])
@@ -96,7 +96,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)',
diff -r 07504d252670 -r 8542a1d21208 tests/__init__.py
--- a/tests/__init__.py Mon Feb 17 11:18:17 2020 +0100
+++ b/tests/__init__.py Sun Mar 01 12:33:51 2020 +0100
@@ -2,7 +2,7 @@
# this repository contains the full copyright notices and license terms.
try:
- from trytond.modules.account_payment.tests.test_account_payment import
suite
+ from trytond.modules.account_payment.tests.test_account_payment import
suite # noqa: E501
except ImportError:
from .test_account_payment import suite