<commit_before>require 'redis'
require 'json'
require 'aws-sdk'
require 'yaml'
require 'pry'
require 'aws-cache-version'
require 'awesome_print'

class AwsCache
  # Please follow semantic versioning (semver.org).
  VERSION = AwsCacheVersion::VERSION

  def initialize(opts)
    unless opts.has_key?('port') then opts['port'] = 6379 end
    unless opts.has_key?('host') then opts['host'] = 'aws-cache' end
    @redis = optional_element(opts, ['redis'])
    if @redis.nil?
      @redis = Redis.new(url: "redis://#{opts['host']}:#{opts['port']}/0")
    end
    @keyspace = optional_element(opts, ['keyspace'], AwsCache::VERSION)
    @region = optional_element(opts, ['region'], 'us-east-1')
  end

  def describe_instance( instance_id)
    instances = self.describe_instances()
    instances.each do |instance|
      ap instance
      if instance[:instances][0] == instance_id then
        ap instance[:instances][0]
      end
    end
    return instances<commit_msg>Added desribe_instance function.<commit_after>require 'redis'
require 'json'
require 'aws-sdk'
require 'yaml'
require 'pry'
require 'aws-cache-version'
require 'awesome_print'

class AwsCache
  # Please follow semantic versioning (semver.org).
  VERSION = AwsCacheVersion::VERSION

  def initialize(opts)
    unless opts.has_key?('port') then opts['port'] = 6379 end
    unless opts.has_key?('host') then opts['host'] = 'aws-cache' end
    @redis = optional_element(opts, ['redis'])
    if @redis.nil?
      @redis = Redis.new(url: "redis://#{opts['host']}:#{opts['port']}/0")
    end
    @keyspace = optional_element(opts, ['keyspace'], AwsCache::VERSION)
    @region = optional_element(opts, ['region'], 'us-east-1')
  end

  def describe_instance( instance_id)
    instances = self.describe_instances()
    instances.each do |instance|
      if instance[:instances][0][:instance_id] == instance_id then
        return instance[:instances][0]
      end
    end
    return nil
{'fraction_non_alphanumeric': 0.14734672849046884, 'fraction_numerical': 0.00824317362184441, 'mean_word_length': 4.164893617021277, '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': '1598877', 'n_tokens_mistral': 643, 'n_tokens_neox': 634, 'n_words': 149}