<commit_before>require 'aws-sdk'

module CloudwatchCommon
  def client
    Aws::CloudWatch::Client.new
  end

  def read_value(resp, stats)
    resp.datapoints.first.send(stats.downcase)
  end

  def resp_has_no_data(resp, stats)
    resp.datapoints.nil? || resp.datapoints.length.empty? || resp.datapoints.first.nil? || read_value(resp, stats).nil?
  end

  def compare(value, threshold, compare_method)
    case compare_method
    when 'greater'
      value > threshold
    when 'less'
      value < threshold
    when 'not'
      value != threshold
    else
      value == threshold
    end<commit_msg>not checking length, just using empty<commit_after>require 'aws-sdk'

module CloudwatchCommon
  def client
    Aws::CloudWatch::Client.new
  end

  def read_value(resp, stats)
    resp.datapoints.first.send(stats.downcase)
  end

  def resp_has_no_data(resp, stats)
    resp.datapoints.nil? || resp.datapoints.empty? || resp.datapoints.first.nil? || read_value(resp, stats).nil?
  end

  def compare(value, threshold, compare_method)
    case compare_method
    when 'greater'
      value > threshold
    when 'less'
      value < threshold
    when 'not'
      value != threshold
    else
      value == threshold
    end
{'fraction_non_alphanumeric': 0.09942950285248574, 'fraction_numerical': 0.0, 'mean_word_length': 3.2199312714776633, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4429461', 'n_tokens_mistral': 407, 'n_tokens_neox': 398, 'n_words': 92}