<commit_before>require 'uri'
require 'httpclient'

class GeminaboxClient
  attr_reader :url, :http_client

  def initialize(url)
    extract_username_and_password_from_url!(url)
    @http_client = HTTPClient.new
    @http_client.set_auth(url_for(:upload), @username, @password) if @username or @password
    @http_client.www_auth.basic_auth.challenge(url_for(:upload)) # Workaround: https://github.com/nahi/httpclient/issues/63
    @http_client.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_NONE
  end

  def extract_username_and_password_from_url!(url)
    uri = URI.parse(url.to_s)
    @username, @password = uri.user, uri.password
    uri.user = uri.password = <PASSWORD>
    uri.path = uri.path + "/" unless uri.path.end_with?("/")
    @url = uri.to_s
  end

  def url_for(path)
    url + path.to_s
  end

  def push(gemfile)
    response = http_client.post(url_for(:upload), {'file' => File.open(gemfile, "rb")}, {'Accept' => 'text/plain'})

    if response.status < 400
      response.body
    else
      raise GeminaboxClient::Error, "Error (#{response.code} received)\n\n#{response.body}"
    end
  end

end

class GeminaboxClient::Error < RuntimeError
end
<commit_msg>Establish a larger send timeout.<commit_after>require 'uri'
require 'httpclient'

class GeminaboxClient
  attr_reader :url, :http_client

  def initialize(url)
    extract_username_and_password_from_url!(url)
    @http_client = HTTPClient.new
    @http_client.set_auth(url_for(:upload), @username, @password) if @username or @password
    @http_client.www_auth.basic_auth.challenge(url_for(:upload)) # Workaround: https://github.com/nahi/httpclient/issues/63
    @http_client.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_NONE
    @http_client.send_timeout = 600
  end

  def extract_username_and_password_from_url!(url)
    uri = URI.parse(url.to_s)
    @username, @password = uri.user, uri.password
    uri.user = uri.password = nil
    uri.path = uri.path + "/" unless uri.path.end_with?("/")
    @url = uri.to_s
  end

  def url_for(path)
    url + path.to_s
  end

  def push(gemfile)
    response = http_client.post(url_for(:upload), {'file' => File.open(gemfile, "rb")}, {'Accept' => 'text/plain'})

    if response.status < 400
      response.body
    else
      raise GeminaboxClient::Error, "Error (#{response.code} received)\n\n#{response.body}"
    end
  end

end

class GeminaboxClient::Error < RuntimeError
end

{'fraction_non_alphanumeric': 0.13072439633638636, 'fraction_numerical': 0.005412156536219817, 'mean_word_length': 4.1127659574468085, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '3707359', 'n_tokens_mistral': 852, 'n_tokens_neox': 829, 'n_words': 158}