From 5d85b35eeb1052b81caf2ec762e212ebfb311828 Mon Sep 17 00:00:00 2001 From: "Richard D. Paul" <45046088+ripaul@users.noreply.github.com> Date: Tue, 6 Aug 2024 13:59:57 +0200 Subject: [PATCH] Update dotdict.py Added __getstate__ and __setstate__ for pickling support --- src/ucimlrepo/dotdict.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ucimlrepo/dotdict.py b/src/ucimlrepo/dotdict.py index a050ebe..5564fa6 100644 --- a/src/ucimlrepo/dotdict.py +++ b/src/ucimlrepo/dotdict.py @@ -2,4 +2,8 @@ class dotdict(dict): """dot.notation access to dictionary attributes""" __getattr__ = dict.get __setattr__ = dict.__setitem__ - __delattr__ = dict.__delitem__ \ No newline at end of file + __delattr__ = dict.__delitem__ + + # requires as suggested here in order to allow for pickling the dotdict https://stackoverflow.com/a/2050357 + def __getstate__(self): return self.__dict__ + def __setstate__(self, d): self.__dict__.update(d)