File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change 33from __future__ import division
44
55import json
6+ import sys
67
78from compas .data .exceptions import DecoderError
89
10+ # We don't do this from `compas.IPY` to avoid circular imports
11+ if 'ironpython' in sys .version .lower ():
12+ try :
13+ from System .Collections .Generic import IDictionary
14+ except :
15+ IDictionary = None
16+ else :
17+ IDictionary = None
18+
919
1020def cls_from_dtype (dtype ):
1121 """Get the class object corresponding to a COMPAS data type specification.
@@ -102,4 +112,10 @@ def object_hook(self, o):
102112 except AttributeError :
103113 raise DecoderError ("The data type can't be found in the specified module: {}." .format (o ['dtype' ]))
104114
105- return cls .from_data (o ['value' ])
115+ obj_value = o ['value' ]
116+
117+ # Kick-off from_data from a rebuilt Python dictionary instead of the C# data type
118+ if IDictionary and isinstance (o , IDictionary [str , object ]):
119+ obj_value = {key : obj_value [key ] for key in obj_value .Keys }
120+
121+ return cls .from_data (obj_value )
You can’t perform that action at this time.
0 commit comments