From 9cdcfdb2d6060a9a32f223296ae1d77e501cc22d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 1 Mar 2020 12:33:54 +0100 Subject: [PATCH] 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 --- .flake8 | 2 ++ proteus/__init__.py | 4 ++-- proteus/tests/__init__.py | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 .flake8 diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000000..bb03d08a82 --- /dev/null +++ b/.flake8 @@ -0,0 +1,2 @@ +[flake8] +ignore=E123,E124,E126,E128,W503 diff --git a/proteus/__init__.py b/proteus/__init__.py index 6746bf4a3e..d5b5a4693e 100644 --- a/proteus/__init__.py +++ b/proteus/__init__.py @@ -785,8 +785,8 @@ class Model(object): 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 --git a/proteus/tests/__init__.py b/proteus/tests/__init__.py index 5f9965f337..a72804f4fd 100644 --- a/proteus/tests/__init__.py +++ b/proteus/tests/__init__.py @@ -10,7 +10,8 @@ import proteus.config 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 @@ def main(): 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__)))))