changeset 89c26ca2c6f0 in modules/authentication_sms:default
details:
https://hg.tryton.org/modules/authentication_sms?cmd=changeset;node=89c26ca2c6f0
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 | 6 +++---
res.py | 3 +--
setup.py | 8 +++++---
tests/__init__.py | 2 +-
tests/test_authentication_sms.py | 2 ++
6 files changed, 14 insertions(+), 9 deletions(-)
diffs (93 lines):
diff -r dda06660aee3 -r 89c26ca2c6f0 .flake8
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/.flake8 Sun Mar 01 12:33:52 2020 +0100
@@ -0,0 +1,2 @@
+[flake8]
+ignore=E123,E124,E126,E128,W503
diff -r dda06660aee3 -r 89c26ca2c6f0 __init__.py
--- a/__init__.py Wed Dec 04 11:09:35 2019 +0100
+++ b/__init__.py Sun Mar 01 12:33:52 2020 +0100
@@ -2,11 +2,11 @@
# this repository contains the full copyright notices and license terms.
from trytond.pool import Pool
-from .res import *
+from . import res
def register():
Pool.register(
- User,
- SMSCode,
+ res.User,
+ res.UserLoginSMSCode,
module='authentication_sms', type_='model')
diff -r dda06660aee3 -r 89c26ca2c6f0 res.py
--- a/res.py Wed Dec 04 11:09:35 2019 +0100
+++ b/res.py Sun Mar 01 12:33:52 2020 +0100
@@ -11,7 +11,6 @@
from trytond.pool import PoolMeta, Pool
from trytond.tools import resolve
-__all__ = ['User', 'SMSCode']
logger = logging.getLogger(__name__)
@@ -58,7 +57,7 @@
return cls._login_sms(login, parameters)
-class SMSCode(ModelSQL):
+class UserLoginSMSCode(ModelSQL):
"""SMS Code
This class is separated from the res.user one in order to prevent locking
diff -r dda06660aee3 -r 89c26ca2c6f0 setup.py
--- a/setup.py Wed Dec 04 11:09:35 2019 +0100
+++ b/setup.py Sun Mar 01 12:33:52 2020 +0100
@@ -79,8 +79,9 @@
keywords='tryton sms authentication two-factor 2FA',
package_dir={'trytond.modules.authentication_sms': '.'},
packages=(
- ['trytond.modules.authentication_sms'] +
- ['trytond.modules.authentication_sms.%s' % p for p in find_packages()]
+ ['trytond.modules.authentication_sms']
+ + ['trytond.modules.authentication_sms.%s' % p
+ for p in find_packages()]
),
package_data={
'trytond.modules.authentication_sms': (info.get('xml', [])
@@ -94,7 +95,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 :: Czech',
diff -r dda06660aee3 -r 89c26ca2c6f0 tests/__init__.py
--- a/tests/__init__.py Wed Dec 04 11:09:35 2019 +0100
+++ b/tests/__init__.py Sun Mar 01 12:33:52 2020 +0100
@@ -2,7 +2,7 @@
# this repository contains the full copyright notices and license terms.
try:
- from trytond.modules.authentication_sms.tests.test_authentication_sms
import suite, send_sms
+ from trytond.modules.authentication_sms.tests.test_authentication_sms
import suite, send_sms # noqa: E501
except ImportError:
from .test_authentication_sms import suite, send_sms
diff -r dda06660aee3 -r 89c26ca2c6f0 tests/test_authentication_sms.py
--- a/tests/test_authentication_sms.py Wed Dec 04 11:09:35 2019 +0100
+++ b/tests/test_authentication_sms.py Sun Mar 01 12:33:52 2020 +0100
@@ -16,6 +16,8 @@
'to': to,
'from': from_,
})
+
+
sms_queue = []