<commit_before>module Timber
  class Log
    def initialize(f)
      @file = f.is_a?(String) ? File.open(f, 'r') : f
      @line = nil
      @name = File.basename(@file.path).sub(/\..*$/, '')
    end
    
    attr_reader :current, :name

    def shift
      @current = Request.new
      # leftover line from parsing the previous request
      @current << @line if @line
      # take all lines until the next Processing line, which stays for the next shift
      while @line = @file.gets
        if @line.match(/^Processing/) and not @current.lines.empty?
          return current
        elsif @line != "\n"
          @current << @line
        end<commit_msg>discarb junk at the top of the file before the first request<commit_after>module Timber
  class Log
    def initialize(f)
      @file = f.is_a?(String) ? File.open(f, 'r') : f
      @line = nil
      @name = File.basename(@file.path).sub(/\..*$/, '')

      # discard any comments or junk at the top of the file
      until @line.to_s.match(/^Processing/)
        @line = @file.gets
      end
    end
    
    attr_reader :current, :name

    def shift
      @current = Request.new
      # leftover line from parsing the previous request
      @current << @line if @line
      # take all lines until the next Processing line, which stays for the next shift
      while @line = @file.gets
        if @line.match(/^Processing/) and not @current.lines.empty?
          return current
        elsif @line != "\n"
          @current << @line
        end
{'fraction_non_alphanumeric': 0.11479761114797611, 'fraction_numerical': 0.0, 'mean_word_length': 2.128630705394191, 'pattern_counts': {'":': 0, '<': 11, '<?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': '5477738', 'n_tokens_mistral': 457, 'n_tokens_neox': 445, 'n_words': 154}