<commit_before># coding=utf-8
from __future__ import unicode_literals

from jinja2 import Environment, FileSystemLoader, environmentfunction, Markup

import pyecharts.conf as conf
import pyecharts.utils as utils

LINK_SCRIPT_FORMATTER = '<script type="text/javascript" src="{}"></script>'
EMBED_SCRIPT_FORMATTER = '<script type="text/javascript">\n{}\n</script>'
CHART_DIV_FORMATTER = '<div id="{chart_id}" style="width:{width};height:{height};"></div>'  # flake8: noqa
CHART_CONFIG_FORMATTER = """
var myChart_{chart_id} = echarts.init(document.getElementById('{chart_id}', null, {{renderer: '{renderer}'}}));
var option_{chart_id} = {options};
myChart_{chart_id}.setOption(option_{chart_id});
"""


@environmentfunction
def echarts_js_dependencies(env, *args):
    """ Render script html nodes in external link mode.

    :param env:
    :param args:
    """
    current_config = env.pyecharts_config
    dependencies = utils.merge_js_dependencies(*args)

    if current_config.js_embed:
        contents = current_config.read_file_contents_from_local(dependencies)
<commit_msg>:bug: fix echarts initialization error (#428)<commit_after># coding=utf-8
from __future__ import unicode_literals

from jinja2 import Environment, FileSystemLoader, environmentfunction, Markup

import pyecharts.conf as conf
import pyecharts.utils as utils

LINK_SCRIPT_FORMATTER = '<script type="text/javascript" src="{}"></script>'
EMBED_SCRIPT_FORMATTER = '<script type="text/javascript">\n{}\n</script>'
CHART_DIV_FORMATTER = '<div id="{chart_id}" style="width:{width};height:{height};"></div>'  # flake8: noqa
CHART_CONFIG_FORMATTER = """
var myChart_{chart_id} = echarts.init(document.getElementById('{chart_id}'), null, {{renderer: '{renderer}'}});
var option_{chart_id} = {options};
myChart_{chart_id}.setOption(option_{chart_id});
"""


@environmentfunction
def echarts_js_dependencies(env, *args):
    """ Render script html nodes in external link mode.

    :param env:
    :param args:
    """
    current_config = env.pyecharts_config
    dependencies = utils.merge_js_dependencies(*args)

    if current_config.js_embed:
        contents = current_config.read_file_contents_from_local(dependencies)

{'fraction_non_alphanumeric': 0.135492700729927, 'fraction_numerical': 0.004105839416058394, 'mean_word_length': 6.408783783783784, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2928591', 'n_tokens_mistral': 703, 'n_tokens_neox': 678, 'n_words': 143}