<commit_before>(function () {
  var ns = $.namespace('pskl.service.keyboard');

  ns.CheatsheetService = function () {
    this.isDisplayed_ = false;
  };

  ns.CheatsheetService.prototype.init = function () {
    this.cheatsheetEl_ = document.getElementById('cheatsheet-wrapper');
    if (!this.cheatsheetEl_) {
      throw 'cheatsheetEl_ DOM element could not be retrieved';
    }
    this.initMarkup_();
    $.subscribe(Events.TOGGLE_HELP, this.toggleCheatsheet_.bind(this));
  };

  ns.CheatsheetService.prototype.toggleCheatsheet_ = function () {
    if (this.isDisplayed_) {
      this.hideCheatsheet_();
    } else {
      this.showCheatsheet_();
    }
  };

  ns.CheatsheetService.prototype.showCheatsheet_ = function () {
    this.cheatsheetEl_.style.display = 'block';
    this.isDisplayed_ = true;
  };


  ns.CheatsheetService.prototype.hideCheatsheet_ = function () {
    this.cheatsheetEl_.style.display = 'none';
    this.isDisplayed_ = false;
  };

  ns.CheatsheetService.prototype.initMarkup_ = function () {
    this.initMarkupForTools_();
    this.initMarkupForMisc_();
  };

  ns.CheatsheetService.prototype.initMarkupForTools_ = function () {
    var shortcutTemplate = pskl.utils.Template.get('cheatsheet-shortcut-template');

    var toolShortcutsContainer = $('.cheatsheet-tool-shortcuts', this.cheatsheetEl_).get(0);
    var tools = pskl.app.toolController.tools;
    for (var i = 0 ; i < tools.length ; i++) {
      var tool = tools[i];
      var shortcutEl = pskl.utils.Template.createFromHTML(
        pskl.utils.Template.replace(shortcutTemplate, {
          shortcutIcon : 'tool-icon ' + tool.instance.toolId,
          shortcutDescription : tool.instance.helpText,
          shortcutKey : tool.shortcut
        })
      );
      toolShortcutsContainer.appendChild(shortcutEl);
    }
  };

  this.initMarkupForMisc_ = function () {
    var shortcutTemplate = pskl.utils.Template.get('cheatsheet-shortcut-template');

    var miscShortcutsContainer = $('.cheatsheet-misc-shortcuts', this.cheatsheetEl_).get(0);
    var toDescriptor = function (shortcut, description) {
      return {shortcut:shortcut, description:description};
    };
    var miscKeys = [
      toDescriptor('X', 'Swap primary/secondary colors'),
      toDescriptor('ctrl + X', 'Cut selection'),
      toDescriptor('ctrl + C', 'Copy selection'),
      toDescriptor('ctrl + V', 'Paste selection'),
      toDescriptor('ctrl + Z', 'Undo'),
      toDescriptor('ctrl + Y', 'Redo')
    ];
    for (var i = 0 ; i < miscKeys.length ; i++) {
      var key = miscKeys[i];
      var shortcutEl = pskl.utils.Template.createFromHTML(
        pskl.utils.Template.replace(shortcutTemplate, {
          shortcutIcon : '',
          shortcutDescription : key.description,
          shortcutKey : key.shortcut
        })<commit_msg>Fix : typo<commit_after>(function () {
  var ns = $.namespace('pskl.service.keyboard');

  ns.CheatsheetService = function () {
    this.isDisplayed_ = false;
  };

  ns.CheatsheetService.prototype.init = function () {
    this.cheatsheetEl_ = document.getElementById('cheatsheet-wrapper');
    if (!this.cheatsheetEl_) {
      throw 'cheatsheetEl_ DOM element could not be retrieved';
    }
    this.initMarkup_();
    $.subscribe(Events.TOGGLE_HELP, this.toggleCheatsheet_.bind(this));
  };

  ns.CheatsheetService.prototype.toggleCheatsheet_ = function () {
    if (this.isDisplayed_) {
      this.hideCheatsheet_();
    } else {
      this.showCheatsheet_();
    }
  };

  ns.CheatsheetService.prototype.showCheatsheet_ = function () {
    this.cheatsheetEl_.style.display = 'block';
    this.isDisplayed_ = true;
  };


  ns.CheatsheetService.prototype.hideCheatsheet_ = function () {
    this.cheatsheetEl_.style.display = 'none';
    this.isDisplayed_ = false;
  };

  ns.CheatsheetService.prototype.initMarkup_ = function () {
    this.initMarkupForTools_();
    this.initMarkupForMisc_();
  };

  ns.CheatsheetService.prototype.initMarkupForTools_ = function () {
    var shortcutTemplate = pskl.utils.Template.get('cheatsheet-shortcut-template');

    var toolShortcutsContainer = $('.cheatsheet-tool-shortcuts', this.cheatsheetEl_).get(0);
    var tools = pskl.app.toolController.tools;
    for (var i = 0 ; i < tools.length ; i++) {
      var tool = tools[i];
      var shortcutEl = pskl.utils.Template.createFromHTML(
        pskl.utils.Template.replace(shortcutTemplate, {
          shortcutIcon : 'tool-icon ' + tool.instance.toolId,
          shortcutDescription : tool.instance.helpText,
          shortcutKey : tool.shortcut
        })
      );
      toolShortcutsContainer.appendChild(shortcutEl);
    }
  };

  ns.CheatsheetService.prototype.initMarkupForMisc_ = function () {
    var shortcutTemplate = pskl.utils.Template.get('cheatsheet-shortcut-template');

    var miscShortcutsContainer = $('.cheatsheet-misc-shortcuts', this.cheatsheetEl_).get(0);
    var toDescriptor = function (shortcut, description) {
      return {shortcut:shortcut, description:description};
    };
    var miscKeys = [
      toDescriptor('X', 'Swap primary/secondary colors'),
      toDescriptor('ctrl + X', 'Cut selection'),
      toDescriptor('ctrl + C', 'Copy selection'),
      toDescriptor('ctrl + V', 'Paste selection'),
      toDescriptor('ctrl + Z', 'Undo'),
      toDescriptor('ctrl + Y', 'Redo')
    ];
    for (var i = 0 ; i < miscKeys.length ; i++) {
      var key = miscKeys[i];
      var shortcutEl = pskl.utils.Template.createFromHTML(
        pskl.utils.Template.replace(shortcutTemplate, {
          shortcutIcon : '',
          shortcutDescription : key.description,
          shortcutKey : key.shortcut
        })
{'fraction_non_alphanumeric': 0.13273081694134325, 'fraction_numerical': 0.001417685628211944, 'mean_word_length': 3.234058514628657, 'pattern_counts': {'":': 0, '<': 7, '<?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': '2876052', 'n_tokens_mistral': 1813, 'n_tokens_neox': 1748, 'n_words': 285}