changeset 9930c2bcc696 in modules/account_tax_rule_country:default
details:
https://hg.tryton.org/modules/account_tax_rule_country?cmd=changeset;node=9930c2bcc696
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 | 5 +++--
purchase.py | 6 ++----
sale.py | 6 ++----
setup.py | 7 ++++---
tests/__init__.py | 2 +-
6 files changed, 14 insertions(+), 14 deletions(-)
diffs (118 lines):
diff -r 20b8671c3614 -r 9930c2bcc696 .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 20b8671c3614 -r 9930c2bcc696 __init__.py
--- a/__init__.py Wed Dec 04 11:09:35 2019 +0100
+++ b/__init__.py Sun Mar 01 12:33:51 2020 +0100
@@ -20,11 +20,12 @@
depends=['account_invoice'])
Pool.register(
sale.Sale,
- sale.SaleLine,
+ sale.Line,
module='account_tax_rule_country', type_='model',
depends=['sale'])
Pool.register(
- purchase.PurchaseLine,
+ purchase.Purchase,
+ purchase.Line,
module='account_tax_rule_country', type_='model',
depends=['purchase'])
Pool.register(
diff -r 20b8671c3614 -r 9930c2bcc696 purchase.py
--- a/purchase.py Wed Dec 04 11:09:35 2019 +0100
+++ b/purchase.py Sun Mar 01 12:33:51 2020 +0100
@@ -5,8 +5,6 @@
from trytond.model import fields
from trytond.pyson import Eval
-__all__ = ['Purchase', 'PurchaseLine']
-
class Purchase(metaclass=PoolMeta):
__name__ = 'purchase.purchase'
@@ -20,13 +18,13 @@
field.depends.extend(['invoice_address'])
-class PurchaseLine(metaclass=PoolMeta):
+class Line(metaclass=PoolMeta):
__name__ = 'purchase.line'
@fields.depends('purchase', '_parent_purchase.warehouse',
'_parent_purchase.invoice_address')
def _get_tax_rule_pattern(self):
- pattern = super(PurchaseLine, self)._get_tax_rule_pattern()
+ pattern = super()._get_tax_rule_pattern()
from_country = from_subdivision = to_country = to_subdivision = None
if self.purchase:
diff -r 20b8671c3614 -r 9930c2bcc696 sale.py
--- a/sale.py Wed Dec 04 11:09:35 2019 +0100
+++ b/sale.py Sun Mar 01 12:33:51 2020 +0100
@@ -5,8 +5,6 @@
from trytond.model import fields
from trytond.pyson import Eval
-__all__ = ['Sale', 'SaleLine']
-
class Sale(metaclass=PoolMeta):
__name__ = 'sale.sale'
@@ -20,7 +18,7 @@
field.depends.extend(['shipment_address'])
-class SaleLine(metaclass=PoolMeta):
+class Line(metaclass=PoolMeta):
__name__ = 'sale.line'
@fields.depends('sale', '_parent_sale.warehouse',
@@ -29,7 +27,7 @@
pool = Pool()
Location = pool.get('stock.location')
- pattern = super(SaleLine, self)._get_tax_rule_pattern()
+ pattern = super()._get_tax_rule_pattern()
from_country = from_subdivision = to_country = to_subdivision = None
if self.id is None or self.id < 0:
diff -r 20b8671c3614 -r 9930c2bcc696 setup.py
--- a/setup.py Wed Dec 04 11:09:35 2019 +0100
+++ b/setup.py Sun Mar 01 12:33:51 2020 +0100
@@ -82,8 +82,8 @@
keywords='tryton account tax rule country',
package_dir={'trytond.modules.account_tax_rule_country': '.'},
packages=(
- ['trytond.modules.account_tax_rule_country'] +
- ['trytond.modules.account_tax_rule_country.%s' % p
+ ['trytond.modules.account_tax_rule_country']
+ + ['trytond.modules.account_tax_rule_country.%s' % p
for p in find_packages()]
),
package_data={
@@ -97,7 +97,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 20b8671c3614 -r 9930c2bcc696 tests/__init__.py
--- a/tests/__init__.py Wed Dec 04 11:09:35 2019 +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_tax_rule_country.tests.test_account_tax_rule_country
import suite
+ from
trytond.modules.account_tax_rule_country.tests.test_account_tax_rule_country
import suite # noqa: E501
except ImportError:
from .test_account_tax_rule_country import suite