<commit_before>require 'httparty'
require 'uri'

module AceClient
  class Base
    include HTTParty
    ssl_version :SSLv3

    attr_accessor :access_key_id
    attr_accessor :secret_access_key
    attr_accessor :endpoint
    attr_accessor :http_proxy
    attr_accessor :http_method
    attr_accessor :use_ssl
    attr_accessor :last_response
    attr_accessor :last_response_time
    attr_accessor :user_agent

    def initialize(options)
      @access_key_id = options[:access_key_id]
      @secret_access_key = options[:secret_access_key]
      @endpoint = options[:endpoint]
      @http_proxy = options[:http_proxy]
      @http_method = options[:http_method] || :post
      @use_ssl = options[:use_ssl] || true
      @version = options[:version]
      @path = options[:path] || '/'
      @user_agent = options[:user_agent]
      set_http_proxy
    end

    def set_http_proxy
      if @http_proxy
        uri = URI.parse(@http_proxy)
        self.class.http_proxy(uri.host, uri.port)
      end
    end

    def record_response
      start_time = Time.now
      @last_response = yield
      @last_response_time = Time.now - start_time
      @last_response
    end<commit_msg>env variables support (ACE_ACCESS_KEY_ID, ACE_SECRET_ACCESS_KEY, ACE_ENDPOINT, HTTP_PROXY)<commit_after>require 'httparty'
require 'uri'

module AceClient
  class Base
    include HTTParty
    ssl_version :SSLv3

    attr_accessor :access_key_id
    attr_accessor :secret_access_key
    attr_accessor :endpoint
    attr_accessor :http_proxy
    attr_accessor :http_method
    attr_accessor :use_ssl
    attr_accessor :last_response
    attr_accessor :last_response_time
    attr_accessor :user_agent

    def initialize(options)
      @access_key_id = options[:access_key_id] || ENV['ACE_ACCESS_KEY_ID']
      @secret_access_key = options[:secret_access_key] || ENV['ACE_SECRET_ACCESS_KEY']
      @endpoint = options[:endpoint] || ENV['ACE_ENDPOINT']
      @http_proxy = options[:http_proxy] || ENV['HTTP_PROXY']
      @http_method = options[:http_method] || :post
      @use_ssl = options[:use_ssl] || true
      @version = options[:version]
      @path = options[:path] || '/'
      @user_agent = options[:user_agent]
      set_http_proxy
    end

    def set_http_proxy
      if @http_proxy
        uri = URI.parse(@http_proxy)
        self.class.http_proxy(uri.host, uri.port)
      end
    end

    def record_response
      start_time = Time.now
      @last_response = yield
      @last_response_time = Time.now - start_time
      @last_response
    end
{'fraction_non_alphanumeric': 0.08711076074103272, 'fraction_numerical': 0.0007883326763894363, 'mean_word_length': 3.2944162436548226, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3356987', 'n_tokens_mistral': 836, 'n_tokens_neox': 822, 'n_words': 159}