Skip to content

Commit 8ee045a

Browse files
committed
Fix object lookups for Python 3.6
1 parent 3ec190d commit 8ee045a

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

singlestoredb/http/connection.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
has_pygeos = False
3131

3232
try:
33-
import shapely
33+
import shapely.geometry
3434
import shapely.wkt
3535
has_shapely = True
3636
except ImportError:
@@ -171,9 +171,9 @@ def b64decode_converter(
171171

172172

173173
if has_shapely:
174-
shapely_Point = shapely.Point
175-
shapely_Polygon = shapely.Polygon
176-
shapely_LineString = shapely.LineString
174+
shapely_Point = shapely.geometry.Point
175+
shapely_Polygon = shapely.geometry.Polygon
176+
shapely_LineString = shapely.geometry.LineString
177177

178178
if has_numpy:
179179
np_ndarray = np.ndarray

singlestoredb/mysql/converters.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
has_numpy = False
1414

1515
try:
16-
import shapely
16+
import shapely.geometry
1717
import shapely.wkt
1818
has_shapely = True
1919
except ImportError:
@@ -209,12 +209,9 @@ def escape_shapely(value, mapping=None):
209209
"""Convert shapely geo objects."""
210210
return escape_str(shapely.wkt.dumps(value), mapping=mapping)
211211

212-
if hasattr(shapely, 'Polygon'):
213-
encoders[shapely.Polygon] = escape_shapely
214-
if hasattr(shapely, 'Point'):
215-
encoders[shapely.Point] = escape_shapely
216-
if hasattr(shapely, 'LineString'):
217-
encoders[shapely.LineString] = escape_shapely
212+
encoders[shapely.geometry.Polygon] = escape_shapely
213+
encoders[shapely.geometry.Point] = escape_shapely
214+
encoders[shapely.geometry.LineString] = escape_shapely
218215

219216
if has_pygeos:
220217

0 commit comments

Comments
 (0)