From 3082270a387139e2bab4457d3e27af9fdee5d157 Mon Sep 17 00:00:00 2001 From: Mart Ratas Date: Mon, 4 Sep 2023 15:15:18 +0300 Subject: [PATCH] CU-8692kn0yv Fix issue with fake dict in identifier based config More specifically the get method which was not able to return default values for non-existant keys (#341) --- medcat/config.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/medcat/config.py b/medcat/config.py index 5dbbd1412..429c2de67 100644 --- a/medcat/config.py +++ b/medcat/config.py @@ -28,7 +28,11 @@ class FakeDict: """ def __getitem__(self, arg: str) -> Any: - return getattr(self, arg) + try: + return getattr(self, arg) + except AttributeError as e: + raise KeyError from e + def __setitem__(self, arg: str, val) -> None: setattr(self, arg, val)