<commit_before>class Repositories
  class Atom < Base
    HAS_VERSIONS = true
    HAS_DEPENDENCIES = true
    LIBRARIAN_SUPPORT = true
    SECURITY_PLANNED = true
    URL = 'https://atom.io'
    COLOR = '#244776'

    def self.project_names
      page = 1
      projects = []
      while true
        r = get("https://atom.io/api/packages?page=#{page}")
        break if  r == []
        projects += r
        page +=1
      end
      projects.map{|project| project['name'] }.sort.uniq
    end

    def self.recent_names
      projects = get('https://atom.io/api/packages?page=1&sort=created_at&direction=desc') +
      get('https://atom.io/api/packages?page=1&sort=updated_at&direction=desc')
      projects.map{|project| project['name'] }.uniq
    end

    def self.project(name)
      get("https://atom.io/api/packages/#{name}")
    end

    def self.mapping(project)
      {
        :name => project['name'],
        :description => project['metadata']['description'],
        :repository_url => project['metadata']['repository']
      }
    end

    def self.versions(project)
      project['versions'].map do |k,v|
        {
          :number => k,
          :published_at => nil
        }
      end
    end

    def self.dependencies(name, version)
      deps = get("https://atom.io/api/packages/#{name}/versions/#{version}")["dependencies"]
      deps.map do |name,req|
        {
          project_name: name,
          requirements: req,
          kind: 'normal',
          optional: false,
          platform: 'Npm' # woah!
        }
      end
    end
  end
end<commit_msg>Handle weird atom repo links better<commit_after>class Repositories
  class Atom < Base
    HAS_VERSIONS = true
    HAS_DEPENDENCIES = true
    LIBRARIAN_SUPPORT = true
    SECURITY_PLANNED = true
    URL = 'https://atom.io'
    COLOR = '#244776'

    def self.project_names
      page = 1
      projects = []
      while true
        r = get("https://atom.io/api/packages?page=#{page}")
        break if  r == []
        projects += r
        page +=1
      end
      projects.map{|project| project['name'] }.sort.uniq
    end

    def self.recent_names
      projects = get('https://atom.io/api/packages?page=1&sort=created_at&direction=desc') +
      get('https://atom.io/api/packages?page=1&sort=updated_at&direction=desc')
      projects.map{|project| project['name'] }.uniq
    end

    def self.project(name)
      get("https://atom.io/api/packages/#{name}")
    end

    def self.mapping(project)
      metadata = project['metadata']
      repo = metadata['repository'].is_a?(Hash) ? metadata['repository']['url'] : metadata['repository']
      {
        :name => project['name'],
        :description => metadata['description'],
        :repository_url => repo
      }
    end

    def self.versions(project)
      project['versions'].map do |k,v|
        {
          :number => k,
          :published_at => nil
        }
      end
    end

    def self.dependencies(name, version)
      deps = get("https://atom.io/api/packages/#{name}/versions/#{version}")["dependencies"]
      deps.map do |name,req|
        {
          project_name: name,
          requirements: req,
          kind: 'normal',
          optional: false,
          platform: 'Npm' # woah!
        }
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.14224924012158055, 'fraction_numerical': 0.0060790273556231, 'mean_word_length': 2.1735776277724206, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 12, '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': '5415081', 'n_tokens_mistral': 1047, 'n_tokens_neox': 1009, 'n_words': 198}