changeset 3e24c9e70e3b in modules/account_invoice:default
details: 
https://hg.tryton.org/modules/account_invoice?cmd=changeset;node=3e24c9e70e3b
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     |  60 ++++++++++++++++++++++++++++----------------------------
 account.py      |   4 ---
 invoice.py      |   8 ++++--
 party.py        |  10 +++-----
 payment_term.py |   5 +---
 setup.py        |   7 +++--
 7 files changed, 46 insertions(+), 50 deletions(-)

diffs (224 lines):

diff -r cc793d01a064 -r 3e24c9e70e3b .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 cc793d01a064 -r 3e24c9e70e3b __init__.py
--- a/__init__.py       Wed Feb 12 00:19:27 2020 +0100
+++ b/__init__.py       Sun Mar 01 12:33:51 2020 +0100
@@ -2,51 +2,51 @@
 # this repository contains the full copyright notices and license terms.
 
 from trytond.pool import Pool
-from .payment_term import *
-from .invoice import *
+from . import payment_term
+from . import invoice
 from . import party
-from .account import *
+from . import account
 from . import company
 
 
 def register():
     Pool.register(
-        PaymentTerm,
-        PaymentTermLine,
-        PaymentTermLineRelativeDelta,
-        TestPaymentTermView,
-        TestPaymentTermViewResult,
-        Invoice,
-        InvoicePaymentLine,
-        InvoiceLine,
-        InvoiceLineTax,
-        InvoiceTax,
-        PayInvoiceStart,
-        PayInvoiceAsk,
-        CreditInvoiceStart,
+        payment_term.PaymentTerm,
+        payment_term.PaymentTermLine,
+        payment_term.PaymentTermLineRelativeDelta,
+        payment_term.TestPaymentTermView,
+        payment_term.TestPaymentTermViewResult,
+        invoice.Invoice,
+        invoice.InvoicePaymentLine,
+        invoice.InvoiceLine,
+        invoice.InvoiceLineTax,
+        invoice.InvoiceTax,
+        invoice.PayInvoiceStart,
+        invoice.PayInvoiceAsk,
+        invoice.CreditInvoiceStart,
         party.Address,
         party.ContactMechanism,
         party.Party,
         party.PartyPaymentTerm,
-        InvoiceSequence,
+        account.InvoiceSequence,
         # Match pattern migration fallbacks to Fiscalyear values so Period
         # must be registered before Fiscalyear
-        Period,
-        FiscalYear,
-        Move,
-        MoveLine,
-        Reconciliation,
-        PaymentMethod,
+        account.Period,
+        account.FiscalYear,
+        account.Move,
+        account.MoveLine,
+        account.Reconciliation,
+        invoice.PaymentMethod,
         company.Company,
         module='account_invoice', type_='model')
     Pool.register(
-        TestPaymentTerm,
-        PayInvoice,
-        CreditInvoice,
-        party.PartyReplace,
-        party.PartyErase,
-        RenewFiscalYear,
+        payment_term.TestPaymentTerm,
+        invoice.PayInvoice,
+        invoice.CreditInvoice,
+        party.Replace,
+        party.Erase,
+        account.RenewFiscalYear,
         module='account_invoice', type_='wizard')
     Pool.register(
-        InvoiceReport,
+        invoice.InvoiceReport,
         module='account_invoice', type_='report')
diff -r cc793d01a064 -r 3e24c9e70e3b account.py
--- a/account.py        Wed Feb 12 00:19:27 2020 +0100
+++ b/account.py        Sun Mar 01 12:33:51 2020 +0100
@@ -12,10 +12,6 @@
 from trytond.tools import grouped_slice
 from trytond.transaction import Transaction
 
-__all__ = ['FiscalYear',
-    'Period', 'Move', 'MoveLine', 'Reconciliation', 'InvoiceSequence',
-    'RenewFiscalYear']
-
 
 class FiscalYear(metaclass=PoolMeta):
     __name__ = 'account.fiscalyear'
diff -r cc793d01a064 -r 3e24c9e70e3b invoice.py
--- a/invoice.py        Wed Feb 12 00:19:27 2020 +0100
+++ b/invoice.py        Sun Mar 01 12:33:51 2020 +0100
@@ -582,7 +582,8 @@
                     ).join(line, condition=move.id == line.move
                     ).select(invoice.id,
                     Coalesce(Sum(
-                            Case((line.second_currency == invoice.currency,
+                            Case((
+                                    line.second_currency == invoice.currency,
                                     line.amount_second_currency),
                                 else_=line.debit - line.credit)),
                         0).cast(type_name),
@@ -1125,7 +1126,8 @@
         return [
             ('/form//field[@name="comment"]', 'spell', Eval('party_lang')),
             ('/tree', 'visual',
-                If(((Eval('type') == 'out')
+                If((
+                        (Eval('type') == 'out')
                         & (Eval('amount_to_pay_today', 0) > 0))
                     | ((Eval('type') == 'in')
                         & (Eval('amount_to_pay_today', 0) < 0)),
@@ -2563,7 +2565,7 @@
     invoice_account = fields.Many2One(
         'account.account', "Invoice Account", readonly=True)
     payment_method = fields.Many2One(
-        'account.invoice.payment.method', "Payment Method",  required=True,
+        'account.invoice.payment.method', "Payment Method", required=True,
         domain=[
             ('company', '=', Eval('company')),
             ('debit_account', '!=', Eval('invoice_account')),
diff -r cc793d01a064 -r 3e24c9e70e3b party.py
--- a/party.py  Wed Feb 12 00:19:27 2020 +0100
+++ b/party.py  Sun Mar 01 12:33:51 2020 +0100
@@ -8,8 +8,6 @@
 
 from trytond.modules.party.exceptions import EraseError
 
-__all__ = ['Address', 'Party', 'PartyPaymentTerm',
-    'PartyReplace', 'PartyErase']
 customer_payment_term = fields.Many2One(
     'account.invoice.payment_term', "Customer Payment Term")
 supplier_payment_term = fields.Many2One(
@@ -74,24 +72,24 @@
             parent='party', fields=fields)
 
 
-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.invoice', 'party'),
             ('account.invoice.line', 'party'),
             ]
 
 
-class PartyErase(metaclass=PoolMeta):
+class Erase(metaclass=PoolMeta):
     __name__ = 'party.erase'
 
     def check_erase_company(self, party, company):
         pool = Pool()
         Invoice = pool.get('account.invoice')
-        super(PartyErase, self).check_erase_company(party, company)
+        super().check_erase_company(party, company)
 
         invoices = Invoice.search([
                 ('party', '=', party.id),
diff -r cc793d01a064 -r 3e24c9e70e3b payment_term.py
--- a/payment_term.py   Wed Feb 12 00:19:27 2020 +0100
+++ b/payment_term.py   Sun Mar 01 12:33:51 2020 +0100
@@ -17,9 +17,6 @@
 
 from .exceptions import PaymentTermValidationError, PaymentTermComputeError
 
-__all__ = ['PaymentTerm', 'PaymentTermLine', 'PaymentTermLineRelativeDelta',
-    'TestPaymentTerm', 'TestPaymentTermView', 'TestPaymentTermViewResult']
-
 
 class PaymentTerm(DeactivableMixin, ModelSQL, ModelView):
     'Payment Term'
@@ -68,7 +65,7 @@
             value = line.get_value(remainder, amount, currency)
             value_date = line.get_date(date)
             if value is None or not value_date:
-                    continue
+                continue
             if ((remainder - value) * sign) < Decimal('0.0'):
                 res.append((value_date, remainder))
                 break
diff -r cc793d01a064 -r 3e24c9e70e3b setup.py
--- a/setup.py  Wed Feb 12 00:19:27 2020 +0100
+++ b/setup.py  Sun Mar 01 12:33:51 2020 +0100
@@ -79,8 +79,8 @@
     keywords='tryton account invoice',
     package_dir={'trytond.modules.account_invoice': '.'},
     packages=(
-        ['trytond.modules.account_invoice'] +
-        ['trytond.modules.account_invoice.%s' % p for p in find_packages()]
+        ['trytond.modules.account_invoice']
+        + ['trytond.modules.account_invoice.%s' % p for p in find_packages()]
         ),
     package_data={
         'trytond.modules.account_invoice': (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)',

Reply via email to