parameters: (tree, name)
return_statement: return {'name': name + ' (' + FormatBytes(tree['size']) + ')',
            'data': { '$area': tree['size'] },
            'children': children }
docstring: Convert TreeifySymbols output to a JSON treemap.
  
    The format is very similar, with the notable exceptions being
    lists of children instead of maps and some different attribute names.
docstring_summary: Convert TreeifySymbols output to a JSON treemap.
docstring_tokens: Convert TreeifySymbols output to a JSON treemap .
function: def JsonifyTree(tree, name):
    """Convert TreeifySymbols output to a JSON treemap.
  
    The format is very similar, with the notable exceptions being
    lists of children instead of maps and some different attribute names."""
    children = []
    css_class_map = {
                    '[vtable]': 'vtable',
                    '[rodata]': 'read-only_data',
                    '[data]': 'data',
                    '[bss]': 'bss',
                    '[code]': 'code',
                    '[weak]': 'weak_symbol'
    }
    if 'children' in tree:
      # Non-leaf node. Recurse.
      for child_name, child in tree['children'].iteritems():
        children.append(JsonifyTree(child, child_name))
    else:
      # Leaf node; dump per-file stats as entries in the treemap
      for kind, size in tree['sizes'].iteritems():
        child_json = {'name': kind + ' (' + FormatBytes(size) + ')',
                     'data': { '$area': size }}
        css_class = css_class_map.get(kind)
        if css_class is not None: child_json['data']['$symbol'] = css_class
        children.append(child_json)
    # Sort children by size, largest to smallest.
    children.sort(key=lambda child: -child['data']['$area'])
  
    # For leaf nodes, the 'size' attribute is the size of the leaf;
    # Non-leaf nodes don't really have a size, but their 'size' attribute is
    # the sum of the sizes of all their children.
    return {'name': name + ' (' + FormatBytes(tree['size']) + ')',
            'data': { '$area': tree['size'] },
            'children': children }
function_tokens: def JsonifyTree ( tree , name ) : children = [ ] css_class_map = { '[vtable]' : 'vtable' , '[rodata]' : 'read-only_data' , '[data]' : 'data' , '[bss]' : 'bss' , '[code]' : 'code' , '[weak]' : 'weak_symbol' } if 'children' in tree : # Non-leaf node. Recurse. for child_name , child in tree [ 'children' ] . iteritems ( ) : children . append ( JsonifyTree ( child , child_name ) ) else : # Leaf node; dump per-file stats as entries in the treemap for kind , size in tree [ 'sizes' ] . iteritems ( ) : child_json = { 'name' : kind + ' (' + FormatBytes ( size ) + ')' , 'data' : { '$area' : size } } css_class = css_class_map . get ( kind ) if css_class is not None : child_json [ 'data' ] [ '$symbol' ] = css_class children . append ( child_json ) # Sort children by size, largest to smallest. children . sort ( key = lambda child : - child [ 'data' ] [ '$area' ] ) # For leaf nodes, the 'size' attribute is the size of the leaf; # Non-leaf nodes don't really have a size, but their 'size' attribute is # the sum of the sizes of all their children. return { 'name' : name + ' (' + FormatBytes ( tree [ 'size' ] ) + ')' , 'data' : { '$area' : tree [ 'size' ] } , 'children' : children }