From 0a2232a902bd0cf00eed01e0b7353b9be99e2771 Mon Sep 17 00:00:00 2001 From: ljnsn <82611987+ljnsn@users.noreply.github.com> Date: Sun, 28 Apr 2024 23:19:20 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(parse):=20don't=20return=20e?= =?UTF-8?q?rrors=20for=20all=20dates=20(#142)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dsws_client/parse.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/dsws_client/parse.py b/dsws_client/parse.py index 223c55f..332691d 100644 --- a/dsws_client/parse.py +++ b/dsws_client/parse.py @@ -129,10 +129,7 @@ def process_symbol_value( # noqa: PLR0913 value = symbol_value.parse() if isinstance(symbol_value, DSString) and process_strings: value = process_string_value(value) # type: ignore[arg-type] - if is_error: - for date in dates: - records[(symbol_value.symbol, date)][field] = value - elif isinstance(value, list): + if isinstance(value, list): if len(value) != len(dates): raise InvalidResponseError( "Number of values does not match number of dates." @@ -140,7 +137,7 @@ def process_symbol_value( # noqa: PLR0913 for date, xvalue in zip(dates, value): records[(symbol_value.symbol, date)][field] = xvalue else: - if len(dates) > 1: + if len(dates) > 1 and not is_error: raise InvalidResponseError("More than one date found for single value.") records[(symbol_value.symbol, dates[0])][field] = value