From 4c704ccb04fea24c400b4889b00bc3b8a92ad5f6 Mon Sep 17 00:00:00 2001 From: Lucas Gautheron Date: Mon, 28 Feb 2022 10:56:40 +0100 Subject: [PATCH] Avoid exception if tier is unknown but new_tiers is undefined (#364) --- ChildProject/converters.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ChildProject/converters.py b/ChildProject/converters.py index 9d39ceaab..a9b0cef58 100644 --- a/ChildProject/converters.py +++ b/ChildProject/converters.py @@ -440,7 +440,7 @@ class EafConverter(AnnotationConverter): FORMAT = "eaf" @staticmethod - def convert(filename: str, filter=None, **kwargs) -> pd.DataFrame: + def convert(filename: str, filter: str=None, new_tiers: list=None, **kwargs) -> pd.DataFrame: import pympi eaf = pympi.Elan.Eaf(filename) @@ -523,7 +523,7 @@ def convert(filename: str, filter=None, **kwargs) -> pd.DataFrame: segment["vcm_type"] = value elif label == "msc": segment["msc_type"] = value - elif label in kwargs["new_tiers"]: + elif new_tiers is not None and label in new_tiers: controlled_values = \ [value[0][0][0] for value in eaf.controlled_vocabularies[label][1].values()] if value not in controlled_values: