<commit_before>module Repositories
  class Carthage < Base
    HAS_VERSIONS = false
    HAS_DEPENDENCIES = false
    LIBRARIAN_SUPPORT = true
    URL = 'https://github.com/Carthage/Carthage'
    COLOR = '#ffac45'

    def self.project_names
      Manifest.platform('Carthage').includes(:repository_dependencies).map{|m| m.repository_dependencies.map(&:project_name).map(&:downcase)}.flatten.uniq
    end

    def self.project(name)
      if name.match(/^([-\w]+)\/([-_.\w]+)$/)
        begin
          repo = AuthToken.client.repo(name, accept: 'application/vnd.github.drax-preview+json')
          return repo.to_hash
        rescue
          return nil
        end
      elsif name_with_owner = GithubUrls.parse(name)
        begin
          repo = AuthToken.client.repo(name_with_owner, accept: 'application/vnd.github.drax-preview+json')
          return repo.to_hash
        rescue
          return nil
        end
      elsif name.match(/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/)
        response = Typhoeus.get(name, followlocation: true)
        if response.code == 200
          {
            full_name: name.sub(/^https?\:\/\//, ''),
            homepage: name
          }
        end
      end
    end

    def self.mapping(project)
      {
        :name => project[:full_name],
        :description => project[:description],
        :homepage => project[:homepage],
        :licenses => project.fetch(:license, {})[:key],
        :repository_url => project[:html_url]
      }
    end
  end
end
<commit_msg>remove nils before downcasing<commit_after>module Repositories
  class Carthage < Base
    HAS_VERSIONS = false
    HAS_DEPENDENCIES = false
    LIBRARIAN_SUPPORT = true
    URL = 'https://github.com/Carthage/Carthage'
    COLOR = '#ffac45'

    def self.project_names
      Manifest.platform('Carthage').includes(:repository_dependencies).map{|m| m.repository_dependencies.map(&:project_name).compact.map(&:downcase)}.flatten.uniq
    end

    def self.project(name)
      if name.match(/^([-\w]+)\/([-_.\w]+)$/)
        begin
          repo = AuthToken.client.repo(name, accept: 'application/vnd.github.drax-preview+json')
          return repo.to_hash
        rescue
          return nil
        end
      elsif name_with_owner = GithubUrls.parse(name)
        begin
          repo = AuthToken.client.repo(name_with_owner, accept: 'application/vnd.github.drax-preview+json')
          return repo.to_hash
        rescue
          return nil
        end
      elsif name.match(/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/)
        response = Typhoeus.get(name, followlocation: true)
        if response.code == 200
          {
            full_name: name.sub(/^https?\:\/\//, ''),
            homepage: name
          }
        end
      end
    end

    def self.mapping(project)
      {
        :name => project[:full_name],
        :description => project[:description],
        :homepage => project[:homepage],
        :licenses => project.fetch(:license, {})[:key],
        :repository_url => project[:html_url]
      }
    end
  end
end

{'fraction_non_alphanumeric': 0.15357372826786864, 'fraction_numerical': 0.004507405022537025, 'mean_word_length': 2.160732451678535, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 2, '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': '2958365', 'n_tokens_mistral': 1024, 'n_tokens_neox': 978, 'n_words': 165}