<commit_before>require 'digest/sha1'

class ObjectStore
  TIME_FORMAT = "%a %b %d %H:%M %Y %z".freeze

  attr_accessor :current_branch, :stage, :store

  def initialize()
    @current_branch = :master
    @stage = {}
    @objects_changed = 0
    @store = {master: []}
  end

  def self.init()
    new_store = new
    new_store.instance_eval(&Proc.new) if block_given?
    new_store
  end

  class Outcome
    attr_reader :message, :result

    def initialize(message, success, result = nil)
      @message = message
      @success = success
      @result = result
    end

    def success?
      @success
    end

    def error?
      not @success
    end
  end

  class Commit
    attr_reader :date, :message, :hash, :stage

    def initialize(date, message, hash, stage)
      @date = date
      @message = message
      @hash = hash
      @stage = stage
    end

    def objects
      @stage.values
    end
  end

  def add(name, object)
    @stage[name] = object
    @objects_changed += 1
    Outcome.new("Added #{name} to stage.", true, object)
  end

  def remove(name)
    if @stage.has_key?(name)
      removed_object = @stage[name]
      @stage.delete(name)
      @objects_changed += 1
      Outcome.new("Added #{removed_object} for removal.", true, removed_object)
    else
      Outcome.new("Object #{name} is not committed.", false)
    end
  end<commit_msg>Fixed solution for task 05 to pass all official tests<commit_after>require 'digest/sha1'

class ObjectStore
  TIME_FORMAT = "%a %b %d %H:%M %Y %z".freeze

  attr_accessor :current_branch, :stage, :store

  def initialize()
    @current_branch = :master
    @stage = {}
    @objects_changed = 0
    @store = {master: []}
  end

  def self.init()
    new_store = new
    new_store.instance_eval(&Proc.new) if block_given?
    new_store
  end

  class Outcome
    attr_reader :message, :result

    def initialize(message, success, result = nil)
      @message = message
      @success = success
      @result = result
    end

    def success?
      @success
    end

    def error?
      not @success
    end
  end

  class Commit
    attr_reader :date, :message, :hash, :stage

    def initialize(date, message, hash, stage)
      @date = date
      @message = message
      @hash = hash
      @stage = stage
    end

    def objects
      @stage.values
    end
  end

  def add(name, object)
    @stage[name] = object
    @objects_changed += 1
    Outcome.new("Added #{name} to stage.", true, object)
  end

  def remove(name)
    if @stage.has_key?(name)
      removed_object = @stage[name]
      @stage.delete(name)
      @objects_changed += 1
      Outcome.new("Added #{name} for removal.", true, removed_object)
    else
      Outcome.new("Object #{name} is not committed.", false)
    end
  end
{'fraction_non_alphanumeric': 0.10902527075812274, 'fraction_numerical': 0.0036101083032490976, 'mean_word_length': 2.516497461928934, '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': '6471305', 'n_tokens_mistral': 916, 'n_tokens_neox': 884, 'n_words': 258}