<commit_before>require 'boxcar/helpers'
require 'boxcar/api/smart'
require 'inifile'

class Boxcar::Disk
  extend  Boxcar::Helpers
  include Boxcar::Helpers
  include Boxcar::Smart

  attr_accessor :name, :color, :device, :id

  def self.all
    parse_ini('disks').to_h.map { |disk|
      new disk[1]
    }
  end

  def self.find(name)
    new parse_ini('disks').to_h[name]
  end

  def initialize(args = {})
    args.each do |k, v|
      break if /temp/ =~ k
      instance_variable_set("@#{k}", v) unless v.nil?
    end
  end

  def state
    states = disk_states

    case color
    when /blink/
      states[5]
    when /green/
      states[0]
    when /yellow/
      states[1]
    when /red/
      states[2]
    when /blue/
      states[3]
    when /grey/
      states[4]
    end
  end

  def active?
    state != "standby"
  end

  def assigned?
    state != "unassigned"
  end

  def size
    to_bytes @sizeSb || @fsSize
  end

  def free
    to_bytes @fsFree
  end

  def temp
    @temp ||= temperature
  end

  def flash?
    name == 'flash'
  end

private

  def disk_states
    %w(active invalid disabled new unassigned standby)
  end
end
<commit_msg>Didn't mean to break early<commit_after>require 'boxcar/helpers'
require 'boxcar/api/smart'
require 'inifile'

class Boxcar::Disk
  extend  Boxcar::Helpers
  include Boxcar::Helpers
  include Boxcar::Smart

  attr_accessor :name, :color, :device, :id

  def self.all
    parse_ini('disks').to_h.map { |disk|
      new disk[1]
    }
  end

  def self.find(name)
    new parse_ini('disks').to_h[name]
  end

  def initialize(args = {})
    args.each do |k, v|
      unless v.nil? or /temp/ =~ k
        instance_variable_set("@#{k}", v)
      end
    end
  end

  def state
    states = disk_states

    case color
    when /blink/
      states[5]
    when /green/
      states[0]
    when /yellow/
      states[1]
    when /red/
      states[2]
    when /blue/
      states[3]
    when /grey/
      states[4]
    end
  end

  def active?
    state != "standby"
  end

  def assigned?
    state != "unassigned"
  end

  def size
    to_bytes @sizeSb || @fsSize
  end

  def free
    to_bytes @fsFree
  end

  def temp
    @temp ||= temperature
  end

  def flash?
    name == 'flash'
  end

private

  def disk_states
    %w(active invalid disabled new unassigned standby)
  end
end

{'fraction_non_alphanumeric': 0.107981220657277, 'fraction_numerical': 0.00597524541186513, 'mean_word_length': 2.233103448275862, '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': '5593324', 'n_tokens_mistral': 878, 'n_tokens_neox': 851, 'n_words': 234}