<commit_before>require_relative "includes"
require_relative "logging"

class AwsAssumeRole::Runner
    include AwsAssumeRole::Logging
    extend Dry::Initializer

    param :command, Dry::Types["coercible.array"].member(Dry::Types["strict.string"])
    option :exit_on_error, Dry::Types["strict.bool"], default: proc { true }
    option :expected_exit_code, Dry::Types["strict.int"], default: proc { 0 }
    option :environment, Dry::Types["strict.hash"], default: proc { {} }
    option :credentials, optional: true

    def initialize(params, options = {})
        super(params, options)
        command_to_exec = command.join(" ")
        process_credentials unless credentials.blank?
        system environment, command_to_exec
        exit_status = $CHILD_STATUS.exitstatus
        process_error(exit_status) if exit_status != expected_exit_code
    end

    private

    def nested_credentials
        return nil if options[:config]
    end

    def process_credentials
        cred_env = {
            "AWS_ACCESS_KEY_ID" => credentials.credentials.access_key_id,
            "AWS_SECRET_ACCESS_KEY" => credentials.credentials.secret_access_key,
            "AWS_SESSION_TOKEN" => credentials.credentials.session_token,
        }
        @environment = environment.merge cred_env
    end

    def process_error(exit_status)
        logger.error "#{command} failed with #{exit_status}"
        exit exit_status if exit_on_error
        raise "#{command} failed with #{exit_status}"
    end
end<commit_msg>Delete unused code<commit_after>require_relative "includes"
require_relative "logging"

class AwsAssumeRole::Runner
    include AwsAssumeRole::Logging
    extend Dry::Initializer

    param :command, Dry::Types["coercible.array"].member(Dry::Types["strict.string"])
    option :exit_on_error, Dry::Types["strict.bool"], default: proc { true }
    option :expected_exit_code, Dry::Types["strict.int"], default: proc { 0 }
    option :environment, Dry::Types["strict.hash"], default: proc { {} }
    option :credentials, optional: true

    def initialize(params, options = {})
        super(params, options)
        command_to_exec = command.join(" ")
        process_credentials unless credentials.blank?
        system environment, command_to_exec
        exit_status = $CHILD_STATUS.exitstatus
        process_error(exit_status) if exit_status != expected_exit_code
    end

    private

    def process_credentials
        cred_env = {
            "AWS_ACCESS_KEY_ID" => credentials.credentials.access_key_id,
            "AWS_SECRET_ACCESS_KEY" => credentials.credentials.secret_access_key,
            "AWS_SESSION_TOKEN" => credentials.credentials.session_token,
        }
        @environment = environment.merge cred_env
    end

    def process_error(exit_status)
        logger.error "#{command} failed with #{exit_status}"
        exit exit_status if exit_on_error
        raise "#{command} failed with #{exit_status}"
    end
end
{'fraction_non_alphanumeric': 0.10060975609756098, 'fraction_numerical': 0.0006775067750677507, 'mean_word_length': 3.48103186646434, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '3718767', 'n_tokens_mistral': 845, 'n_tokens_neox': 831, 'n_words': 180}