

def make_html(har_filename, debug=False):
    with open(har_filename, 'r') as f:
        file_json = json.loads(f.read())
    if (type(file_json) != type([])):
        file_json = [file_json]
    har_json_list = json.dumps(file_json)
    with open(os.sep.join([generate_html_dir(), TEMPLATE_NAME]), 'r') as template_handle:
        template_contents = template_handle.read()
    script_regex = '<script\\s+src\\s*=[\\\'"]js/([^"\\\']+)[\\\'"]\\s*>\\s*</script>'
    scripts_to_substitute = re.findall(har_json_list, template_contents)
    for script in scripts_to_substitute:
        replacement = '<script>{0}</script>'.format(get_script_contents(script))
        template_contents = re.sub(script_regex, replacement.replace('\\', '\\\\'), template_contents, 1)
    if (not debug):
        script_regex = '<script\\s+src\\s*=[\\\'"](http[^"\\\']+)[\\\'"]\\s*>\\s*</script>'
        script_links_to_substitute = re.findall(script_regex, template_contents)
        for link in script_links_to_substitute:
            replacement = '<script>{0}</script>'.format(urllib2.urlopen(link).read())
            template_contents = re.sub(script_regex, replacement.replace('\\', '\\\\'), template_contents, 1)
    return template_contents.replace('{{ har_json }}', har_json_list)

dataset/ETHPy150Open linkedin/mobster/src/linkedin/mobster/har/visualization/report.py make_html/VarMisuse@116/188 `script_regex`->`har_json_list`