changeset d06e80d24767 in modules/account_asset:default
details: 
https://hg.tryton.org/modules/account_asset?cmd=changeset;node=d06e80d24767
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 |   2 +-
 asset.py    |  13 ++++---------
 invoice.py  |   2 --
 product.py  |   2 --
 purchase.py |   6 ++----
 setup.py    |   7 ++++---
 7 files changed, 13 insertions(+), 21 deletions(-)

diffs (123 lines):

diff -r c8ca9b7062b9 -r d06e80d24767 .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 c8ca9b7062b9 -r d06e80d24767 __init__.py
--- a/__init__.py       Wed Jan 29 22:24:40 2020 +0100
+++ b/__init__.py       Sun Mar 01 12:33:51 2020 +0100
@@ -33,7 +33,7 @@
         account.Journal,
         module='account_asset', type_='model')
     Pool.register(
-        purchase.PurchaseLine,
+        purchase.Line,
         module='account_asset', type_='model', depends=['purchase'])
     Pool.register(
         asset.CreateMoves,
diff -r c8ca9b7062b9 -r d06e80d24767 asset.py
--- a/asset.py  Wed Jan 29 22:24:40 2020 +0100
+++ b/asset.py  Sun Mar 01 12:33:51 2020 +0100
@@ -19,12 +19,6 @@
 from trytond.tools import grouped_slice
 from trytond.modules.company import CompanyReport
 
-__all__ = ['Asset', 'AssetLine', 'AssetUpdateMove',
-    'CreateMovesStart', 'CreateMoves',
-    'UpdateAssetStart', 'UpdateAssetShowDepreciation', 'UpdateAsset',
-    'AssetDepreciationTable',
-    'PrintDepreciationTableStart', 'PrintDepreciationTable']
-
 
 def date2datetime(date):
     return datetime.datetime.combine(date, datetime.time())
@@ -67,7 +61,7 @@
     supplier_invoice_line = fields.Many2One('account.invoice.line',
         'Supplier Invoice Line',
         domain=[
-            If(Eval('product', None) == None,
+            If(~Eval('product', None),
                 ('product', '=', -1),
                 ('product', '=', Eval('product', -1)),
                 ),
@@ -991,8 +985,9 @@
 
             @cached_property
             def update_lines(self):
-                filter_ = lambda l: (l.account.type.expense
-                    and self.start_date < l.move.date <= self.end_date)
+                def filter_(l):
+                    return (l.account.type.expense
+                        and self.start_date < l.move.date <= self.end_date)
                 return list(filter(filter_,
                     (l for m in self.asset.update_moves for l in m.lines)))
 
diff -r c8ca9b7062b9 -r d06e80d24767 invoice.py
--- a/invoice.py        Wed Jan 29 22:24:40 2020 +0100
+++ b/invoice.py        Sun Mar 01 12:33:51 2020 +0100
@@ -5,8 +5,6 @@
 from trytond.pool import Pool, PoolMeta
 from trytond.transaction import Transaction
 
-__all__ = ['InvoiceLine']
-
 
 class InvoiceLine(metaclass=PoolMeta):
     __name__ = 'account.invoice.line'
diff -r c8ca9b7062b9 -r d06e80d24767 product.py
--- a/product.py        Wed Jan 29 22:24:40 2020 +0100
+++ b/product.py        Sun Mar 01 12:33:51 2020 +0100
@@ -7,8 +7,6 @@
 from trytond.modules.account_product.product import (
     account_used, template_property)
 
-__all__ = ['Category', 'CategoryAccount', 'Template', 'Product']
-
 
 class Category(metaclass=PoolMeta):
     __name__ = 'product.category'
diff -r c8ca9b7062b9 -r d06e80d24767 purchase.py
--- a/purchase.py       Wed Jan 29 22:24:40 2020 +0100
+++ b/purchase.py       Sun Mar 01 12:33:51 2020 +0100
@@ -5,14 +5,12 @@
 
 from trytond.modules.account_product.exceptions import AccountError
 
-__all__ = ['PurchaseLine']
 
-
-class PurchaseLine(metaclass=PoolMeta):
+class Line(metaclass=PoolMeta):
     __name__ = 'purchase.line'
 
     def get_invoice_line(self):
-        invoice_lines = super(PurchaseLine, self).get_invoice_line()
+        invoice_lines = super().get_invoice_line()
         if (self.product
                 and self.product.type == 'assets'
                 and self.product.depreciable):
diff -r c8ca9b7062b9 -r d06e80d24767 setup.py
--- a/setup.py  Wed Jan 29 22:24:40 2020 +0100
+++ b/setup.py  Sun Mar 01 12:33:51 2020 +0100
@@ -81,8 +81,8 @@
     keywords='tryton account asset',
     package_dir={'trytond.modules.account_asset': '.'},
     packages=(
-        ['trytond.modules.account_asset'] +
-        ['trytond.modules.account_asset.%s' % p for p in find_packages()]
+        ['trytond.modules.account_asset']
+        + ['trytond.modules.account_asset.%s' % p for p in find_packages()]
         ),
     package_data={
         'trytond.modules.account_asset': (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)',

Reply via email to