<commit_before>function load_ipython_extension() {
  var extensionLoaded = false;

  function loadJuno( host ) {
    if ( extensionLoaded ) { return; }
    var script = document.createElement( 'script' );
    script.src = 'http://' + host + '/juno/nbextension.js';
    document.getElementsByTagName( 'head' )[0].appendChild( script );
  }

  function handleKernel( kernel ) {
    kernel.execute( "import os\nprint os.environ['JUNO_HOST']", {
      iopub: {
        output: function( response ) {
          var host = 'localhost:3000';
          //var host = 'drama.timbr.io';
          //var host = 'app0.timbr.io';
          if ( response.msg_type === 'stream' ) {
            host = response.content.text;
          }
          loadJuno( host );
        }
      }
    }, { silent: false } ); 
  }

  requirejs( [
    "base/js/namespace",
    "base/js/events"
  ], function( Jupyter, Events ) {
    // On new kernel session create new comm managers
    if ( Jupyter.notebook && Jupyter.notebook.kernel ) {
      handleKernel( Jupyter.notebook.kernel );
    }
    Events.on( 'kernel_created.Kernel kernel_created.Session', ( event, data ) => {
      handleKernel( data.kernel );
    });
  });
}

module.exports = {
  load_ipython_extension: load_ipython_extension
};
<commit_msg>add http protocol to hosts<commit_after>function load_ipython_extension() {
  var extensionLoaded = false;

  function loadJuno( host ) {
    if ( extensionLoaded ) { return; }
    var script = document.createElement( 'script' );
    script.src = host + '/juno/nbextension.js';
    document.getElementsByTagName( 'head' )[0].appendChild( script );
  }

  function handleKernel( kernel ) {
    kernel.execute( "import os\nprint os.environ['JUNO_HOST']", {
      iopub: {
        output: function( response ) {
          var host = 'http://localhost:3000';
          //var host = 'drama.timbr.io';
          //var host = 'app0.timbr.io';
          if ( response.msg_type === 'stream' ) {
            host = response.content.text;
          }
          loadJuno( host );
        }
      }
    }, { silent: false } ); 
  }

  requirejs( [
    "base/js/namespace",
    "base/js/events"
  ], function( Jupyter, Events ) {
    // On new kernel session create new comm managers
    if ( Jupyter.notebook && Jupyter.notebook.kernel ) {
      handleKernel( Jupyter.notebook.kernel );
    }
    Events.on( 'kernel_created.Kernel kernel_created.Session', ( event, data ) => {
      handleKernel( data.kernel );
    });
  });
}

module.exports = {
  load_ipython_extension: load_ipython_extension
};

{'fraction_non_alphanumeric': 0.1406858924395947, 'fraction_numerical': 0.004676539360872954, 'mean_word_length': 2.4830393487109905, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '3897770', 'n_tokens_mistral': 834, 'n_tokens_neox': 819, 'n_words': 165}