<commit_before>class Fidget::Platform
  def self.current_process(options)
    options = munge(options)
    suspend(options)

    at_exit do
      resume(options)
    end
  end

  def self.prevent_sleep(options)
    options = munge(options)
    suspend(options)

    if block_given?
      yield
      resume(options)
    end

    pid
  end

  def self.allow_sleep(handle)
    options = munge(options)
    resume(options)
  end

  def self.munge(*options)
    options.flatten!
    options.compact!
    options.each do |opt|
      STDERR.puts "Fidget: option {opt} is not supported on Linux" unless [:display, :blanking].include? opt
    end
    options
  end
  #private_class_method :munge

  def self.root_win
    ids = `xwininfo -root`.each_line.collect do |line|
      next unless line =~ /Windows id: (0x\d+)/
      $1
    end.compact
    raise "Parsing xwininfo failed" unless ids.size == 1
    ids.first
  end
  #private_class_method :root_win

  def self.suspend(options)
    if options.include? :display
      system("xdg-screensaver suspend #{root_win}")
      system('xset -dpms')
    end

    if options.include? :blanking
      @@blanking ||= File.read('/sys/module/kernel/parameters/consoleblank').strip
      system('setterm -blank 0 -powerdown 0')
    end
  end<commit_msg>typos<commit_after>class Fidget::Platform
  def self.current_process(options)
    options = munge(options)
    suspend(options)

    at_exit do
      resume(options)
    end
  end

  def self.prevent_sleep(options)
    options = munge(options)
    suspend(options)

    if block_given?
      yield
      resume(options)
    end

    pid
  end

  def self.allow_sleep(handle)
    options = munge(options)
    resume(options)
  end

  def self.munge(*options)
    options.flatten!
    options.compact!
    options = [:display] if options.empty?
    options = [:display, :blanking] if options == [:all]
    options.each do |opt|
      STDERR.puts "Fidget: option {opt} is not supported on Linux" unless [:display, :blanking].include? opt
    end
    options
  end
  #private_class_method :munge

  def self.root_win
    ids = `xwininfo -root`.each_line.collect do |line|
      next unless line =~ /Window id: (0x\d+)/
      $1
    end.compact
    raise "Parsing xwininfo failed" unless ids.size == 1
    ids.first
  end
  #private_class_method :root_win

  def self.suspend(options)
    if options.include? :display
      system("xdg-screensaver suspend #{root_win}")
      system('xset -dpms')
    end

    if options.include? :blanking
      @@blanking ||= File.read('/sys/module/kernel/parameters/consoleblank').strip
      system('setterm -blank 0 -powerdown 0')
    end
  end
{'fraction_non_alphanumeric': 0.10552009012392038, 'fraction_numerical': 0.003755163349605708, 'mean_word_length': 2.833093525179856, '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': '95107', 'n_tokens_mistral': 896, 'n_tokens_neox': 875, 'n_words': 217}