<commit_before>module Puppet::Parser::Functions
    newfunction(:hiera_hash, :type => :rvalue) do |*args|
        if args[0].is_a?(Array)
            args = args[0]
        end

        key = args[0]
        default = args[1]
        override = args[2]

        configfile = File.join([File.dirname(Puppet.settings[:config]), "hiera.yaml"])

        raise(Puppet::ParseError, "Hiera config file #{configfile} not readable") unless File.exist?(configfile)
        raise(Puppet::ParseError, "You need rubygems to use Hiera") unless Puppet.features.rubygems?

        require 'hiera'
        require 'hiera/scope'

        config = YAML.load_file(configfile)
        config[:logger] = "puppet"<commit_msg>Fail if a lookup key isn't passed<commit_after>module Puppet::Parser::Functions
    newfunction(:hiera_hash, :type => :rvalue) do |*args|
        if args[0].is_a?(Array)
            args = args[0]
        end

        raise(Puppet::ParseError, "Please supply a parameter to perform a Hiera lookup") if args.empty?

        key = args[0]
        default = args[1]
        override = args[2]

        configfile = File.join([File.dirname(Puppet.settings[:config]), "hiera.yaml"])

        raise(Puppet::ParseError, "Hiera config file #{configfile} not readable") unless File.exist?(configfile)
        raise(Puppet::ParseError, "You need rubygems to use Hiera") unless Puppet.features.rubygems?

        require 'hiera'
        require 'hiera/scope'

        config = YAML.load_file(configfile)
        config[:logger] = "puppet"
{'fraction_non_alphanumeric': 0.12688031393067364, 'fraction_numerical': 0.006540222367560497, 'mean_word_length': 2.9130434782608696, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '1677684', 'n_tokens_mistral': 490, 'n_tokens_neox': 477, 'n_words': 111}