From: Daniele Varrazzo Date: Mon, 18 Jul 2022 07:34:25 +0000 (+0100) Subject: docs: move documentation from shapely module docstrings to docs X-Git-Tag: 3.1~45^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c133e92cbcd441d9d99732a93670d5c884ee8032;p=thirdparty%2Fpsycopg.git docs: move documentation from shapely module docstrings to docs This avoids the dependency on shapely to build the docs. --- diff --git a/docs/basic/pgtypes.rst b/docs/basic/pgtypes.rst index 471187707..93dc353a7 100644 --- a/docs/basic/pgtypes.rst +++ b/docs/basic/pgtypes.rst @@ -334,7 +334,28 @@ to configure dumping `shape`_ instances to :sql:`geometry` columns and parsing :sql:`geometry` data back to `!shape` instances, in the context where the adapters are registered. -.. autofunction:: psycopg.types.shapely.register_shapely +.. function:: psycopg.types.shapely.register_shapely + + Register Shapely dumper and loaders. + + After invoking this function on an adapter, the queries retrieving + PostGIS geometry objects will return Shapely's shape object instances + both in text and binary mode. + + Similarly, shape objects can be sent to the database. + + This requires the Shapely library to be installed. + + :param info: The object with the information about the geometry type. + :param context: The context where to register the adapters. If `!None`, + register it globally. + + .. note:: + + Registering the adapters doesn't affect objects already created, even + if they are children of the registered context. For instance, + registering the adapter globally doesn't affect already existing + connections. Example:: diff --git a/psycopg/psycopg/types/shapely.py b/psycopg/psycopg/types/shapely.py index 54dde629b..e99f25629 100644 --- a/psycopg/psycopg/types/shapely.py +++ b/psycopg/psycopg/types/shapely.py @@ -52,27 +52,7 @@ class BaseGeometryDumper(Dumper): def register_shapely(info: TypeInfo, context: Optional[AdaptContext] = None) -> None: - """Register Shapely dumper and loaders. - - After invoking this function on an adapter, the queries retrieving - PostGIS geometry objects will return Shapely's shape object instances - both in text and binary mode. - - Similarly, shape objects can be sent to the database. - - This requires the Shapely library to be installed. - - :param info: The object with the information about the geometry type. - :param context: The context where to register the adapters. If `!None`, - register it globally. - - .. note:: - - Registering the adapters doesn't affect objects already created, even - if they are children of the registered context. For instance, - registering the adapter globally doesn't affect already existing - connections. - """ + """Register Shapely dumper and loaders.""" # A friendly error warning instead of an AttributeError in case fetch() # failed and it wasn't noticed.