<commit_before>// Static asynchronous implementation in parent context
// Implementation of scopeornot API
// https://github.com/eric-brechemier/scopeornot

// This script must be loaded after scope-bootstrap.js.
// It may be loaded after scope-bootstrap.js and scope-private.js
// to define modules in private scope instead of global scope.

/*global scope*/
scope(function(parentContext){

  var
    // declare alias
    parentScope = parentContext.scope,

    // private field

    // array of functions, queue recording calls to scope() that could not
    // be completed because of missing dependencies. Each function in the queue
    // repeats the recorded call to scope() when triggered.
    queue = [];

  /*
    Function: isReady(needs,context): boolean
    Check whether all needs are found in context

    Parameters:
      needs - array of strings, names of properties expected in context
      context - object, set of properties available in context

    Returns:
      boolean, true when all names in needs are found in context,
      false otherwise
  */
  function isReady(needs,context){
    var
      i,
      name;

    for (i=0; i<needs.length; i++){
      name = needs[i];
      if ( !context.hasOwnProperty(name) ){
        return false;
      }
    }

    return true;
  }

  /*
    Function: processQueue()
    Run all functions in the queue, which is previously reset to empty
  */
  function processQueue(){
    var
      // copy of current queue, to iterate on all items once and only once,
      // even if the queue is modified during processing
      currentQueue = [].concat(queue),
      i;

    for (i=0; i<currentQueue.length; i++){
      currentQueue[i]();<commit_msg>Bug fixes: needs is optional, the queue must be emptied before retry<commit_after>// Static asynchronous implementation in parent context
// Implementation of scopeornot API
// https://github.com/eric-brechemier/scopeornot

// This script must be loaded after scope-bootstrap.js.
// It may be loaded after scope-bootstrap.js and scope-private.js
// to define modules in private scope instead of global scope.

/*global scope*/
scope(function(parentContext){

  var
    // declare alias
    parentScope = parentContext.scope,

    // private field

    // array of functions, queue recording calls to scope() that could not
    // be completed because of missing dependencies. Each function in the queue
    // repeats the recorded call to scope() when triggered.
    queue = [];

  /*
    Function: isReady(needs,context): boolean
    Check whether all needs are found in context

    Parameters:
      needs - optional, array of strings, names of properties expected
              to be found in context
      context - object, set of properties available in context

    Returns:
      boolean, false when one name in needs is not found in context,
      true otherwise
  */
  function isReady(needs,context){
    if (needs === null || typeof needs === "undefined"){
      return true;
    }

    var
      i,
      name;

    for (i=0; i<needs.length; i++){
      name = needs[i];
      if ( !context.hasOwnProperty(name) ){
        return false;
      }
    }

    return true;
  }

  /*
    Function: processQueue()
    Run all functions in the queue, which is previously reset to empty
  */
  function processQueue(){
    var
      // copy of current queue, to iterate on all items once and only once,
      // even if the queue is modified during processing
      currentQueue = [].concat(queue),
      i;

    // empty the queue
    queue = [];

    // retry all
    for (i=0; i<currentQueue.length; i++){
      currentQueue[i]();
{'fraction_non_alphanumeric': 0.09003568487510294, 'fraction_numerical': 0.0010979961570134504, 'mean_word_length': 2.6043521266073193, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '1147396', 'n_tokens_mistral': 979, 'n_tokens_neox': 934, 'n_words': 399}