Skip to content

Commit

Permalink
CU-8692kn0yv Fix issue with fake dict in identifier based config
Browse files Browse the repository at this point in the history
More specifically the get method which was not able to return default values for non-existant keys (#341)
  • Loading branch information
mart-r committed Sep 22, 2023
1 parent 3396c4d commit 5dadb08
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 5dadb08

Please sign in to comment.