<commit_before>mumuki.load(() => {
  let characters = mumuki.characters || {};

  $.get('/character/animations.json',  (animations) => {
    loadCharacters(animations.main);
    loadAnimationGroup(animations.extra);
  });

  function loadAnimationGroup(animations) {
    return Object.keys(animations).map((character) => {
      newCharacter(character);

      return loadAnimations(character, animations[character].clips).then(() =>
        loadActions(character, animations[character].actions)).then(() =>
        character);
    });
  }

  function loadCharacters(animations) {
    var characterFinishedLoadingPromises = loadAnimationGroup(animations);

    Promise.race(characterFinishedLoadingPromises).then((character) => {
      mumuki.presenterCharacter = characters[character];
      placeAnimations();
    });
  }

  function newCharacter(name) {
    characters[name] = new muvment.Character();
  }

  function loadAnimations(character, animations) {
    return Promise.all(animations.map((svg) =>
      addClip(character, svg)));
  }

  function loadActions(character, actions) {
    Object.keys(actions || {}).forEach((action) =>
      addAction(character, action, parseAction(character, actions[action])));
  }

  function addAction(character, actionName, action) {
    characters[character].actions[actionName] = action;
  }

  function parseAction(character, action) {
    if (!action.type) return characters[character].clips[action];

    return muvment.animation[action.type](action.animations.map((animation) =>
      parseAction(character, animation)));
  }

  function addClip(character, name) {
    return muvment.animation.addImage(characters[character].clips, name, `/character/${character}/`);
  }

  function placeAnimations() {
    placeClip('mu-kids-character-animation', 'jump');
    placeClip('mu-kids-character-context', 'context');
  }

  function placeAction(imageId, action) {
    placeAnimation('actions', imageId, action);
  }

  function placeClip(imageId, clip) {
    placeAnimation('clips', imageId, clip);
  }

  function placeAnimation(animationType, imageId, clip) {
    let image = $(`#${imageId}`)[0];
    mumuki.presenterCharacter[animationType][clip].play(image);
  }

  mumuki.characters = characters;
});<commit_msg>use playAnimation in placeAnimation<commit_after>mumuki.load(() => {
  let characters = mumuki.characters || {};

  $.get('/character/animations.json',  (animations) => {
    loadCharacters(animations.main);
    loadAnimationGroup(animations.extra);
  });

  function loadAnimationGroup(animations) {
    return Object.keys(animations).map((character) => {
      newCharacter(character);

      return loadAnimations(character, animations[character].clips).then(() =>
        loadActions(character, animations[character].actions)).then(() =>
        character);
    });
  }

  function loadCharacters(animations) {
    var characterFinishedLoadingPromises = loadAnimationGroup(animations);

    Promise.race(characterFinishedLoadingPromises).then((character) => {
      mumuki.presenterCharacter = characters[character];
      placeKidsAnimations();
    });
  }

  function newCharacter(name) {
    characters[name] = new muvment.Character();
  }

  function loadAnimations(character, animations) {
    return Promise.all(animations.map((svg) =>
      addClip(character, svg)));
  }

  function loadActions(character, actions) {
    Object.keys(actions || {}).forEach((action) =>
      addAction(character, action, parseAction(character, actions[action])));
  }

  function addAction(character, actionName, action) {
    characters[character].actions[actionName] = action;
  }

  function parseAction(character, action) {
    if (!action.type) return characters[character].clips[action];

    return muvment.animation[action.type](action.animations.map((animation) =>
      parseAction(character, animation)));
  }

  function addClip(character, name) {
    return muvment.animation.addImage(characters[character].clips, name, `/character/${character}/`);
  }

  function placeKidsAnimations() {
    placeAnimation('mu-kids-character-animation', 'jump');
    placeAnimation('mu-kids-character-context', 'context');
  }

  function placeAnimation(canvasId, clip) {
    let canvas = $(`#${canvasId}`)[0];
    mumuki.presenterCharacter.playAnimation(clip, canvas);
  }

  mumuki.characters = characters;
});
{'fraction_non_alphanumeric': 0.14472177696359056, 'fraction_numerical': 0.0004579803068468056, 'mean_word_length': 4.571428571428571, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 21, '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': '4035534', 'n_tokens_mistral': 1268, 'n_tokens_neox': 1237, 'n_words': 193}