<commit_before># coding: utf-8

require("net/http")
require("openssl")
require("uri")
require("json")

def get(url, auth, header=nil, limit=10)
    url = URI.parse(url)
    http = Net::HTTP.new(url.host, url.port)
    http.use_ssl = true
    # Just for test
    http.verify_mode = OpenSSL::SSL::VERIFY_NONE
    res = http.start do |h|
        req = Net::HTTP::Get.new(url.request_uri, header)
        if auth && ENV.key?("github_key")
            req.basic_auth "masamitsu-murase", ENV["github_key"]
        end
        h.request(req)
    end

    if res.kind_of?(Net::HTTPRedirection) && limit > 0
        get(res["location"], auth, header, limit - 1)
    else
        res
    end
end

def main(python_exe_name, python_version)
    puts "Getting latest release information..."
    if python_version == "2"
        res = get("https://api.github.com/repos/masamitsu-murase/single_binary_stackless_python/releases/10437463", true)
    else
        res = get("https://api.github.com/repos/masamitsu-murase/single_binary_stackless_python/releases/latest", true)
    end
    latest_release_info = JSON.parse(res.body)
    require "pp"
    pp latest_release_info

    puts "Finding #{python_exe_name}..."
    exe_url = latest_release_info["assets"].find{ |i| i["name"] == python_exe_name }["browser_download_url"]

    puts "Downloading #{python_exe_name}..."
    res = get(exe_url, false, { "Accept" => "application/octet-stream" })
    File.binwrite(python_exe_name, res.body.b)
end

main(ARGV[0], ARGV[1])
<commit_msg>Remove debug log.<commit_after># coding: utf-8

require("net/http")
require("openssl")
require("uri")
require("json")

def get(url, auth, header=nil, limit=10)
    url = URI.parse(url)
    http = Net::HTTP.new(url.host, url.port)
    http.use_ssl = true
    # Just for test
    http.verify_mode = OpenSSL::SSL::VERIFY_NONE
    res = http.start do |h|
        req = Net::HTTP::Get.new(url.request_uri, header)
        if auth && ENV.key?("github_key")
            req.basic_auth "masamitsu-murase", ENV["github_key"]
        end
        h.request(req)
    end

    if res.kind_of?(Net::HTTPRedirection) && limit > 0
        get(res["location"], auth, header, limit - 1)
    else
        res
    end
end

def main(python_exe_name, python_version)
    puts "Getting latest release information..."
    if python_version == "2"
        res = get("https://api.github.com/repos/masamitsu-murase/single_binary_stackless_python/releases/10437463", true)
    else
        res = get("https://api.github.com/repos/masamitsu-murase/single_binary_stackless_python/releases/latest", true)
    end
    latest_release_info = JSON.parse(res.body)

    puts "Finding #{python_exe_name}..."
    exe_url = latest_release_info["assets"].find{ |i| i["name"] == python_exe_name }["browser_download_url"]

    puts "Downloading #{python_exe_name}..."
    res = get(exe_url, false, { "Accept" => "application/octet-stream" })
    File.binwrite(python_exe_name, res.body.b)
end

main(ARGV[0], ARGV[1])

{'fraction_non_alphanumeric': 0.14364461738002593, 'fraction_numerical': 0.010376134889753566, 'mean_word_length': 2.9652956298200515, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7624604', 'n_tokens_mistral': 1152, 'n_tokens_neox': 1043, 'n_words': 198}