<commit_before>require "erb"
require "yaml"

def fixture(name)
  spec_root = File.expand_path("..", File.dirname(__FILE__))
  fixture_path = File.join(spec_root, "fixtures", "#{name}.yml")
  content = File.read(fixture_path)
  template = ERB.new(content)
  yaml = template.result(binding)
  YAML.safe_load(yaml, permitted_classes: [Symbol])<commit_msg>Call YAML.safe_load differently according to required parameters<commit_after>require "erb"
require "yaml"

def fixture(name)
  spec_root = File.expand_path("..", File.dirname(__FILE__))
  fixture_path = File.join(spec_root, "fixtures", "#{name}.yml")
  content = File.read(fixture_path)
  template = ERB.new(content)
  yaml = template.result(binding)
  parameters = YAML.method(:safe_load).parameters
  has_permitted_classes = parameters.find { |(type, name)| name == :permitted_classes }
  if has_permitted_classes
    YAML.safe_load(yaml, permitted_classes: [Symbol])
  else
    YAML.safe_load(yaml, [Symbol])
  end
{'fraction_non_alphanumeric': 0.13711340206185568, 'fraction_numerical': 0.0, 'mean_word_length': 5.696551724137931, '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': '5076296', 'n_tokens_mistral': 335, 'n_tokens_neox': 325, 'n_words': 63}