<commit_before># encoding: utf-8

require 'github_api/configuration'
require 'github_api/connection'
require 'github_api/validation'
require 'github_api/request'
require 'github_api/mime_type'
require 'github_api/core_ext/hash'
require 'github_api/core_ext/array'
require 'github_api/compatibility'
require 'github_api/api/actions'

module Github

  # @private
  class API
    include Authorization
    include MimeType
    include Connection
    include Request
    include Validation

    attr_reader *Configuration::VALID_OPTIONS_KEYS
    attr_accessor *VALID_API_KEYS

    # Callback to update global configuration options
    class_eval do
      Configuration::VALID_OPTIONS_KEYS.each do |key|
        define_method "#{key}=" do |arg|
          self.instance_variable_set("@#{key}", arg)
          Github.send("#{key}=", arg)
        end
      end
    end

    # Creates new API
    def initialize(options = {}, &block)
      options = Github.options.merge(options)
      Configuration::VALID_OPTIONS_KEYS.each do |key|
        send("#{key}=", options[key])
      end
      _process_basic_auth(options[:basic_auth])
      _set_api_client
      client if client_id? && client_secret?

      self.instance_eval(&block) if block_given?
    end

  private

    # Extract login and password from basic_auth parameter
    def _process_basic_auth(auth)
      case auth
      when String
        self.login    = auth.split(':').first
        self.password = auth.split(':').last
      when Hash
        self.login    = auth[:login]
        self.password = auth[:password]
      end
    end

    # Assigns current api class
    def _set_api_client
      Github.api_client = self
    end

    # Passes configuration options to instantiated class
    def _create_instance(klass, options)
      options.symbolize_keys!
      instance = klass.send :new, options
      Github.api_client = instance
      instance
    end
<commit_msg>Remove api class instantiator.<commit_after># encoding: utf-8

require 'github_api/configuration'
require 'github_api/connection'
require 'github_api/validation'
require 'github_api/request'
require 'github_api/mime_type'
require 'github_api/core_ext/hash'
require 'github_api/core_ext/array'
require 'github_api/compatibility'
require 'github_api/api/actions'
require 'github_api/api_factory'

module Github

  # @private
  class API
    include Authorization
    include MimeType
    include Connection
    include Request
    include Validation

    attr_reader *Configuration::VALID_OPTIONS_KEYS
    attr_accessor *VALID_API_KEYS

    # Callback to update global configuration options
    class_eval do
      Configuration::VALID_OPTIONS_KEYS.each do |key|
        define_method "#{key}=" do |arg|
          self.instance_variable_set("@#{key}", arg)
          Github.send("#{key}=", arg)
        end
      end
    end

    # Creates new API
    def initialize(options = {}, &block)
      options = Github.options.merge(options)
      Configuration::VALID_OPTIONS_KEYS.each do |key|
        send("#{key}=", options[key])
      end
      _process_basic_auth(options[:basic_auth])
      _set_api_client
      client if client_id? && client_secret?

      self.instance_eval(&block) if block_given?
    end

  private

    # Extract login and password from basic_auth parameter
    def _process_basic_auth(auth)
      case auth
      when String
        self.login    = auth.split(':').first
        self.password = auth.split(':').last
      when Hash
        self.login    = auth[:login]
        self.password = auth[:password]
      end
    end

    # Assigns current api class
    def _set_api_client
      Github.api_client = self
    end

{'fraction_non_alphanumeric': 0.0877623330607795, 'fraction_numerical': 0.0005451076587626056, 'mean_word_length': 3.019715224534502, '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': '7352352', 'n_tokens_mistral': 1102, 'n_tokens_neox': 1082, 'n_words': 265}