<commit_before>class CraftingManager
  attr_accessor :recipes
  attr_accessor :manager

  def initialize(manager = nil, recipes = Hash.new(nil))
    @recipes = recipes
    @manager = manager
  end

  def add_recipe!(ingredients, product)
    @recipes[ingredients] = product
    return self
  end

  def add_recipe(ingredients, product)
    self.clone.add_recipe!(ingredients, product)
  end

  def craft(ingredients, first = false, manager = @manager)
    if manager == nil then raise 'Did not provide a manager for this CraftingManager craft operation' end

    product = @recipes[ingredients]
    product.count = 1
    if check(ingredients)
      if product != nil
        if first
          manager.sub_managers[product.name] = product
        else
          manager.produce!(product.name, 1)
        end
      end

      ingredients.each do |key, amount|
        manager.use!(key, amount)
      end
      return true
    end
    return false
  end

  def check(ingredients, manager = @manager)
    if manager == nil then raise 'Did not provide a manager for this CraftingManager check' end
    result = true
    threads = []

    ingredients.each do |key, count|<commit_msg>Another small fix<commit_after>class CraftingManager
  attr_accessor :recipes
  attr_accessor :manager

  def initialize(manager = nil, recipes = Hash.new(nil))
    @recipes = recipes
    @manager = manager
  end

  def add_recipe!(ingredients, product)
    @recipes[ingredients] = product
    return self
  end

  def add_recipe(ingredients, product)
    self.clone.add_recipe!(ingredients, product)
  end

  def craft(ingredients, first = false, manager = @manager)
    if manager == nil then raise 'Did not provide a manager for this CraftingManager craft operation' end

    product = @recipes[ingredients]
    product.count = 1
    if check(ingredients)
      if product != nil
        if first
          manager.add_manager! product
        else
          manager.produce!(product.name, 1)
        end
      end

      ingredients.each do |key, amount|
        manager.use!(key, amount)
      end
      return true
    end
    return false
  end

  def check(ingredients, manager = @manager)
    if manager == nil then raise 'Did not provide a manager for this CraftingManager check' end
    result = true
    threads = []

    ingredients.each do |key, count|
{'fraction_non_alphanumeric': 0.07721843003412969, 'fraction_numerical': 0.0017064846416382253, 'mean_word_length': 2.80064829821718, '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': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1040133', 'n_tokens_mistral': 698, 'n_tokens_neox': 663, 'n_words': 219}