From 1cac48e3f0a640a8b55eabf16f763179dd832d38 Mon Sep 17 00:00:00 2001 From: Brian Lu Date: Mon, 13 Feb 2023 00:01:39 -0500 Subject: [PATCH 1/2] additional error handlers --- tungsten/parsers/field_parse.py | 2 +- tungsten/parsers/supplier/sigma_aldrich/table_injector.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/tungsten/parsers/field_parse.py b/tungsten/parsers/field_parse.py index 1af98da..0317ee8 100644 --- a/tungsten/parsers/field_parse.py +++ b/tungsten/parsers/field_parse.py @@ -16,7 +16,7 @@ def getField(self, field: SdsQueryFieldName, target: dict): target = command.match(target) try: result = post_process(target) - except (KeyError, AttributeError): + except (KeyError, AttributeError, TypeError, IndexError): result = None return result diff --git a/tungsten/parsers/supplier/sigma_aldrich/table_injector.py b/tungsten/parsers/supplier/sigma_aldrich/table_injector.py index 3024ead..8adf7a9 100644 --- a/tungsten/parsers/supplier/sigma_aldrich/table_injector.py +++ b/tungsten/parsers/supplier/sigma_aldrich/table_injector.py @@ -103,7 +103,10 @@ def generate_injections(self, io: IO[bytes]) -> list[Injection]: def reject_table(table: TabulaTable) -> bool: # TODO this is a temporary solution # TODO reject more tables that are false positives - return table.data[1][0].text.strip()[1] == ")" + try: + return table.data[1][0].text.strip()[1] == ")" + except IndexError: + return True @dataclass From 40f396029a2cf4b938923272f08bb1f197f2bfc3 Mon Sep 17 00:00:00 2001 From: Brian Lu Date: Mon, 13 Feb 2023 00:02:10 -0500 Subject: [PATCH 2/2] bump version to 0.6.1 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 0c5dc0f..90f08e2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "tungsten-sds" -version = "0.6.0" +version = "0.6.1" description = "An MSDS parser." authors = ["Dennis Pham ", "Brian Lu "] license = "MIT"