MCPcopy Create free account
hub / github.com/fabioz/PyDev.Debugger / frame_vars_to_xml

Function frame_vars_to_xml

_pydevd_bundle/pydevd_xml.py:285–317  ·  view source on GitHub ↗

dumps frame variables to XML

(frame_f_locals, hidden_ns=None)

Source from the content-addressed store, hash-verified

283
284
285def frame_vars_to_xml(frame_f_locals, hidden_ns=None):
286 """dumps frame variables to XML
287 <var name="var_name" scope="local" type="type" value="value"/>
288 """
289 xml = []
290
291 keys = sorted(frame_f_locals)
292
293 return_values_xml = []
294
295 for k in keys:
296 try:
297 v = frame_f_locals[k]
298 eval_full_val = should_evaluate_full_value(v)
299
300 if k == "_pydev_stop_at_break":
301 continue
302
303 if k == RETURN_VALUES_DICT:
304 for name, val in v.items():
305 return_values_xml.append(var_to_xml(val, name, additional_in_xml=' isRetVal="True"'))
306
307 else:
308 if hidden_ns is not None and k in hidden_ns:
309 xml.append(var_to_xml(v, str(k), additional_in_xml=' isIPythonHidden="True"', evaluate_full_value=eval_full_val))
310 else:
311 xml.append(var_to_xml(v, str(k), evaluate_full_value=eval_full_val))
312 except Exception:
313 pydev_log.exception("Unexpected error, recovered safely.")
314
315 # Show return values as the first entry.
316 return_values_xml.extend(xml)
317 return "".join(return_values_xml)
318
319
320def get_variable_details(val, evaluate_full_value=True, to_string=None, context: Optional[str] = None):

Callers

nothing calls this directly

Calls 6

var_to_xmlFunction · 0.85
itemsMethod · 0.80
exceptionMethod · 0.80
appendMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected