<commit_before>class Hiera
    module Backend
        class Sf_hiera_aws_backend
            private

            @instance_identity = nil

            def read_link_local_data
                require 'net/http'
                require 'json'

                begin
                    http = Net::HTTP.new('169.254.169.254', 80)
                    http.open_timeout = 1
                    http.read_timeout = 1
                    @instance_identity = JSON.parse(http.request(Net::HTTP::Get.new('/latest/dynamic/instance-identity/document')).body)
                rescue Errno::EHOSTUNREACH, Net::OpenTimeout, Timeout::Error
                    Hiera.warn('No link-local endpoint - can\'t calculate region')
                rescue JSON::ParserError => e
                    Hiera.warn('JSON Parse error - probably not in AWS')
                rescue => e
                    Hiera.warn("Exception while finding instance identity: #{e.inspect}"
                end
            end

            # Wrapped these in getters for dependency injection purposes
            def get_rds_client
                Aws::RDS::Client.new
            end

            def get_ec2_client
                Aws::EC2::Client.new
            end

            def get_elasticache_client
                Aws::ElastiCache::Client.new
            end

            public<commit_msg>Remove excess error catching<commit_after>class Hiera
    module Backend
        class Sf_hiera_aws_backend
            private

            @instance_identity = nil

            def read_link_local_data
                require 'net/http'
                require 'json'

                begin
                    http = Net::HTTP.new('169.254.169.254', 80)
                    http.open_timeout = 1
                    http.read_timeout = 1
                    @instance_identity = JSON.parse(http.request(Net::HTTP::Get.new('/latest/dynamic/instance-identity/document')).body)
                rescue Errno::EHOSTUNREACH, Net::OpenTimeout, Timeout::Error
                    Hiera.warn('No link-local endpoint - can\'t calculate region')
                rescue JSON::ParserError
                    Hiera.warn('JSON Parse error - probably not in AWS')
                rescue => e
                    Hiera.warn("Exception while finding instance identity: #{e.inspect}"
                end
            end

            # Wrapped these in getters for dependency injection purposes
            def get_rds_client
                Aws::RDS::Client.new
            end

            def get_ec2_client
                Aws::EC2::Client.new
            end

            def get_elasticache_client
                Aws::ElastiCache::Client.new
            end

            public
{'fraction_non_alphanumeric': 0.0748349229640499, 'fraction_numerical': 0.013206162876008804, 'mean_word_length': 1.3671875, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '3004713', 'n_tokens_mistral': 718, 'n_tokens_neox': 651, 'n_words': 153}