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:
1 parent
db28ff3278
commit
aeb2b48b2e
6 files changed
+21
-28
No files matched your search
+11
-11
@@ -2,21 +2,21 @@
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
|
||||
from trytond.pool import Pool
|
||||
from .purchase_request import *
|
||||
from .purchase import *
|
||||
from .party import PartyReplace
|
||||
from . import purchase_request
|
||||
from . import purchase
|
||||
from . import party
|
||||
|
||||
|
||||
def register():
|
||||
Pool.register(
|
||||
PurchaseRequest,
|
||||
HandlePurchaseCancellationExceptionStart,
|
||||
CreatePurchaseAskParty,
|
||||
Purchase,
|
||||
PurchaseLine,
|
||||
purchase_request.PurchaseRequest,
|
||||
purchase_request.HandlePurchaseCancellationExceptionStart,
|
||||
purchase_request.CreatePurchaseAskParty,
|
||||
purchase.Purchase,
|
||||
purchase.Line,
|
||||
module='purchase_request', type_='model')
|
||||
Pool.register(
|
||||
CreatePurchase,
|
||||
HandlePurchaseCancellationException,
|
||||
PartyReplace,
|
||||
purchase_request.CreatePurchase,
|
||||
purchase_request.HandlePurchaseCancellationException,
|
||||
party.Replace,
|
||||
module='purchase_request', type_='wizard')
|
||||
@@ -2,14 +2,12 @@
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
from trytond.pool import PoolMeta
|
||||
|
||||
__all__ = ['PartyReplace']
|
||||
|
||||
|
||||
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() + [
|
||||
('purchase.request', 'party'),
|
||||
]
|
||||
+2
-4
@@ -11,8 +11,6 @@ from trytond.pyson import Eval
|
||||
|
||||
from .exceptions import PurchaseWarehouseWarning
|
||||
|
||||
__all__ = ['Purchase', 'PurchaseLine']
|
||||
|
||||
|
||||
def process_request(func):
|
||||
@wraps(func)
|
||||
@@ -84,7 +82,7 @@ class Purchase(metaclass=PoolMeta):
|
||||
super(Purchase, cls).do(purchases)
|
||||
|
||||
|
||||
class PurchaseLine(metaclass=PoolMeta):
|
||||
class Line(metaclass=PoolMeta):
|
||||
__name__ = 'purchase.line'
|
||||
|
||||
requests = fields.One2Many(
|
||||
@@ -99,6 +97,6 @@ class PurchaseLine(metaclass=PoolMeta):
|
||||
Request = pool.get('purchase.request')
|
||||
with Transaction().set_context(_check_access=False):
|
||||
requests = [r for l in cls.browse(lines) for r in l.requests]
|
||||
super(PurchaseLine, cls).delete(lines)
|
||||
super().delete(lines)
|
||||
with Transaction().set_context(_check_access=False):
|
||||
Request.update_state(requests)
|
||||
@@ -13,12 +13,6 @@ from trytond.pyson import If, In, Eval, Bool
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.pool import Pool
|
||||
|
||||
__all__ = ['PurchaseRequest',
|
||||
'CreatePurchaseAskParty', 'CreatePurchase',
|
||||
'HandlePurchaseCancellationException',
|
||||
'HandlePurchaseCancellationExceptionStart',
|
||||
]
|
||||
|
||||
STATES = {
|
||||
'readonly': Eval('state') != 'draft',
|
||||
}
|
||||
|
||||
@@ -80,8 +80,8 @@ setup(name=name,
|
||||
keywords='tryton purchase request',
|
||||
package_dir={'trytond.modules.purchase_request': '.'},
|
||||
packages=(
|
||||
['trytond.modules.purchase_request'] +
|
||||
['trytond.modules.purchase_request.%s' % p for p in find_packages()]
|
||||
['trytond.modules.purchase_request']
|
||||
+ ['trytond.modules.purchase_request.%s' % p for p in find_packages()]
|
||||
),
|
||||
package_data={
|
||||
'trytond.modules.purchase_request': (info.get('xml', [])
|
||||
@@ -95,7 +95,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)',
|
||||
|
||||
Reference in new issue
Block a user