<commit_before>require 'cool.io'

class Thread
  def _eventless_loop
    @_eventless_loop ||= Eventless::Loop.new
  end
end

module Eventless
  class Loop
    attr_reader :running, :fiber

    def self.default
      Thread.current._eventless_loop
    end

    def initialize
      @loop = Coolio::Loop.new
      @fiber = Fiber.new { run }
    end

    def transfer(*args)
      @fiber.transfer(*args)
    end

    def io(mode, io)
      fiber = Fiber.current
      callback = proc { fiber.transfer }
<commit_msg>add optional custom callback for IOWatcher<commit_after>require 'cool.io'

class Thread
  def _eventless_loop
    @_eventless_loop ||= Eventless::Loop.new
  end
end

module Eventless
  class Loop
    attr_reader :running, :fiber

    def self.default
      Thread.current._eventless_loop
    end

    def initialize
      @loop = Coolio::Loop.new
      @fiber = Fiber.new { run }
    end

    def transfer(*args)
      @fiber.transfer(*args)
    end

    def io(mode, io, &callback)
      fiber = Fiber.current
      callback = proc { fiber.transfer } unless callback

{'fraction_non_alphanumeric': 0.08703703703703704, 'fraction_numerical': 0.0, 'mean_word_length': 2.6397306397306397, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7518678', 'n_tokens_mistral': 355, 'n_tokens_neox': 341, 'n_words': 90}