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
2908b8beff
commit
81d059ced2
5 files changed
+17
-16
No files matched your search
+3
-3
@@ -25,15 +25,15 @@ def register():
|
||||
ir.Cron,
|
||||
ir.CronCompany,
|
||||
party.Configuration,
|
||||
party.PartyConfigurationLang,
|
||||
party.ConfigurationLang,
|
||||
party.Party,
|
||||
party.PartyLang,
|
||||
party.ContactMechanism,
|
||||
module='company', type_='model')
|
||||
Pool.register(
|
||||
company.CompanyConfig,
|
||||
party.PartyReplace,
|
||||
party.PartyErase,
|
||||
party.Replace,
|
||||
party.Erase,
|
||||
module='company', type_='wizard')
|
||||
Pool.register(
|
||||
party.LetterReport,
|
||||
|
||||
@@ -8,15 +8,12 @@ from trytond.transaction import Transaction
|
||||
from .company import CompanyReport
|
||||
from .model import CompanyMultiValueMixin, CompanyValueMixin
|
||||
|
||||
__all__ = ['Configuration', 'PartyConfigurationLang', 'Party', 'PartyLang',
|
||||
'PartyReplace', 'PartyErase', 'ContactMechanism']
|
||||
|
||||
|
||||
class Configuration(CompanyMultiValueMixin, metaclass=PoolMeta):
|
||||
__name__ = 'party.configuration'
|
||||
|
||||
|
||||
class PartyConfigurationLang(CompanyValueMixin, metaclass=PoolMeta):
|
||||
class ConfigurationLang(CompanyValueMixin, metaclass=PoolMeta):
|
||||
__name__ = 'party.configuration.party_lang'
|
||||
|
||||
@classmethod
|
||||
@@ -26,7 +23,7 @@ class PartyConfigurationLang(CompanyValueMixin, metaclass=PoolMeta):
|
||||
table = cls.__table_handler__(module_name)
|
||||
exist &= table.column_exist('company')
|
||||
|
||||
super(PartyConfigurationLang, cls).__register__(module_name)
|
||||
super().__register__(module_name)
|
||||
|
||||
if not exist:
|
||||
# Re-migrate with company
|
||||
@@ -62,18 +59,18 @@ class PartyLang(CompanyValueMixin, metaclass=PoolMeta):
|
||||
field_names, value_names, 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() + [
|
||||
('company.company', 'party'),
|
||||
('company.employee', 'party'),
|
||||
]
|
||||
|
||||
|
||||
class PartyErase(metaclass=PoolMeta):
|
||||
class Erase(metaclass=PoolMeta):
|
||||
__name__ = 'party.erase'
|
||||
|
||||
def check_erase(self, party):
|
||||
@@ -81,7 +78,7 @@ class PartyErase(metaclass=PoolMeta):
|
||||
Party = pool.get('party.party')
|
||||
Company = pool.get('company.company')
|
||||
|
||||
super(PartyErase, self).check_erase(party)
|
||||
super().check_erase(party)
|
||||
|
||||
with Transaction().set_user(0):
|
||||
companies = Company.search([])
|
||||
|
||||
@@ -160,7 +160,8 @@ class User(metaclass=PoolMeta):
|
||||
user_id = Transaction().context['user']
|
||||
result = super(User, cls).read(ids, fields_names=fields_names)
|
||||
if (fields_names
|
||||
and (('company' in fields_names
|
||||
and ((
|
||||
'company' in fields_names
|
||||
and 'company' in Transaction().context)
|
||||
or ('employee' in fields_names
|
||||
and 'employee' in Transaction().context))):
|
||||
|
||||
@@ -78,8 +78,8 @@ setup(name=name,
|
||||
keywords='tryton company employee',
|
||||
package_dir={'trytond.modules.company': '.'},
|
||||
packages=(
|
||||
['trytond.modules.company'] +
|
||||
['trytond.modules.company.%s' % p for p in find_packages()]
|
||||
['trytond.modules.company']
|
||||
+ ['trytond.modules.company.%s' % p for p in find_packages()]
|
||||
),
|
||||
package_data={
|
||||
'trytond.modules.company': (info.get('xml', [])
|
||||
@@ -94,7 +94,8 @@ setup(name=name,
|
||||
'Intended Audience :: Financial and Insurance Industry',
|
||||
'Intended Audience :: Legal Industry',
|
||||
'Intended Audience :: Manufacturing',
|
||||
'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