<commit_before><!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE
The complete set of authors may be found at http://polymer.github.io/AUTHORS
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS
-->

<script>
  var defaultCellWidth = 100;

  function findElementInList(container, selector) {
    var i = 0;
    var children = container._children;
    var ms = Polymer.DomApi.matchesSelector;

    for (; i < children.length; i++) {
      if (children[i].nodeType === Node.ELEMENT_NODE && ms.call(children[i], selector)) {
        return children[i];
      }
    }
    return null;
  }

  function buildItem(index) {
    return {
      index: index
    };
  }

  function buildDataSet(size) {
    var data = [];
    while (data.length < size) {
      data.push(buildItem(data.length));
    }
    return data;
  }

  function simulateScroll(config) {
    var list = config.list;
    var target = config.target;
    var delay = config.delay || 1;
    var contribution = Math.abs(config.contribution) || 10;
    // scroll back up
    if (target < list.scrollTop) {
      contribution = -contribution;
    }

    function scrollHandler() {
      setTimeout(function() {
        var minScrollTop = 0;
        var maxScrollTop = list.scrollHeight - list.offsetHeight;

        config.onScroll && config.onScroll();

        if (list.scrollTop < target && contribution > 0 && list.scrollTop < maxScrollTop) {
          list.scrollTop = Math.min(maxScrollTop, list.scrollTop + contribution);

        } else if (list.scrollTop > target && contribution < 0 && list.scrollTop > minScrollTop) {
          list.scrollTop = Math.max(minScrollTop, list.scrollTop + contribution);

        } else {
          list.removeEventListener('scroll', scrollHandler);
          list.scrollTop = target;
          config.onScrollEnd && config.onScrollEnd();
        }
      }, delay);
    }
    list.addEventListener('scroll', scrollHandler);
    scrollHandler();
  }

  function getGridRowFromIndex(grid, index) {
    return Math.floor(index / grid._itemsPerRow);
  }

  function getNthItemFromGrid(grid, n, itemSize) {
    itemSize = itemSize || 100;
    var gridRect = grid.getBoundingClientRect();
    var x = gridRect.left + ((n % grid._itemsPerRow) * itemSize) + (itemSize / 2);
    var y = gridRect.top + (Math.floor(n / grid._itemsPerRow) * itemSize) + (itemSize / 2);

    return getItemFromPoint(x, y);
  }

  function getFirstItemFromList(list) {
    var listRect = list.getBoundingClientRect();
    return getItemFromPoint(listRect.left + defaultCellWidth * 0.5, listRect.top + 1);
  }

  function getLastItemFromList(list) {
    var listRect = list.getBoundingClientRect();
    return getItemFromPoint(listRect.left + defaultCellWidth * 0.5, listRect.top + listRect.height - 1);
  }

  function getItemFromPoint(x, y) {
    return document.elementFromPoint(x, y);
  }

  function isFullOfItems(list) {
    var listRect = list.getBoundingClientRect();
    var listHeight = listRect.height - 1;
    var item, y = listRect.top + 1;
    // IE 10 & 11 doesn't render propertly :(
    var badPixels = 0;
    while (y < listHeight) {
      item = document.elementsFromPoint(listRect.left + 100, y)[1];

      if (!item) {
        badPixels++;
      }
      y++;
      if (badPixels > 2) {<commit_msg>document.elementsFromPoint not supported that well<commit_after><!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE
The complete set of authors may be found at http://polymer.github.io/AUTHORS
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS
-->

<script>
  var defaultCellWidth = 100;

  function findElementInList(container, selector) {
    var i = 0;
    var children = container._children;
    var ms = Polymer.DomApi.matchesSelector;

    for (; i < children.length; i++) {
      if (children[i].nodeType === Node.ELEMENT_NODE && ms.call(children[i], selector)) {
        return children[i];
      }
    }
    return null;
  }

  function buildItem(index) {
    return {
      index: index
    };
  }

  function buildDataSet(size) {
    var data = [];
    while (data.length < size) {
      data.push(buildItem(data.length));
    }
    return data;
  }

  function simulateScroll(config) {
    var list = config.list;
    var target = config.target;
    var delay = config.delay || 1;
    var contribution = Math.abs(config.contribution) || 10;
    // scroll back up
    if (target < list.scrollTop) {
      contribution = -contribution;
    }

    function scrollHandler() {
      setTimeout(function() {
        var minScrollTop = 0;
        var maxScrollTop = list.scrollHeight - list.offsetHeight;

        config.onScroll && config.onScroll();

        if (list.scrollTop < target && contribution > 0 && list.scrollTop < maxScrollTop) {
          list.scrollTop = Math.min(maxScrollTop, list.scrollTop + contribution);

        } else if (list.scrollTop > target && contribution < 0 && list.scrollTop > minScrollTop) {
          list.scrollTop = Math.max(minScrollTop, list.scrollTop + contribution);

        } else {
          list.removeEventListener('scroll', scrollHandler);
          list.scrollTop = target;
          config.onScrollEnd && config.onScrollEnd();
        }
      }, delay);
    }
    list.addEventListener('scroll', scrollHandler);
    scrollHandler();
  }

  function getGridRowFromIndex(grid, index) {
    return Math.floor(index / grid._itemsPerRow);
  }

  function getNthItemFromGrid(grid, n, itemSize) {
    itemSize = itemSize || 100;
    var gridRect = grid.getBoundingClientRect();
    var x = gridRect.left + ((n % grid._itemsPerRow) * itemSize) + (itemSize / 2);
    var y = gridRect.top + (Math.floor(n / grid._itemsPerRow) * itemSize) + (itemSize / 2);

    return getItemFromPoint(x, y);
  }

  function getFirstItemFromList(list) {
    var listRect = list.getBoundingClientRect();
    return getItemFromPoint(listRect.left + defaultCellWidth * 0.5, listRect.top + 1);
  }

  function getLastItemFromList(list) {
    var listRect = list.getBoundingClientRect();
    return getItemFromPoint(listRect.left + defaultCellWidth * 0.5, listRect.top + listRect.height - 1);
  }

  function getItemFromPoint(x, y) {
    return document.elementFromPoint(x, y);
  }

  function isFullOfItems(list) {
    var listRect = list.getBoundingClientRect();
    var listHeight = listRect.height - 1;
    var item, y = listRect.top + 1;
    // IE 10 & 11 doesn't render propertly :(
    var badPixels = 0;
    while (y < listHeight) {
      item = document.elementFromPoint(listRect.left + 100, y);

      if (!item) {
        badPixels++;
      }
      y++;
      if (badPixels > 2) {
{'fraction_non_alphanumeric': 0.11563495360753358, 'fraction_numerical': 0.01010940312976042, 'mean_word_length': 2.9421397379912664, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 15, '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': '4180956', 'n_tokens_mistral': 2261, 'n_tokens_neox': 2130, 'n_words': 570}