eric6/Debugger/VariablesViewer.py

branch
maintenance
changeset 8450
be7369a19dc9
parent 8273
698ae46f40a4
parent 8434
a105f31ba10f
child 8576
fe1957c69854
equal deleted inserted replaced
8401:832e9474cf77 8450:be7369a19dc9
194 self.hasChildren = True 194 self.hasChildren = True
195 elif dtype in VariableItem.arrayTypes: 195 elif dtype in VariableItem.arrayTypes:
196 self.childCount = int(dvalue) 196 self.childCount = int(dvalue)
197 dvalue = VariableItem.noOfItemsStr.format(dvalue) 197 dvalue = VariableItem.noOfItemsStr.format(dvalue)
198 self.hasChildren = True 198 self.hasChildren = True
199 199
200 elif dtype == "Shiboken.EnumType": 200 elif dtype == "Shiboken.EnumType":
201 self.hasChildren = True 201 self.hasChildren = True
202 202
203 elif dtype == 'str': 203 elif dtype == 'str':
204 if VariableItem.rx_nonprintable.search(dvalue) is None: 204 if VariableItem.rx_nonprintable.search(dvalue) is None:
205 with contextlib.suppress(Exception): 205 with contextlib.suppress(Exception):
206 dvalue = ast.literal_eval(dvalue) 206 dvalue = ast.literal_eval(dvalue)
207 dvalue = str(dvalue) 207 dvalue = str(dvalue)
208
209 elif (
210 dvalue.startswith(("{", "(", "[")) and
211 dvalue.endswith(("}", ")", "]"))
212 ):
213 # it is most probably a dict, tuple or list derived class
214 value = ast.literal_eval(dvalue)
215 valueTypeStr = str(type(value))[8:-2]
216 if valueTypeStr in VariableItem.arrayTypes:
217 self.childCount = len(value)
218 self.hasChildren = True
219
220 elif (
221 (dvalue.endswith("})") and "({" in dvalue) or
222 (dvalue.endswith("])") and "([" in dvalue)
223 ):
224 # that is probably a set derived class
225 value = ast.literal_eval(dvalue.split("(", 1)[1][:-1])
226 valueTypeStr = str(type(value))[8:-2]
227 if valueTypeStr in VariableItem.arrayTypes:
228 self.childCount = len(value)
229 self.hasChildren = True
208 230
209 self.value = dvalue 231 self.value = dvalue
210 232
211 if len(dvalue) > 2048: # 2 kB 233 if len(dvalue) > 2048: # 2 kB
212 self.tooltip = dvalue[:2048] 234 self.tooltip = dvalue[:2048]

eric ide

mercurial