changeset 16cff6c845fd in trytond-gis:default
details: https://hg.tryton.org/trytond-gis?cmd=changeset;node=16cff6c845fd
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 ++
trytond_gis/postgis/__init__.py | 9 +++++++--
trytond_gis/postgis/database.py | 5 +----
trytond_gis/postgis/table.py | 1 -
4 files changed, 10 insertions(+), 7 deletions(-)
diffs (55 lines):
diff -r 4f90a2c81894 -r 16cff6c845fd .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 4f90a2c81894 -r 16cff6c845fd trytond_gis/postgis/__init__.py
--- a/trytond_gis/postgis/__init__.py Fri Dec 06 17:33:47 2019 +0100
+++ b/trytond_gis/postgis/__init__.py Sun Mar 01 12:33:54 2020 +0100
@@ -1,4 +1,9 @@
# This file is part of trytond_gis. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
-from .table import *
-from .database import *
+from trytond.backend.postgresql.database import (
+ DatabaseIntegrityError, DatabaseOperationalError)
+from .database import Database
+from .table import TableHandler
+
+__all__ = [
+ Database, DatabaseIntegrityError, DatabaseOperationalError, TableHandler]
diff -r 4f90a2c81894 -r 16cff6c845fd trytond_gis/postgis/database.py
--- a/trytond_gis/postgis/database.py Fri Dec 06 17:33:47 2019 +0100
+++ b/trytond_gis/postgis/database.py Sun Mar 01 12:33:54 2020 +0100
@@ -7,13 +7,9 @@
Binary)
from trytond.backend.postgresql.database import Database as PGDatabase
-from trytond.backend.postgresql.database import (
- DatabaseIntegrityError, DatabaseOperationalError)
from trytond_gis import _GeoJSON
-__all__ = ['Database', 'DatabaseIntegrityError', 'DatabaseOperationalError']
-
def ewkb2geojson(value, cursor):
if value is None:
@@ -58,4 +54,5 @@
return conn
+
register_adapter(_GeoJSON, lambda value: Binary(wkb.dumps(value)))
diff -r 4f90a2c81894 -r 16cff6c845fd trytond_gis/postgis/table.py
--- a/trytond_gis/postgis/table.py Fri Dec 06 17:33:47 2019 +0100
+++ b/trytond_gis/postgis/table.py Sun Mar 01 12:33:54 2020 +0100
@@ -8,7 +8,6 @@
from trytond_gis.const import GIS_SQL_TYPE_RE, WGS_84
-__all__ = ['TableHandler']
logger = logging.getLogger(__name__)