mirror of
https://github.com/clearml/clearml
synced 2025-02-07 21:33:25 +00:00
Make sure ProxyDictPreWrite and ProxyDictPostWrite are pickled correctly
This commit is contained in:
parent
4e0f711e39
commit
e4024e01d5
@ -17,6 +17,9 @@ class ProxyDictPostWrite(dict):
|
||||
super(ProxyDictPostWrite, self).__setitem__(key, value)
|
||||
self._set_callback()
|
||||
|
||||
def __reduce__(self):
|
||||
return dict, (), None, None, iter(self._to_dict().items())
|
||||
|
||||
def _set_callback(self, *_):
|
||||
if self._update_func:
|
||||
self._update_func(self._update_obj, self)
|
||||
@ -48,6 +51,9 @@ class ProxyDictPreWrite(dict):
|
||||
self._update_obj = update_obj
|
||||
self._update_func = update_func
|
||||
|
||||
def __reduce__(self):
|
||||
return dict, (), None, None, iter(self.items())
|
||||
|
||||
def __setitem__(self, key, value):
|
||||
key_value = self._set_callback((key, value,))
|
||||
if key_value:
|
||||
|
Loading…
Reference in New Issue
Block a user