<commit_before># Copyright 2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
#     http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file. This file is
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.

module Seahorse
  class Client

    autoload :Configuration, 'seahorse/client/configuration'
    autoload :Context, 'seahorse/client/context'
    autoload :Endpoint, 'seahorse/client/endpoint'
    autoload :EventEmitter, 'seahorse/client/event_emitter'
    autoload :Handler, 'seahorse/client/handler'
    autoload :HeaderHash, 'seahorse/client/header_hash'
    autoload :HttpHandler, 'seahorse/client/http_handler'
    autoload :PluginList, 'seahorse/client/plugin_list'
    autoload :Request, 'seahorse/client/request'
    autoload :Response, 'seahorse/client/response'
    autoload :VERSION, 'seahorse/client/version'

    @plugins = PluginList.new

    # @option options [String, URI::HTTP, URI::HTTPS, Endpoint] :endpoint
    #   Endpoints specify the http scheme, hostname and port to connect
    #   to.  You must specify at a minimum the hostname.  Endpoints without
    #   a uri scheme will default to https on port 443.
    #
    #       # defaults to https on port 443
    #       hostname: 'domain.com'
    #
    #       # defaults to http on port 80
    #       hostname: 'domain.com', ssl_default: false
    #
    #       # defaults are ignored, as scheme and port are present
    #       hostname: 'http://domain.com:123'
    #
    # @option options [Boolean] :ssl_default (true) Specifies the default
    #   scheme for the #endpoint when not specified.  Defaults to `true`
    #   which creates https endpoints.
    #
    # @option options [Handler] :http_handler (HttpHandler.new)
    #
    def initialize(options = {})
      @config = build_config(options)
      @endpoint = build_endpoint(options)
      @handler = options[:http_handler] || HttpHandler.new(@config)
    end

    # @return [Endpoint]
    attr_reader :endpoint

    # @return [Configuration]
    attr_reader :config

    # Builds and returns a {Request} for the named operation.  The request
    # will not have been sent.
    # @param [Symbol, String] operation_name
    # @return [Request]
    def build_request(operation_name, params = {})
      Request.new(@handler, context_for(operation_name, params))
    end

    private

    # @return [Context]
    def context_for(operation_name, params)
      Context.new(
        operation_name: operation_name.to_s,
        params: params,
        config: config,
        http_endpoint: endpoint)
    end<commit_msg>Simplified client configuration creation.<commit_after># Copyright 2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
#     http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file. This file is
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.

module Seahorse
  class Client

    autoload :Configuration, 'seahorse/client/configuration'
    autoload :Context, 'seahorse/client/context'
    autoload :Endpoint, 'seahorse/client/endpoint'
    autoload :EventEmitter, 'seahorse/client/event_emitter'
    autoload :Handler, 'seahorse/client/handler'
    autoload :HeaderHash, 'seahorse/client/header_hash'
    autoload :HttpHandler, 'seahorse/client/http_handler'
    autoload :PluginList, 'seahorse/client/plugin_list'
    autoload :Request, 'seahorse/client/request'
    autoload :Response, 'seahorse/client/response'
    autoload :VERSION, 'seahorse/client/version'

    @plugins = PluginList.new

    # @option options [String, URI::HTTP, URI::HTTPS, Endpoint] :endpoint
    #   Endpoints specify the http scheme, hostname and port to connect
    #   to.  You must specify at a minimum the hostname.  Endpoints without
    #   a uri scheme will default to https on port 443.
    #
    #       # defaults to https on port 443
    #       hostname: 'domain.com'
    #
    #       # defaults to http on port 80
    #       hostname: 'domain.com', ssl_default: false
    #
    #       # defaults are ignored, as scheme and port are present
    #       hostname: 'http://domain.com:123'
    #
    # @option options [Boolean] :ssl_default (true) Specifies the default
    #   scheme for the #endpoint when not specified.  Defaults to `true`
    #   which creates https endpoints.
    #
    # @option options [Handler] :http_handler (HttpHandler.new)
    #
    def initialize(options = {})
      @config = Configuration.new(options)
      @endpoint = build_endpoint(options)
      @handler = options[:http_handler] || HttpHandler.new(@config)
    end

    # @return [Endpoint]
    attr_reader :endpoint

    # @return [Configuration]
    attr_reader :config

    # Builds and returns a {Request} for the named operation.  The request
    # will not have been sent.
    # @param [Symbol, String] operation_name
    # @return [Request]
    def build_request(operation_name, params = {})
      Request.new(@handler, context_for(operation_name, params))
    end

    private

    # @return [Context]
    def context_for(operation_name, params)
      Context.new(
        operation_name: operation_name.to_s,
        params: params,
        config: config,
        http_endpoint: endpoint)
    end
{'fraction_non_alphanumeric': 0.09200475301307079, 'fraction_numerical': 0.006450517738923782, 'mean_word_length': 3.166902404526167, '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': '7449642', 'n_tokens_mistral': 1746, 'n_tokens_neox': 1695, 'n_words': 560}