From: Jacopo Farina Date: Wed, 15 Sep 2021 11:10:22 +0000 (+0200) Subject: Rename module from types.geometry to types.shapely X-Git-Tag: 3.0~71^2~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=90d9ce005e40c7eb865642caecc1a3ca5f2194f5;p=thirdparty%2Fpsycopg.git Rename module from types.geometry to types.shapely In case in the future further adapters for geometry types are added, this naming makes more sense --- diff --git a/docs/basic/pgtypes.rst b/docs/basic/pgtypes.rst index f8d81c177..bd3113fe7 100644 --- a/docs/basic/pgtypes.rst +++ b/docs/basic/pgtypes.rst @@ -229,16 +229,16 @@ To support this, you will need to install Shapely_ Since PostgGIS is an extension, its oid is not well known, so it is necessary to use `~psycopg.types.TypeInfo` to query the database and get its oid. After -that you can use `~psycopg.types.geometry.register_shapely()` to allow dumping +that you can use `~psycopg.types.shapely.register_shapely()` to allow dumping `shape`_ instances to :sql:`geometry` columns and parsing :sql:`geometry` back to `!shape` in the context where it is registered. -.. autofunction:: psycopg.types.geometry.register_shapely +.. autofunction:: psycopg.types.shapely.register_shapely Example:: >>> from psycopg.types import TypeInfo - >>> from psycopg.types.geometry import register_shapely + >>> from psycopg.types.shapely import register_shapely >>> from shapely.geometry import Point >>> info = TypeInfo.fetch(conn, "geometry") diff --git a/psycopg/psycopg/types/geometry.py b/psycopg/psycopg/types/shapely.py similarity index 97% rename from psycopg/psycopg/types/geometry.py rename to psycopg/psycopg/types/shapely.py index 0d88a052e..6a370e368 100644 --- a/psycopg/psycopg/types/geometry.py +++ b/psycopg/psycopg/types/shapely.py @@ -17,7 +17,7 @@ try: except ImportError: raise ImportError( - "The module psycopg.types.geometry requires the package 'Shapely'" + "The module psycopg.types.shapely requires the package 'Shapely'" " to be installed" )