changeset 5be4ecbcb691 in proteus:default
details: https://hg.tryton.org/proteus?cmd=changeset;node=5be4ecbcb691
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 ++
proteus/__init__.py | 4 ++--
proteus/tests/__init__.py | 4 +++-
3 files changed, 7 insertions(+), 3 deletions(-)
diffs (41 lines):
diff -r 1327cc4910e9 -r 5be4ecbcb691 .flake8
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/.flake8 Sun Mar 01 12:33:54 2020 +0100
@@ -0,0 +1,2 @@
+[flake8]
+ignore=E123,E124,E126,E128,W503
diff -r 1327cc4910e9 -r 5be4ecbcb691 proteus/__init__.py
--- a/proteus/__init__.py Wed Dec 04 11:09:37 2019 +0100
+++ b/proteus/__init__.py Sun Mar 01 12:33:54 2020 +0100
@@ -785,8 +785,8 @@
def __eq__(self, other):
if isinstance(other, Model):
- return ((self.__class__.__name__, self.id) ==
- (other.__class__.__name__, other.id))
+ return ((self.__class__.__name__, self.id)
+ == (other.__class__.__name__, other.id))
return NotImplemented
def __ne__(self, other):
diff -r 1327cc4910e9 -r 5be4ecbcb691 proteus/tests/__init__.py
--- a/proteus/tests/__init__.py Wed Dec 04 11:09:37 2019 +0100
+++ b/proteus/tests/__init__.py Sun Mar 01 12:33:54 2020 +0100
@@ -10,7 +10,8 @@
os.environ.setdefault('TRYTOND_DATABASE_URI', 'sqlite:///:memory:')
os.environ.setdefault('DB_NAME', ':memory:')
-from trytond.tests.test_tryton import doctest_setup, doctest_teardown
+from trytond.tests.test_tryton import (
+ doctest_setup, doctest_teardown) # noqa: E402
here = os.path.dirname(__file__)
readme = os.path.normpath(os.path.join(here, '..', '..', 'README'))
@@ -46,6 +47,7 @@
runner = unittest.TextTestRunner()
return runner.run(suite)
+
if __name__ == '__main__':
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(
os.path.abspath(__file__)))))