<commit_before>module Fetch
  # Contains a set of utility methods for use inside Fetch.
  module Util
    # Converts an underscored name to camelized version for use with
    # constantize.
    #
    #   Util.camelize("fetch_modules/git_hub/user_info_fetch")
    #   # => "FetchModules::GitHub::UserInfoFetch"
    def self.camelize(underscored)
      underscored.gsub(/(^|[\/_])./, &:upcase).gsub("_", "").gsub("/", "::")
    end

    # Constantizes a class name.
    #
    #   Util.constantize("FetchModules::GitHub::UserInfoFetch")
    #   # => FetchModules::GitHub::UserInfoFetch
    #
    #   Util.constantize("Some::Nonexistent::Class")
    #   # => NameError
    def self.constantize(name)
      name.split("::").inject(Kernel, &:const_get)
    end

    # Constantizes a class name, returning +nil+ if the class doesn't exist.
    #
    #   Util.safe_constantize("FetchModules::GitHub::UserInfoFetch")
    #   # => FetchModules::GitHub::UserInfoFetch
    #
    #   Util.safe_constantize("Some::Nonexistent::Class")
    #   # => nil
    def self.safe_constantize(name)
      constantize(name)
    rescue NameError => e
      raise e unless e.message.include?(name)
      nil
    end
  end
end<commit_msg>Remove reraise<commit_after>module Fetch
  # Contains a set of utility methods for use inside Fetch.
  module Util
    # Converts an underscored name to camelized version for use with
    # constantize.
    #
    #   Util.camelize("fetch_modules/git_hub/user_info_fetch")
    #   # => "FetchModules::GitHub::UserInfoFetch"
    def self.camelize(underscored)
      underscored.gsub(/(^|[\/_])./, &:upcase).gsub("_", "").gsub("/", "::")
    end

    # Constantizes a class name.
    #
    #   Util.constantize("FetchModules::GitHub::UserInfoFetch")
    #   # => FetchModules::GitHub::UserInfoFetch
    #
    #   Util.constantize("Some::Nonexistent::Class")
    #   # => NameError
    def self.constantize(name)
      name.split("::").inject(Kernel, &:const_get)
    end

    # Constantizes a class name, returning +nil+ if the class doesn't exist.
    #
    #   Util.safe_constantize("FetchModules::GitHub::UserInfoFetch")
    #   # => FetchModules::GitHub::UserInfoFetch
    #
    #   Util.safe_constantize("Some::Nonexistent::Class")
    #   # => nil
    def self.safe_constantize(name)
      constantize(name)
    rescue NameError => e
      nil
    end
  end
end
{'fraction_non_alphanumeric': 0.14117151285292878, 'fraction_numerical': 0.0, 'mean_word_length': 3.093103448275862, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 15, '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': '3552901', 'n_tokens_mistral': 799, 'n_tokens_neox': 792, 'n_words': 146}