def parse_src_input_to_file_name_map()

in memory_statistics/memory_statistics.py [0:0]


def parse_src_input_to_file_name_map(src):
    ret = {}
    for s in src:
        if isinstance(s, str):
            # If the element is just a string, we use it as the path and display
            # just the filename.
            ret[s] = os.path.basename(s)
        else:
            # If it is an object, the path should be in the 'file' key.
            name = os.path.basename(s['file'])
            # If a tag is specified, it follows the filename in parenthesis
            if 'tag' in s:
                name += f" ({s['tag']})"
            ret[s['file']] = name
    return ret