<commit_before>module PhotoBrowser
  class Filesystem
    BASE_PATH = 'public/photos'

    def self.years
      @years ||= Dir["#{BASE_PATH}/*"].select {|f| File.directory?(f) && File.basename(f) =~ /\A\d+\Z/ }.map {|f| File.basename f }
    end


    def self.months(year)
      raise StoreInvalidYearError, "#{year} is invalid" unless File.directory? "#{BASE_PATH}/#{year}"
        
      Dir["#{BASE_PATH}/#{year}/*"].select {|f| File.directory?(f) }.map {|f| File.basename f }
    end

    def self.photos(year, month)
      raise StoreInvalidYearError, "#{year} is invalid" unless File.directory? "#{BASE_PATH}/#{year}"
      raise StoreInvalidMonthError, "#{month} is invalid" unless File.directory? "#{BASE_PATH}/#{year}/#{month}"

      Dir["#{BASE_PATH}/#{year}/#{month}/*"].select {|f| File.file? f }.map {|f| File.basename f }
    end

    def self.photo(year, month, photo)
      raise StoreInvalidYearError, "#{year} is invalid" unless File.directory? "#{BASE_PATH}/#{year}"
      raise StoreInvalidMonthError, "#{month} is invalid" unless File.directory? "#{BASE_PATH}/#{year}/#{month}"
      raise StoreInvalidPhotoError, "#{photo} is invalid" unless File.file? "#{BASE_PATH}/#{year}/#{month}/#{photo}"

      photo
    end

  end

  class StoreInvalidYearError < Exception ; end
  class StoreInvalidMonthError < Exception ; end
  class StoreInvalidPhotoError < Exception ; end
end<commit_msg>Fix exception names.<commit_after>module PhotoBrowser
  class Filesystem
    BASE_PATH = 'public/photos'

    def self.years
      @years ||= Dir["#{BASE_PATH}/*"].select {|f| File.directory?(f) && File.basename(f) =~ /\A\d+\Z/ }.map {|f| File.basename f }
    end


    def self.months(year)
      raise InvalidYearError, "#{year} is invalid" unless File.directory? "#{BASE_PATH}/#{year}"
        
      Dir["#{BASE_PATH}/#{year}/*"].select {|f| File.directory?(f) }.map {|f| File.basename f }
    end

    def self.photos(year, month)
      raise InvalidYearError, "#{year} is invalid" unless File.directory? "#{BASE_PATH}/#{year}"
      raise InvalidMonthError, "#{month} is invalid" unless File.directory? "#{BASE_PATH}/#{year}/#{month}"

      Dir["#{BASE_PATH}/#{year}/#{month}/*"].select {|f| File.file? f }.map {|f| File.basename f }
    end

    def self.photo(year, month, photo)
      raise InvalidYearError, "#{year} is invalid" unless File.directory? "#{BASE_PATH}/#{year}"
      raise InvalidMonthError, "#{month} is invalid" unless File.directory? "#{BASE_PATH}/#{year}/#{month}"
      raise InvalidPhotoError, "#{photo} is invalid" unless File.file? "#{BASE_PATH}/#{year}/#{month}/#{photo}"

      photo
    end

  end

  class InvalidYearError < Exception ; end
  class InvalidMonthError < Exception ; end
  class InvalidPhotoError < Exception ; end
end
{'fraction_non_alphanumeric': 0.17530597552195826, 'fraction_numerical': 0.0, 'mean_word_length': 3.7585616438356166, 'pattern_counts': {'":': 0, '<': 9, '<?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': '6589711', 'n_tokens_mistral': 908, 'n_tokens_neox': 911, 'n_words': 219}