<commit_before>module PNG
  class IHDR < Chunk
    SUPPORTED_COLOR_TYPES = [2,3,6]
    attr_accessor :width, :height, :depth, :color_type
    # attr_accessor :compression_method, :filter_method, :interlace_method
    
    def self.new_from_raw( data )
      raw = data.unpack("N2C5")
      
      new( *raw[0..3] )
    end
    
    def initialize( width, height, depth=8, color_type=2 )
      raise "for now, spittle only supports images with a bit depth of 8" unless depth == 8
      unless SUPPORTED_COLOR_TYPES.include? color_type
        raise "for now, spittle only supports color types #{SUPPORTED_COLOR_TYPES.JOIN(',')} color type was #{color_type}"
      end
      @width, @height, @depth, @color_type = width, height, depth, color_type
    end
    
    def encode
      to_a.pack("N2C5")
    end
    
    def to_a
      [@width, @height, @depth, @color_type, 0, 0, 0]
    end
    
    def chunk_name
      "IHDR"
    end
  end
end<commit_msg>putting in warning for interlaced images<commit_after>module PNG
  class IHDR < Chunk
    SUPPORTED_COLOR_TYPES = [2,3,6]
    attr_accessor :width, :height, :depth, :color_type
    # attr_accessor :compression_method, :filter_method, :interlace_method

    def self.new_from_raw( data )
      raw = data.unpack("N2C5")

      new( *raw[0..6] )
    end

    def initialize( width, height, depth=8, color_type=2, compression=0, filter=0, interlace=0 )
      raise "for now, spittle only supports non-interlaced images" unless interlace == 0
      raise "for now, spittle only supports images with a bit depth of 8" unless depth == 8
      unless SUPPORTED_COLOR_TYPES.include? color_type
        raise "for now, spittle only supports color types #{SUPPORTED_COLOR_TYPES.JOIN(',')} color type was #{color_type}"
      end
      @width, @height, @depth, @color_type = width, height, depth, color_type
    end

    def encode
      to_a.pack("N2C5")
    end

    def to_a
      [@width, @height, @depth, @color_type, 0, 0, 0]
    end

    def chunk_name
      "IHDR"
    end
  end
end
{'fraction_non_alphanumeric': 0.10147783251231528, 'fraction_numerical': 0.017733990147783252, 'mean_word_length': 2.936046511627907, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1842300', 'n_tokens_mistral': 720, 'n_tokens_neox': 694, 'n_words': 202}