From a9f6c9ab6079348a7ff48ed1bb1b1940218e999f Mon Sep 17 00:00:00 2001 From: Holger Frey Date: Wed, 17 Feb 2021 09:39:07 +0100 Subject: [PATCH] removed the 'silent' feature from parse_file --- sensospot_data/parser.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/sensospot_data/parser.py b/sensospot_data/parser.py index 6425954..75e36d2 100755 --- a/sensospot_data/parser.py +++ b/sensospot_data/parser.py @@ -68,15 +68,12 @@ def _cleanup_data_columns(data_frame): return renamed.drop(columns=surplus_columns) -def parse_file(data_file, silent=False): - """ parses one data file and adds metadata to result """ - try: - measurement_info = _extract_measurement_info(Path(data_file)) - except ValueError as e: - if silent: - return None - else: - raise e +def parse_file(data_file): + """ parses one data file and adds metadata to result + + will race a ValueError, if metadata could not be extracted + """ + measurement_info = _extract_measurement_info(Path(data_file)) data_frame = _parse_csv(data_file) data_frame[META_DATA_WELL_ROW] = measurement_info.row data_frame[META_DATA_WELL_COLUMN] = measurement_info.column @@ -88,7 +85,7 @@ def parse_multiple_files(file_list): """ parses a list of file paths to one combined dataframe """ if not file_list: raise ValueError("Empty file list provided") - collection = (parse_file(path, silent=True) for path in file_list) + collection = (parse_file(path) for path in file_list) filtered = (frame for frame in collection if frame is not None) data_frame = next(filtered) for next_frame in filtered: