<commit_before>
using JSON
using Reactive
using Interact
using Compat

import Interact.update_view
export mimewritable, writemime

if !isdefined(Main, :IJulia)
    error("IJuliaWidgets must be imported from inside an IJulia notebook")
end

const ijulia_js  = readall(joinpath(dirname(Base.source_path()), "ijulia.js"))

warn_js_removal(state) = display(MIME"text/html"(), "<script>window.interactWarnJSRemoval = $(string(state))</script>")
try
    display("text/html", """
     <div id="interact-js-shim">
         <script charset="utf-8">$(ijulia_js)</script>
         <script>
             window.interactWarnJSRemoval = true
             window.interactLoadedFlag = true
            \$("#interact-js-shim").bind("destroyed", function () {
                if (interactWarnJSRemoval && interactLoadedFlag == true) {
                    alert("Please note: removing or even re-running this cell will cause Interact's javascript shim to be removed." +
                      "This will cause Interact to not work properly if you reload the page," +
                      "unless you resatart the kernel and include Interact again.")
                      prevLifeTime = interactLifeTime
                }
            })
            \$([IPython.events]).on("kernel_starting.Kernel", function () { window.interactLoadedFlag = false })
        </script>
     </div>""")
catch
end

import IJulia
import IJulia: metadata, display_dict
using  IJulia.CommManager
import IJulia.CommManager: register_comm
import Base: writemime, mimewritable

const comms = Dict{Signal, Comm}()

function get_data_dict(value, mimetypes)
    dict = Dict{ASCIIString, ByteString}()
    for m in mimetypes
        if mimewritable(m, value)
            dict[m] = stringmime(m, value)
        elseif m == "text/latex" && mimewritable("application/x-latex", value)
            dict[string("text/latex")] =
                stringmime("application/x-latex", value)
        else
            warn("IPython seems to be requesting an unavailable mime type")
        end
    end
    return dict
end<commit_msg>fixes to the warning box<commit_after>
using JSON
using Reactive
using Interact
using Compat

import Interact.update_view
export mimewritable, writemime

if !isdefined(Main, :IJulia)
    error("IJuliaWidgets must be imported from inside an IJulia notebook")
end

const ijulia_js  = readall(joinpath(dirname(Base.source_path()), "ijulia.js"))

warn_js_removal(state) = display(MIME"text/html"(), "<script>window.interactWarnJSRemoval = $(string(state))</script>")
try
    display("text/html", """
     <div id="interact-js-shim">
         <script charset="utf-8">$(ijulia_js)</script>
         <script>
             window.interactWarnJSRemoval = true
             window.interactLoadedFlag = true
            \$("#interact-js-shim").bind("destroyed", function () {
                if (window.interactWarnJSRemoval && window.interactLoadedFlag) {
                    alert("Please note: removing or even re-running this cell will cause Interact's javascript shim to be removed." +
                      "This will cause Interact to not work properly if you reload the page," +
                      "unless you resatart the kernel and include Interact again.")
                }
            })
            \$([IPython.events]).on("kernel_starting.Kernel kernel_restarting.Kernel", function () { window.interactLoadedFlag = false })
        </script>
     </div>""")
catch
end

import IJulia
import IJulia: metadata, display_dict
using  IJulia.CommManager
import IJulia.CommManager: register_comm
import Base: writemime, mimewritable

const comms = Dict{Signal, Comm}()

function get_data_dict(value, mimetypes)
    dict = Dict{ASCIIString, ByteString}()
    for m in mimetypes
        if mimewritable(m, value)
            dict[m] = stringmime(m, value)
        elseif m == "text/latex" && mimewritable("application/x-latex", value)
            dict[string("text/latex")] =
                stringmime("application/x-latex", value)
        else
            warn("IPython seems to be requesting an unavailable mime type")
        end
    end
    return dict
end
{'fraction_non_alphanumeric': 0.10852713178294573, 'fraction_numerical': 0.00048449612403100775, 'mean_word_length': 2.809040590405904, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, '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': '1262146', 'n_tokens_mistral': 1252, 'n_tokens_neox': 1218, 'n_words': 317}