<commit_before>;(function() {
  Turtle = function(element, w, h) {
    var x = w / 2
    var y = h / 2
    var pendown = true

    element.css({position: "relative", width: w, height: h})
    var paper = createCanvas(0)
    var turtle = createCanvas(1)
    turtle.clearRect(0, 0, w, h)

    paper.translate(x, y);
    turtle.translate(x, y);

    drawTurtle()
    function createCanvas(zIndex) {
      var canvas = $("<canvas></canvas>").attr("width", w).attr("height", h)
      canvas.css({position: "absolute", left: 0, right: 0})
      canvas.css({"z-index": zIndex})
      element.append(canvas)
      return canvas.get(0).getContext('2d');
    }
    function clearTurtle() {
      turtle.clearRect(-10, -10, 21, 21)
    }
    function drawTurtle() {
      turtle.beginPath(); 
      turtle.moveTo(0, -10);
      turtle.lineTo(5, 10);
      turtle.lineTo(-5, 10);
      turtle.lineTo(0, -10);
      turtle.stroke();
    }
    var queue = []
    var polling = false
    var delay = 1

    function enqueue(f) {
      queue.push(f)
      schedule()
    }

    function schedule() {
      if (!polling) {
        polling = true
        setTimeout(checkQueue, delay)
      }
    }

    function checkQueue() {
      polling = false
      var chunk = Math.max(1, queue.length / 100)
      var left = chunk
      while (left > 0 && queue.length > 0) {
        var first = queue.splice(0,1)[0]
        first()
        left--
      }
      if (queue.length > 0) {
        schedule()
      }
    }

    function delayed(f) {
      return function() {
        var args = arguments
        var command = function() {
          f.apply(null, args)
        }
        enqueue(command)
      };
    }
    function repeat(times, f) {
      if (times > 0) {
        f()
        repeat(times - 1, f)
      }
    }
    function stepper(total, step, f) {
      if (total < 0) step = -step
      function delayedStep(s) {
        return function() {
          enqueue(function() {
            f(s)
          })
        }
      }
      repeat(Math.floor(Math.abs(total / step)), delayedStep(step))
      var remainder = total % step
      if (remainder) {
        delayedStep(remainder)()
      }
    }

    var api = {
      fd: function(dist) {
        stepper(dist, 5, function(step) {
          if (pendown) {
            paper.beginPath()
            paper.moveTo(0, 0)
            paper.lineTo(0, -step)
            paper.stroke()
          }
          clearTurtle()
          paper.translate(0, -step)
          turtle.translate(0, -step)
          drawTurtle()
        })
      },
      lt: function(angle) {
        this.rt(-angle)
      },
      rt: function(angle) {
        stepper(angle, 10, function(a) {
          clearTurtle()
          paper.rotate(a * Math.PI / 180)
          turtle.rotate(a * Math.PI / 180)
          drawTurtle()
        })
      },
      pendown: delayed(function() {
        pendown = true
      }),
      penup: delayed(function() {
        pendown = false
      }),
      spin: function(degrees, delay) {
        this.lt(360)
      }
    }
    return api
  }
})()<commit_msg>cleanup<commit_after>;(function() {
  Turtle = function(element, w, h) {
    var x = w / 2
    var y = h / 2
    var pendown = true

    element.css({position: "relative", width: w, height: h})
    var paper = createCanvas(0)
    var turtle = createCanvas(1)
    turtle.clearRect(0, 0, w, h)

    paper.translate(x, y);
    turtle.translate(x, y);

    drawTurtle()
    function createCanvas(zIndex) {
      var canvas = $("<canvas></canvas>").attr("width", w).attr("height", h)
      canvas.css({position: "absolute", left: 0, right: 0})
      canvas.css({"z-index": zIndex})
      element.append(canvas)
      return canvas.get(0).getContext('2d');
    }
    function clearTurtle() {
      turtle.clearRect(-10, -10, 21, 21)
    }
    function drawTurtle() {
      turtle.beginPath(); 
      turtle.moveTo(0, -10);
      turtle.lineTo(5, 10);
      turtle.lineTo(-5, 10);
      turtle.lineTo(0, -10);
      turtle.stroke();
    }
    var queue = []
    var polling = false
    var delay = 1

    function enqueue(f) {
      queue.push(f)
      schedule()
    }

    function schedule() {
      if (!polling) {
        polling = true
        setTimeout(checkQueue, delay)
      }
    }

    function checkQueue() {
      polling = false
      var chunk = Math.max(1, queue.length / 100)
      var left = chunk
      while (left > 0 && queue.length > 0) {
        var first = queue.splice(0,1)[0]
        first()
        left--
      }
      if (queue.length > 0) {
        schedule()
      }
    }

    function repeat(times, f) {
      if (times > 0) {
        f()
        repeat(times - 1, f)
      }
    }
    function stepper(total, step, f) {
      if (total < 0) step = -step
      function delayedStep(s) {
        return function() {
          enqueue(function() {
            f(s)
          })
        }
      }
      repeat(Math.floor(Math.abs(total / step)), delayedStep(step))
      var remainder = total % step
      if (remainder) {
        delayedStep(remainder)()
      }
    }

    var api = {
      fd: function(dist) {
        stepper(dist, 5, function(step) {
          if (pendown) {
            paper.beginPath()
            paper.moveTo(0, 0)
            paper.lineTo(0, -step)
            paper.stroke()
          }
          clearTurtle()
          paper.translate(0, -step)
          turtle.translate(0, -step)
          drawTurtle()
        })
      },
      lt: function(angle) {
        this.rt(-angle)
      },
      rt: function(angle) {
        stepper(angle, 10, function(a) {
          clearTurtle()
          paper.rotate(a * Math.PI / 180)
          turtle.rotate(a * Math.PI / 180)
          drawTurtle()
        })
      },
      pendown: enqueue(function() {
        pendown = true
      }),
      penup: enqueue(function() {
        pendown = false
      }),
      spin: function(degrees, delay) {
        this.lt(360)
      }
    }
    return api
  }
})()
{'fraction_non_alphanumeric': 0.14259506337558372, 'fraction_numerical': 0.020346897931954638, 'mean_word_length': 1.6406869220607663, 'pattern_counts': {'":': 2, '<': 9, '<?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': '1599511', 'n_tokens_mistral': 2087, 'n_tokens_neox': 1942, 'n_words': 423}