Skip to content

Commit

Permalink
refactor: make _WellKnownText not a NamedTuple
Browse files Browse the repository at this point in the history
  • Loading branch information
jcrist authored and cpcloud committed Oct 16, 2023
1 parent 5633660 commit 9a9e733
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions ibis/expr/datatypes/value.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import json
import uuid
from collections.abc import Mapping, Sequence
from typing import Any, NamedTuple
from typing import Any

import toolz
from public import public
Expand Down Expand Up @@ -233,8 +233,9 @@ def infer_shapely_multipolygon(value) -> dt.MultiPolygon:


@public
class _WellKnownText(NamedTuple):
text: str
class _WellKnownText:
def __init__(self, text: str):
self.text = text

def __str__(self):
return self.text
Expand Down Expand Up @@ -315,6 +316,8 @@ def normalize(typ, value):
return tuple(normalize(dt.linestring, item) for item in value)
elif dtype.is_multipolygon():
return tuple(normalize(dt.polygon, item) for item in value)
elif isinstance(value, _WellKnownText):
return value
return _WellKnownText(value.wkt)
elif dtype.is_date():
return normalize_datetime(value).date()
Expand Down

0 comments on commit 9a9e733

Please sign in to comment.