|
@@ -31,7 +31,8 @@ class SharedDataIndex(object):
|
31
|
31
|
|
32
|
32
|
class SharedData(object):
|
33
|
33
|
def __init__(
|
34
|
|
- self, key: str,
|
|
34
|
+ self,
|
|
35
|
+ key: str,
|
35
|
36
|
self_type: bool=False,
|
36
|
37
|
default: typing.Any=None,
|
37
|
38
|
) -> None:
|
|
@@ -44,6 +45,7 @@ class SharedData(object):
|
44
|
45
|
self.self_type = self_type
|
45
|
46
|
self._default = default
|
46
|
47
|
self.is_special_type = isinstance(self.default_value, (list, dict))
|
|
48
|
+ self.type = type(self.default_value)
|
47
|
49
|
if self.is_special_type:
|
48
|
50
|
if isinstance(self.default_value, list):
|
49
|
51
|
self.special_type = TrackedList
|
|
@@ -227,7 +229,10 @@ class SharedDataManager(object):
|
227
|
229
|
except UnknownSharedData:
|
228
|
230
|
pass # If no shared data, no previous value to remove
|
229
|
231
|
|
230
|
|
- self.set(final_key, value_)
|
|
232
|
+ if not shared_data.is_special_type:
|
|
233
|
+ self.set(final_key, value_)
|
|
234
|
+ else:
|
|
235
|
+ self.set(final_key, shared_data.type(value_))
|
231
|
236
|
|
232
|
237
|
for index in indexes:
|
233
|
238
|
index.add(value_)
|