<commit_before>require 'memcached'

class V1MarshaledDepedencies

  LIMIT = 250

  BadRequest = [404, {}, ["Go away"]]
  TooMany =    [413, {}, 
                ["Too many gems to resolve, please request less than #{LIMIT}"]]

  def data_for(name, ary, cache)
    gem = Rubygem.find_by_name(name)
    raise "Unknown gem - #{name}" unless gem

    these = []

    gem.versions.each do |ver|
      deps = ver.dependencies.find_all { |d| d.scope == "runtime" }

      data = {
        :name => name,
        :number => ver.number,
        :platform => ver.platform,
        :dependencies => deps.map { |d| d.requirements.split(" ", 2) }
      }
      these << data
      ary << data
    end

    if cache
      cache.set "gem.#{name}", [Marshal.dump(these)].pack("m")<commit_msg>Fix the ordering and dependency output<commit_after>require 'memcached'

class V1MarshaledDepedencies

  LIMIT = 250

  BadRequest = [404, {}, ["Go away"]]
  TooMany =    [413, {}, 
                ["Too many gems to resolve, please request less than #{LIMIT}"]]

  def data_for(name, ary, cache)
    gem = Rubygem.find_by_name(name)
    raise "Unknown gem - #{name}" unless gem

    these = []

    gem.versions.order(:number).reverse_each do |ver|
      deps = ver.dependencies.find_all { |d| d.scope == "runtime" }

      data = {
        :name => name,
        :number => ver.number,
        :platform => ver.platform,
        :dependencies => deps.map { |d| [d.name, d.requirements] }
      }
      these << data
      ary << data
    end

    if cache
      cache.set "gem.#{name}", [Marshal.dump(these)].pack("m")
{'fraction_non_alphanumeric': 0.15037593984962405, 'fraction_numerical': 0.013157894736842105, 'mean_word_length': 2.3834745762711864, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '5091021', 'n_tokens_mistral': 555, 'n_tokens_neox': 513, 'n_words': 134}