<commit_before>export function Mouse() {
  this.downs = 0;
  this.onMouseDown = () => {
    this.downs += 1;
  };
}<commit_msg>Mocks for various objects<commit_after>function onMouseDown() { this.downs += 1; }
export function Mouse() {
  const mouse = {
    downs: 0,
  };
  mouse.onMouseDown = onMouseDown.bind(mouse);

  return mouse;
}

function preventDefault() { this.preventedDefault = true; }
function stopPropagation() { this.stopedPropagation = true; }

export function MouseEvent(type, button, sx, sy, cx, cy) {
  const event = {
    bubbles: true,
    cancelable: (type !== 'mousemove'),
    view: false,
    detail: 0,
    screenX: sx,
    screenY: sy,
    clientX: cx,
    clientY: cy,
    ctrlKey: false,
    altKey: false,
    shiftKey: false,
    metaKey: false,
    button,
    relatedTarget: undefined,
    preventedDefault: false,
    stopedPropagation: false,
  };
  event.preventDefault = preventDefault.bind(event);
  event.stopPropagation = stopPropagation.bind(event);

  return event;
}

function persist() { this.persisted = true; }

export function SyntheticMouseEvent(type, button, sx, sy, cx, cy) {
  const event = new MouseEvent(type, button, sx, sy, cx, cy);

  event.persisted = false;
  event.persist = persist.bind(event);

  return event;
}

export function StatefullComponent(initialState = {}, initialProps = {}) {
  this.props = initialProps;
  this.state = initialState;
  this.setState = (updater) => {
    this.state = typeof updater === 'function' ? updater(this.state, this.props) : updater;
  };
}

function addEventListener(type, cb) {
  if (!Array.isArray(this.listeners[type])) {
    this.listeners[type] = [];
  }
  this.listeners[type].push(cb);
}
function removeEventListener(type, cb) {
  if (Array.isArray(this.listeners[type])) {
    const idx = this.listeners[type].indexOf(cb);
    if (idx > -1) {
      this.listeners[type].splice(idx, 1);
    }
  }
  this.listeners[type].push(cb);
}
export function Document() {
  const document = {
    listners: {},
  };

  document.addEventListener = addEventListener.bind(document);
  document.removeEventListener = removeEventListener.bind(document);

  return document;
}
{'fraction_non_alphanumeric': 0.14022140221402213, 'fraction_numerical': 0.0032287822878228783, 'mean_word_length': 3.7986725663716814, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '868626', 'n_tokens_mistral': 717, 'n_tokens_neox': 713, 'n_words': 159}