From 1dcede7bb0ad3cb57983b2d2370296dd221059d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laurent=20Al=C3=A9p=C3=A9e?= Date: Thu, 6 Jul 2023 15:12:55 +0200 Subject: [PATCH 1/2] add dict management in csv transform --- .../Modelops/core/common/writer/CsvWriter.py | 2 ++ .../Modelops/core/utils/model_util.py | 16 ---------------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/CosmoTech_Acceleration_Library/Modelops/core/common/writer/CsvWriter.py b/CosmoTech_Acceleration_Library/Modelops/core/common/writer/CsvWriter.py index 2191f6b4..1cb8d1fc 100644 --- a/CosmoTech_Acceleration_Library/Modelops/core/common/writer/CsvWriter.py +++ b/CosmoTech_Acceleration_Library/Modelops/core/common/writer/CsvWriter.py @@ -21,6 +21,8 @@ class CsvWriter: def _to_csv_format(val: any) -> str: if isinstance(val, bool): return str(val).lower() + if isinstance(val, dict): + return json.dumps(val) if str(val) == 'True' or str(val) == 'False': return str(val).lower() if str(val).startswith('{') and str(val).endswith('}'): diff --git a/CosmoTech_Acceleration_Library/Modelops/core/utils/model_util.py b/CosmoTech_Acceleration_Library/Modelops/core/utils/model_util.py index 8d0adcc0..02194ddc 100644 --- a/CosmoTech_Acceleration_Library/Modelops/core/utils/model_util.py +++ b/CosmoTech_Acceleration_Library/Modelops/core/utils/model_util.py @@ -161,19 +161,3 @@ def build_graph_version_name(graph_name: str, version: int) -> str: @staticmethod def build_graph_key_pattern(graph_name: str) -> str: return graph_name + ":*" - - @staticmethod - def unjsonify(value: dict) -> dict: - """ - Unjsonify transform json strings to python objects - :param value a dict - :return: a dict with unjsonify values - """ - for k, v in value.items(): - if isinstance(v, str): - try: - value[k] = json.loads(v) - logger.debug(f" new value => {value[k]}") - except ValueError as e: - logger.debug(f"{v} is not a jsonString, use the raw value") - return value From aad9c7a277fbfab94061c177bbe7b67bf750ce50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laurent=20Al=C3=A9p=C3=A9e?= Date: Thu, 6 Jul 2023 15:14:03 +0200 Subject: [PATCH 2/2] update version to 0.2.18 --- CosmoTech_Acceleration_Library/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CosmoTech_Acceleration_Library/__init__.py b/CosmoTech_Acceleration_Library/__init__.py index 562a062a..b33bf82d 100644 --- a/CosmoTech_Acceleration_Library/__init__.py +++ b/CosmoTech_Acceleration_Library/__init__.py @@ -1,4 +1,4 @@ # Copyright (c) Cosmo Tech corporation. # Licensed under the MIT license. -__version__ = '0.2.17' +__version__ = '0.2.18'