tools/binary_size/libsupersize/demangle.py
def DemangleKeysAndMergeLists(name_to_list, tool_prefix):
  """Demangles keys of a dict of lists, and returns the result.

  Keys may demangle to a common name. When this happens, the corresponding lists
  are merged in arbitrary order.
  """
  keys = [key for key in name_to_list if _CanDemangle(key)]
  if not keys:
    return name_to_list

  logging.info('Demangling %d keys', len(keys))
  key_iter = iter(_DemangleNames(keys, tool_prefix))
  ret = collections.defaultdict(list)
  for key, val in name_to_list.items():
    ret[next(key_iter) if _CanDemangle(key) else key] += val
  assert(next(key_iter, None) is None)
  logging.info('* %d keys become %d keys' % (len(name_to_list), len(ret)))
  return ret
Demangles keys of a dict of lists, and returns the result.

  Keys may demangle to a common name. When this happens, the corresponding lists
  are merged in arbitrary order.
  
Demangles keys of a dict of lists, and returns the result.
Keys may demangle to a common name. When this happens, the corresponding lists
are merged in arbitrary order.
Demangles keys of a dict of lists and returns the result . Keys may demangle to a common name . When this happens the corresponding lists are merged in arbitrary order .
def DemangleKeysAndMergeLists(name_to_list, tool_prefix):
  keys = [key for key in name_to_list if _CanDemangle(key)]
  if not keys:
    return name_to_list
  logging.info('Demangling %d keys', len(keys))
  key_iter = iter(_DemangleNames(keys, tool_prefix))
  ret = collections.defaultdict(list)
  for key, val in name_to_list.items():
    ret[next(key_iter) if _CanDemangle(key) else key] += val
  assert(next(key_iter, None) is None)
  logging.info('* %d keys become %d keys' % (len(name_to_list), len(ret)))
  return ret
def DemangleKeysAndMergeLists ( name_to_list , tool_prefix ) : keys = [ key for key in name_to_list if _CanDemangle ( key ) ] if not keys : return name_to_list logging . info ( 'Demangling %d keys' , len ( keys ) ) key_iter = iter ( _DemangleNames ( keys , tool_prefix ) ) ret = collections . defaultdict ( list ) for key , val in name_to_list . items ( ) : ret [ next ( key_iter ) if _CanDemangle ( key ) else key ] += val assert ( next ( key_iter , None ) is None ) logging . info ( '* %d keys become %d keys' % ( len ( name_to_list ) , len ( ret ) ) ) return ret
Demangles keys of a dict of lists, and returns the result.
Demangles keys of a dict of lists and returns the result .
"""Demangles keys of a dict of lists, and returns the result.

  Keys may demangle to a common name. When this happens, the corresponding lists
  are merged in arbitrary order.
  """
name_to_list
tool_prefix