From 93480b1980ac775e3e9b2b21f41308db12bb39ac Mon Sep 17 00:00:00 2001 From: Tsuyoshi Hombashi Date: Sat, 9 Jul 2016 22:28:05 +0900 Subject: [PATCH] Replace function calls which no longer supported --- simplesqlite/loader/csv/core.py | 4 +++- simplesqlite/sqlquery.py | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/simplesqlite/loader/csv/core.py b/simplesqlite/loader/csv/core.py index 77cecfa..83ea2d2 100644 --- a/simplesqlite/loader/csv/core.py +++ b/simplesqlite/loader/csv/core.py @@ -53,10 +53,12 @@ def __init__(self, source): self.encoding = "utf-8" def _to_data_matrix(self): + from dataproperty.type import FloatTypeChecker + return [ [ six.b(data).decode(self.encoding, "ignore") - if not dataproperty.is_float(data) else data + if not FloatTypeChecker(data).is_type() else data for data in row ] for row in self._csv_reader diff --git a/simplesqlite/sqlquery.py b/simplesqlite/sqlquery.py index c1417bf..ebc9f1b 100644 --- a/simplesqlite/sqlquery.py +++ b/simplesqlite/sqlquery.py @@ -174,11 +174,16 @@ def to_value_str(cls, value): >>> SqlQuery.to_value_str(None) 'NULL' """ + from dataproperty.type import IntegerTypeChecker + from dataproperty.type import FloatTypeChecker if value is None: return "NULL" - if dataproperty.is_integer(value) or dataproperty.is_float(value): + if any([ + IntegerTypeChecker(value).is_type(), + FloatTypeChecker(value).is_type() + ]): return str(value) return "'%s'" % (value)