<commit_before>class PuppetProfiler
  def self.run(num_res)
    output = `puppet agent --test --evaltrace --color=false`.split("\n")

    times = []
    resources = output.select { |line| 
      line =~ /.+: E?valuated in [\d\.]+ seconds$/
    }.each { |line|
      res_line, junk, eval_line = line.rpartition(':')
      if eval_line =~ / E?valuated in ([\d\.]+) seconds$/
        time = $1.to_f
      end
      junk, junk, res_line = res_line.partition(':')
      if res_line =~ /.*([A-Z][^\[]+)\[(.+?)\]$/
        type = $1
        title = $2
      end
      times << [type, title, time]
    }

    puts "Top #{num_res} Puppet resources by runtime"
    puts "=================================="<commit_msg>Use more complex regular expression instead of partititon and rpartition, which are not available in ruby 1.8.5.<commit_after>class PuppetProfiler
  def self.run(num_res)
    output = `puppet agent --test --evaltrace --color=false`.split("\n")

    times = []
    output.each { |line|
      if line =~ /info: .*([A-Z][^\[]+)\[(.+?)\]: Evaluated in ([\d\.]+) seconds$/
        type = $1
        title = $2
        time = $3.to_f
        times << [type, title, time]
      end
    }

    puts "Top #{num_res} Puppet resources by runtime"
    puts "=================================="
{'fraction_non_alphanumeric': 0.22420480993017844, 'fraction_numerical': 0.0069821567106283944, 'mean_word_length': 2.4126984126984126, 'pattern_counts': {'":': 0, '<': 7, '<?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': '733269', 'n_tokens_mistral': 447, 'n_tokens_neox': 432, 'n_words': 114}