eric6/Debugger/VariablesViewer.py

changeset 8472
52e96cd0730d
parent 8434
a105f31ba10f
child 8483
11469e50910f
equal deleted inserted replaced
8470:7a2678e25528 8472:52e96cd0730d
209 elif ( 209 elif (
210 dvalue.startswith(("{", "(", "[")) and 210 dvalue.startswith(("{", "(", "[")) and
211 dvalue.endswith(("}", ")", "]")) 211 dvalue.endswith(("}", ")", "]"))
212 ): 212 ):
213 # it is most probably a dict, tuple or list derived class 213 # it is most probably a dict, tuple or list derived class
214 value = ast.literal_eval(dvalue) 214 with contextlib.suppress(Exception):
215 valueTypeStr = str(type(value))[8:-2] 215 value = ast.literal_eval(dvalue)
216 if valueTypeStr in VariableItem.arrayTypes: 216 valueTypeStr = str(type(value))[8:-2]
217 self.childCount = len(value) 217 if valueTypeStr in VariableItem.arrayTypes:
218 self.hasChildren = True 218 self.childCount = len(value)
219 self.hasChildren = True
219 220
220 elif ( 221 elif (
221 (dvalue.endswith("})") and "({" in dvalue) or 222 (dvalue.endswith("})") and "({" in dvalue) or
222 (dvalue.endswith("])") and "([" in dvalue) 223 (dvalue.endswith("])") and "([" in dvalue)
223 ): 224 ):
224 # that is probably a set derived class 225 # that is probably a set derived class
225 value = ast.literal_eval(dvalue.split("(", 1)[1][:-1]) 226 with contextlib.suppress(Exception):
226 valueTypeStr = str(type(value))[8:-2] 227 value = ast.literal_eval(dvalue.split("(", 1)[1][:-1])
227 if valueTypeStr in VariableItem.arrayTypes: 228 valueTypeStr = str(type(value))[8:-2]
228 self.childCount = len(value) 229 if valueTypeStr in VariableItem.arrayTypes:
229 self.hasChildren = True 230 self.childCount = len(value)
231 self.hasChildren = True
230 232
231 self.value = dvalue 233 self.value = dvalue
232 234
233 if len(dvalue) > 2048: # 2 kB 235 if len(dvalue) > 2048: # 2 kB
234 self.tooltip = dvalue[:2048] 236 self.tooltip = dvalue[:2048]

eric ide

mercurial