<commit_before>require "rubygems"
gem "selenium-client"
require "selenium/client"
require "open-uri"
require "nokogiri"
require "log4r"
include Log4r
begin
  require "chunky_png"
rescue
end
require "base64"

module KaikiFS
end

class KaikiFS::Driver
  attr_reader :selenium_driver, :env, :username, :screenshot_dir
  attr_accessor :pause, :record
  alias :page :selenium_driver
  LOGFILE = "loggy-log"
  ENVS_FILE = "envs.json"
  SCREEN_SHOT_DIR = File.join(File.dirname(__FILE__), '..', '..', 'public', 'images')
  extend Forwardable
  def_delegators :@selenium_driver, :click, :get_text, :stop, :wait_for_text, :window_maximize

  def initialize(username, password, options={})
    @username = username
    @password = password

    @standard_envs = JSON.parse(IO.readlines(ENVS_FILE).map{ |l| l.gsub(/[\r\n]/, '') }.join(""))
    @envs = options[:envs] ?
      @standard_envs.select { |k,v| options[:envs].include? k } :
      @standard_envs

    if @envs.keys.size == 1
      @env = @envs.keys.first
    end

    @screen_shot_dir = options[:screen_shot_dir] || SCREEN_SHOT_DIR
    @pause = options[:pause] || 0.2

    unlink_old_screenshots

    @threads = []
    @record = {}  # record is a hash containing notes that the "user" needs to keep, like the document number he just created.

    @stderr_log = File.join(Dir::pwd, 'features', 'stderr', Time.now.strftime("%Y.%m.%d-%H.%M.%S"))
  end

  def unlink_old_screenshots
    Dir["public/images/main_*"].each { |image| File.unlink(image) }
    Dir["public/images/cropped_*"].each { |image| File.unlink(image) }
    Dir["public/images/account_1080000_*"].each { |image| File.unlink(image) }
  end

  ##### THIN WRAPPERS
  def hide_tab(name)
    page.click "tab-#{name}-imageToggle"
  end

  def show_tab(name)
    #page.click "tab-#{name}-imageToggle"
    page.click "//input[@title='open #{name}']"
  end
<commit_msg>Added more kaikifs delegators<commit_after>require "rubygems"
gem "selenium-client"
require "selenium/client"
require "open-uri"
require "nokogiri"
require "log4r"
include Log4r
begin
  require "chunky_png"
rescue
end
require "base64"

module KaikiFS
end

class KaikiFS::Driver
  attr_reader :selenium_driver, :env, :username, :screenshot_dir
  attr_accessor :pause, :record
  alias :page :selenium_driver
  LOGFILE = "loggy-log"
  ENVS_FILE = "envs.json"
  SCREEN_SHOT_DIR = File.join(File.dirname(__FILE__), '..', '..', 'public', 'images')
  extend Forwardable
  def_delegators :@selenium_driver, :check, :click, :get_text, :stop, :uncheck, :wait_for_text, :window_maximize

  def initialize(username, password, options={})
    @username = username
    @password = password

    @standard_envs = JSON.parse(IO.readlines(ENVS_FILE).map{ |l| l.gsub(/[\r\n]/, '') }.join(""))
    @envs = options[:envs] ?
      @standard_envs.select { |k,v| options[:envs].include? k } :
      @standard_envs

    if @envs.keys.size == 1
      @env = @envs.keys.first
    end

    @screen_shot_dir = options[:screen_shot_dir] || SCREEN_SHOT_DIR
    @pause = options[:pause] || 0.2

    unlink_old_screenshots

    @threads = []
    @record = {}  # record is a hash containing notes that the "user" needs to keep, like the document number he just created.

    @stderr_log = File.join(Dir::pwd, 'features', 'stderr', Time.now.strftime("%Y.%m.%d-%H.%M.%S"))
  end

  def unlink_old_screenshots
    Dir["public/images/main_*"].each { |image| File.unlink(image) }
    Dir["public/images/cropped_*"].each { |image| File.unlink(image) }
    Dir["public/images/account_1080000_*"].each { |image| File.unlink(image) }
  end

  ##### THIN WRAPPERS
  def hide_tab(name)
    #page.click "tab-#{name}-imageToggle"
    page.click "//input[@title='close #{name}']"
  end

  def show_tab(name)
    #page.click "tab-#{name}-imageToggle"
    page.click "//input[@title='open #{name}']"
  end

{'fraction_non_alphanumeric': 0.15848563968668408, 'fraction_numerical': 0.007310704960835509, 'mean_word_length': 4.067460317460317, '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': '6848283', 'n_tokens_mistral': 1450, 'n_tokens_neox': 1393, 'n_words': 290}