<commit_before>module Jekyll
  class Theme
    attr_reader :name

    def initialize(name)
      @name = name.downcase.strip
      raise Jekyll::Errors::MissingDependencyException unless gemspec
    end

    def root
      @root ||= gemspec.full_gem_path
    end

    def version
      gemspec.version
    end

    def assets_path
      path_for :assets
    end

    def includes_path
      path_for :includes
    end

    def layouts_path
      path_for :layouts
    end

    def sass_path
      path_for :sass
    end

    private

    def path_for(folder)
      folder = "_#{folder}" unless folder == :assets
      path   = Jekyll.sanitized_path root, folder.to_s
      path if Dir.exists?(path)
    end

    def gemspec
      @gemspec ||= Gem::Specification.find_by_name(name)
    rescue Gem::LoadError
      nil
    end
  end
end<commit_msg>better theme-not-found handling<commit_after>module Jekyll
  class Theme
    attr_reader :name

    def initialize(name)
      @name = name.downcase.strip
    end

    def root
      @root ||= gemspec.full_gem_path
    end

    def version
      gemspec.version
    end

    def assets_path
      path_for :assets
    end

    def includes_path
      path_for :includes
    end

    def layouts_path
      path_for :layouts
    end

    def sass_path
      path_for :sass
    end

    private

    def path_for(folder)
      folder = "_#{folder}" unless folder == :assets
      path   = Jekyll.sanitized_path root, folder.to_s
      path if Dir.exists?(path)
    end

    def gemspec
      @gemspec ||= Gem::Specification.find_by_name(name)
    rescue Gem::LoadError
      raise Jekyll::Errors::MissingDependencyException, "The #{name} theme could not be found."
    end
  end
end
{'fraction_non_alphanumeric': 0.06778679026651217, 'fraction_numerical': 0.0, 'mean_word_length': 2.283269961977186, 'pattern_counts': {'":': 0, '<': 3, '<?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': '5961151', 'n_tokens_mistral': 560, 'n_tokens_neox': 542, 'n_words': 145}