<commit_before># encoding: UTF-8

require 'sys/proctable'
require 'colored'
require 'thread'
require 'English'

# Main interface
class Restartable
  def self.version
    Gem.loaded_specs['restartable'].version.to_s rescue 'DEV'
  end

  def initialize(options = {}, &block)
    @on_restart = Array(options[:on_restart])
    @block = block
    run!
  end

private

  def run!
    Signal.trap('INT'){ interrupt! }
    Signal.trap('TERM'){ terminate! }

    until @stop
      @interrupted = nil
      $stderr << "^C to restart, double ^C to stop\n".green<commit_msg>add missing require 'timeout'<commit_after># encoding: UTF-8

require 'sys/proctable'
require 'colored'
require 'thread'
require 'timeout'
require 'English'

# Main interface
class Restartable
  def self.version
    Gem.loaded_specs['restartable'].version.to_s rescue 'DEV'
  end

  def initialize(options = {}, &block)
    @on_restart = Array(options[:on_restart])
    @block = block
    run!
  end

private

  def run!
    Signal.trap('INT'){ interrupt! }
    Signal.trap('TERM'){ terminate! }

    until @stop
      @interrupted = nil
      $stderr << "^C to restart, double ^C to stop\n".green
{'fraction_non_alphanumeric': 0.12931034482758622, 'fraction_numerical': 0.0017241379310344827, 'mean_word_length': 3.607142857142857, 'pattern_counts': {'":': 0, '<': 7, '<?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': '2926098', 'n_tokens_mistral': 401, 'n_tokens_neox': 386, 'n_words': 102}