<commit_before>#!/usr/bin/env ruby
require 'net/http'
require 'json'

class Gist
  attr_accessor :id, :description, :public, :files
  def initialize(hash)
    @id = hash[:id]
    @description = hash[:description]
    @public = hash[:public]
    @files = hash[:files] || {}
  end

  def to_hash
    hash = {
      :description => @description,
      :public => @public,
      :files => @files,
    }
    hash[:id] = @id if not @id.nil?

    hash
  end

  def to_json(*a)
    self.to_hash.to_json(*a)
  end

  def [](name)
    @files[name]
  end

  def []=(name, body)
    if @files[name].nil? then
      @files[name] = {}
    end
    @files[name][:content] = body
  end

  def self.json_create(hash)
    files = {}
    hash[:files].each do |k,v|
      files[k.to_s] = {:content => v[:content]}
    end

    hash[:files] = files

    new(hash)
  end
end

class Gists<commit_msg>Fix subscript error in Gist library.<commit_after>#!/usr/bin/env ruby
require 'net/http'
require 'json'

class Gist
  attr_accessor :id, :description, :public, :files
  def initialize(hash)
    @id = hash[:id]
    @description = hash[:description]
    @public = hash[:public]
    @files = hash[:files] || {}
  end

  def to_hash
    hash = {
      :description => @description,
      :public => @public,
      :files => @files,
    }
    hash[:id] = @id if not @id.nil?

    hash
  end

  def to_json(*a)
    self.to_hash.to_json(*a)
  end

  def [](name)
    @files[name][:content]
  end

  def []=(name, body)
    if @files[name].nil? then
      @files[name] = {}
    end
    @files[name][:content] = body
  end

  def self.json_create(hash)
    files = {}
    hash[:files].each do |k,v|
      files[k.to_s] = {:content => v[:content]}
    end

    hash[:files] = files

    new(hash)
  end
end

class Gists
{'fraction_non_alphanumeric': 0.16134453781512606, 'fraction_numerical': 0.0, 'mean_word_length': 2.5935613682092553, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '541565', 'n_tokens_mistral': 677, 'n_tokens_neox': 654, 'n_words': 156}