<commit_before>/**
 * Lessons
 */

import dispatcher from "./dispatcher";

const lessons = {
   ["EXPLORE"]: require("./lessons/explore").default,
   ["DUMB"]: require("./lessons/dumb").default,
   ["GETTING STARTED"]: require("./lessons/dumb").default,
   ["JOB LIFE CYCLE"]: require("./lessons/dumb").default,
   ["BASIC IO"]: require("./lessons/dumb").default,
   ["THE TIME QUANTUM"]: require("./lessons/dumb").default,
   ["IO FREQUENCY AND PRIORITY"]: require("./lessons/dumb").default,
   ["PERSISTENT TIME QUANTUMS"]: require("./lessons/dumb").default,
   ["THE BOOST TIMER"]: require("./lessons/dumb").default
};

export default lessons;

export const actions = {
   SET_LESSON: Symbol("SET_LESSON")
};

export function setLesson(key) {
   dispatcher.dispatch({
      type: actions.SET_LESSON,
      data: lessons[key]
   })
}<commit_msg>Freeze lessons<commit_after>/**
 * Lessons
 */

import dispatcher from "./dispatcher";

const lessons = {
   ["EXPLORE"]: getLesson("./lessons/explore"),
   ["DUMB"]: getLesson("./lessons/dumb"),
   ["GETTING STARTED"]: getLesson("./lessons/dumb"),
   ["JOB LIFE CYCLE"]: getLesson("./lessons/dumb"),
   ["BASIC IO"]: getLesson("./lessons/dumb"),
   ["THE TIME QUANTUM"]: getLesson("./lessons/dumb"),
   ["IO FREQUENCY AND PRIORITY"]: getLesson("./lessons/dumb"),
   ["PERSISTENT TIME QUANTUMS"]: getLesson("./lessons/dumb"),
   ["THE BOOST TIMER"]: getLesson("./lessons/dumb")
};

function getLesson(path) {
   const obj = require(path).default;
   deepFreeze(obj);
   return obj;
}

/**
 * Deeply freeze an obj
 */
function deepFreeze(obj) {
   for (const key of Object.getOwnPropertyNames(obj)) {
      if (typeof obj[key] === "object") {
         deepFreeze(obj[key]);
      }
   }
   Object.freeze(obj);
}

export default lessons;

export const actions = {
   SET_LESSON: Symbol("SET_LESSON")
};

export function setLesson(key) {
   dispatcher.dispatch({
      type: actions.SET_LESSON,
      data: lessons[key]
   })
}
{'fraction_non_alphanumeric': 0.19127346524606798, 'fraction_numerical': 0.0, 'mean_word_length': 3.893300248138958, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4397934', 'n_tokens_mistral': 730, 'n_tokens_neox': 709, 'n_words': 136}