MCPcopy Create free account
hub / github.com/GNOME/gjs / format_node

Function format_node

tools/heapgraph.py:401–431  ·  view source on GitHub ↗
(graph, addr, parent='')

Source from the content-addressed store, hash-verified

399
400
401def format_node(graph, addr, parent=''):
402 node = get_node_label(graph, addr)
403 annotation = get_node_annotation(graph, addr)
404 has_priv = priv_regex.match(node)
405
406 # Color/Style
407 if os.isatty(1):
408 orig = style.UNDERLINE + 'jsobj@' + addr + style.END
409
410 if has_priv:
411 node = style.BOLD + has_priv.group(1) + style.END
412 orig += ' ' + style.UNDERLINE + 'priv@' + has_priv.group(2) + style.END
413 else:
414 node = style.BOLD + node + style.END
415 else:
416 orig = 'jsobj@' + addr
417
418 if has_priv:
419 node = has_priv.group(1)
420 orig += ' priv@' + has_priv.group(2)
421
422 # Add the annotation
423 if annotation:
424 if os.isatty(1):
425 node += ' "' + style.PURPLE + annotation + style.END + '"'
426 else:
427 node += ' "' + annotation + '"'
428
429 if args.no_addr:
430 return node
431 return node + ' ' + orig
432
433
434def output_tree_graph(graph, data, base='', parent=''):

Callers 2

output_tree_graphFunction · 0.85
output_tree_unreachablesFunction · 0.85

Calls 4

get_node_labelFunction · 0.85
get_node_annotationFunction · 0.85
matchMethod · 0.80
groupMethod · 0.65

Tested by

no test coverage detected