Skip to content

Commit

Permalink
CU-8692kn0yv Fix issue with fake dict in identifier based config; mor…
Browse files Browse the repository at this point in the history
…e specifically the get method which was not able to return default values for non-existant keys
  • Loading branch information
mart-r committed Aug 23, 2023
1 parent 9f9b25b commit 84876c1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion medcat/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ class FakeDict:
"""FakeDict that allows the use of the __getitem__ and __setitem__ method for legacy access."""

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)
Expand Down

0 comments on commit 84876c1

Please sign in to comment.