From 78da958bcdce31ebbc2bf9b6d31ff64ed759fa29 Mon Sep 17 00:00:00 2001 From: Daniel <d.hornung@indiscale.com> Date: Tue, 7 Jan 2025 14:44:08 +0100 Subject: [PATCH] WIP: Validating to_dict result. --- src/caosadvancedtools/table_json_conversion/convert.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/caosadvancedtools/table_json_conversion/convert.py b/src/caosadvancedtools/table_json_conversion/convert.py index aabdf827..1c84d0e2 100644 --- a/src/caosadvancedtools/table_json_conversion/convert.py +++ b/src/caosadvancedtools/table_json_conversion/convert.py @@ -707,10 +707,8 @@ def _set_in_nested(mydict: dict, path: list, value: Any, prefix: list = [], skip return mydict -# ToDo: Fix https://gitlab.indiscale.com/caosdb/src/caosdb-advanced-user-tools/-/issues/138 -# and remove pylint disable def to_dict(xlsx: Union[str, BinaryIO], schema: Union[dict, str, TextIO], - validate: bool = None, strict: bool = False) -> dict: # pylint: disable=unused-argument + validate: bool = False, strict: bool = False) -> dict: """Convert the xlsx contents to a dict, it must follow a schema. Parameters @@ -722,10 +720,10 @@ def to_dict(xlsx: Union[str, BinaryIO], schema: Union[dict, str, TextIO], Schema for validation of XLSX content. validate: bool, optional - If True, validate the result against the schema. + If True, validate the result against the schema. Default is False. strict: bool, optional - If True, fail faster. + If True, fail faster. Default is False. Returns @@ -734,4 +732,4 @@ def to_dict(xlsx: Union[str, BinaryIO], schema: Union[dict, str, TextIO], A dict representing the JSON with the extracted data. """ converter = XLSXConverter(xlsx, schema, strict=strict) - return converter.to_dict() + return converter.to_dict(validate=validate) -- GitLab