From 80673995ed21914b3bc43296ad2887fd305986e8 Mon Sep 17 00:00:00 2001 From: mucio Date: Fri, 31 May 2024 09:46:33 +0200 Subject: [PATCH] reworked the to_list method --- sources/rest_api/config_setup.py | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/sources/rest_api/config_setup.py b/sources/rest_api/config_setup.py index 178c9a1cc..731a2277f 100644 --- a/sources/rest_api/config_setup.py +++ b/sources/rest_api/config_setup.py @@ -13,7 +13,6 @@ ) import graphlib # type: ignore[import,unused-ignore] import string -import json import dlt from dlt.common import logger @@ -418,19 +417,11 @@ def process_parent_data_item( include_from_parent: List[str], ) -> Tuple[List[str], Dict[str, Any]]: - def to_list( - s: str, - ) -> List[str]: - try: - # Attempt to parse the string as a Python literal - parsed = json.loads(s) - # Check if the parsed object is a list - if isinstance(parsed, list): - return parsed - except (ValueError, json.JSONDecodeError): - pass - # If parsing fails or the parsed object is not a list, return the string in a list + s: Any, + ) -> List[Any]: + if isinstance(s, list): + return s return [s] parent_resource_name = resolved_param.resolve_config["resource"]