<commit_before>
// const isResumeSupported = window.Blob && window.Blob.prototype.slice;

const upload = (url, {file, headers, responseType = 'json', onProgress} = {}) =>
  new Promise((resolve, reject) => {
    const data = new FormData();
    data.append('file', file);
    const req = new XMLHttpRequest();
    req.open('POST', url, true);
    req.responseType = responseType;
    if (typeof headers === 'object') {
      Object.keys(headers).forEach(key => {
        req.setRequestHeader(key, headers[key]);
      });
    }
    req.addEventListener('load', () => {
      if (req.status >= 200 && req.status < 300) {
        resolve(req.response);
      }
    });
    req.upload.addEventListener('progress', (ev) => {
      if (onProgress) {
        onProgress(ev);
      }
    });
    req.addEventListener('error', reject);
    req.addEventListener('abort', reject);
    req.send(data);
  });

const download = (url, {headers, responseType = 'blob', onProgress} = {}) =>
  new Promise((resolve, reject) => {
    const req = new XMLHttpRequest();
    req.open('GET', url, true);
    req.responseType = responseType;
    if (typeof headers === 'object') {
      Object.keys(headers).forEach(key => {
        req.setRequestHeader(key, headers[key]);
      });
    }
    req.addEventListener('load', () => {
      if (req.status >= 200 && req.status < 300) {
        resolve(req.response);
      }
    });
    req.addEventListener('progress', ev => {<commit_msg>chore(cleanup)<commit_after>
// const isResumeSupported = window.Blob && window.Blob.prototype.slice;

function applyRequestHeaders(req, headers) {
  if (typeof headers === 'object') {
    Object.keys(headers).forEach(key => {
      req.setRequestHeader(key, headers[key]);
    });
  }
}

const upload = (url, {file, headers, responseType = 'json', onProgress} = {}) =>
  new Promise((resolve, reject) => {
    const data = new FormData();
    data.append('file', file);
    const req = new XMLHttpRequest();
    req.open('POST', url, true);
    req.responseType = responseType;
    applyRequestHeaders(req, headers);
    req.addEventListener('load', () => {
      if (req.status >= 200 && req.status < 300) {
        resolve(req.response);
      }
    });
    req.upload.addEventListener('progress', (ev) => {
      if (onProgress) {
        onProgress(ev);
      }
    });
    req.addEventListener('error', reject);
    req.addEventListener('abort', reject);
    req.send(data);
  });

const download = (url, {headers, responseType = 'blob', onProgress} = {}) =>
  new Promise((resolve, reject) => {
    const req = new XMLHttpRequest();
    req.open('GET', url, true);
    req.responseType = responseType;
    applyRequestHeaders(req, headers);
    req.addEventListener('load', () => {
      if (req.status >= 200 && req.status < 300) {
        resolve(req.response);
      }
    });
    req.addEventListener('progress', ev => {
{'fraction_non_alphanumeric': 0.17628759073625994, 'fraction_numerical': 0.00829588662288282, 'mean_word_length': 3.0362622036262206, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 26, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7267247', 'n_tokens_mistral': 881, 'n_tokens_neox': 861, 'n_words': 180}