<commit_before>from collections import deque
import json
import os
import uuid

# TODO: protected imports?
from IPython.html import widgets
from IPython.utils.traitlets import Unicode
from IPython.display import Javascript, display

from plotly import utils

# Load JS widget code
# No officially recommended way to do this in any other way
# http://mail.scipy.org/pipermail/ipython-dev/2014-April/013835.html
directory = os.path.dirname(os.path.realpath(__file__))
js_widget_file = os.path.join(directory, 'graphWidget.js')
with open(js_widget_file) as f:
    js_widget_code = f.read()

display(Javascript(js_widget_code))

__all__ = None
<commit_msg>Use resource string to get graphWidgets.js<commit_after>from collections import deque
import json
import os
import uuid

# TODO: protected imports?
from IPython.html import widgets
from IPython.utils.traitlets import Unicode
from IPython.display import Javascript, display

from plotly import utils
from pkg_resources import resource_string

# Load JS widget code
# No officially recommended way to do this in any other way
# http://mail.scipy.org/pipermail/ipython-dev/2014-April/013835.html
directory = os.path.dirname(os.path.realpath(__file__))
js_widget_file = os.path.join(directory, 'graphWidget.js')
js_widget_code = resource_string('plotly',
                                 'widgets/graphWidgets.js').decode('utf-8')

display(Javascript(js_widget_code))

__all__ = None

{'fraction_non_alphanumeric': 0.08519553072625698, 'fraction_numerical': 0.014664804469273743, 'mean_word_length': 4.970833333333333, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7295639', 'n_tokens_mistral': 464, 'n_tokens_neox': 443, 'n_words': 126}