<commit_before>class ZIF {

  constructor(file) {
    this.file = file;
    this.head = this.parseHead(); // A promise for the header
  }

  getTile(x, y, zoomLevel) {
    return this.getLevel(zoomLevel).then(level => level.getTile(x,y));
  }

  getLevel(zoomLevel) {
    return this.head.then(levels => levels[zoomLevel]);
  }

  parseHead() {
    return this.file.getBytes(0, ZIF.MAX_HEAD_SIZE).then(b => this.parseHeadBytes(b));
  }

  parseHeadBytes(bytes) {
    if (bytes.long(0) !== 0x08002b4949) throw new Error("invalid zif file");
    let levels = [];
    let ptr = 0x8;
    while ( ptr > 0 && ptr < ZIF.MAX_HEAD_SIZE) {
      ptr = bytes.long(ptr);
      let nTags = bytes.long(ptr);
      let level = new ZoomLevel(this.file);
      levels.push(level);
      let end = ptr + 8 + 20 * nTags;
      for(ptr += 8; ptr < end; ptr += 20) {
        level.set(bytes.short(ptr), bytes.long(ptr + 4), bytes.long(ptr + 12));
      }
    }
    return levels;
  }
  static MAX_HEAD_SIZE = 2000;
}

class ZoomLevel {
  constructor(file) {
    this.file = file;
    this.meta = new Map();<commit_msg>Change MAX_HEAD_SIZE<commit_after>class ZIF {

  constructor(file) {
    this.file = file;
    this.head = this.parseHead(); // A promise for the header
  }

  getTile(x, y, zoomLevel) {
    return this.getLevel(zoomLevel).then(level => level.getTile(x,y));
  }

  getLevel(zoomLevel) {
    return this.head.then(levels => levels[zoomLevel]);
  }

  parseHead() {
    return this.file.getBytes(0, ZIF.MAX_HEAD_SIZE).then(b => this.parseHeadBytes(b));
  }

  parseHeadBytes(bytes) {
    if (bytes.long(0) !== 0x08002b4949) throw new Error("invalid zif file");
    let levels = [];
    let ptr = 0x8;
    while ( ptr > 0 && ptr < ZIF.MAX_HEAD_SIZE) {
      ptr = bytes.long(ptr);
      let nTags = bytes.long(ptr);
      let level = new ZoomLevel(this.file);
      levels.push(level);
      let end = ptr + 8 + 20 * nTags;
      for(ptr += 8; ptr < end; ptr += 20) {
        level.set(bytes.short(ptr), bytes.long(ptr + 4), bytes.long(ptr + 12));
      }
    }
    return levels;
  }
  static MAX_HEAD_SIZE = 8192;
}

class ZoomLevel {
  constructor(file) {
    this.file = file;
    this.meta = new Map();
{'fraction_non_alphanumeric': 0.15447523852794184, 'fraction_numerical': 0.025442980463425715, 'mean_word_length': 2.7705479452054793, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, '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': '6547890', 'n_tokens_mistral': 840, 'n_tokens_neox': 786, 'n_words': 172}