<commit_before>module Seahorse
  module Client
    class Request

      include HandlerBuilder

      # @param [HandlerList] handlers
      # @param [RequestContext] context
      def initialize(handlers, context)
        @handlers = handlers
        @context = context
      end

      # @return [HandlerList]
      attr_reader :handlers

      # @return [RequestContext]
      attr_reader :context

      # Sends the request, returning a {Response Response}.
      #
      #     response = request.send_request
      #
      # # Streaming Responses
      #
      # By default, HTTP responses are buffered into memory.  This can be
      # bad if you are downloading large responses, e.g. large files.
      # You can avoid this by streaming the response to a block or some other
      # target.
      #
      # ## Streaming to a File
      #
      # TODO: write this
      #
      # ## Streaming to a Tempfile
      #
      # TODO: write this
      #
      # ## Block Streaming
      #
      # Pass a block to `#send` and the response will be yielded in chunks
      # and will not be loaded into memory.
      #
      #     # stream the response data
      #     response = request.send_request do |chunk|
      #       file.write(chunk)
      #     end
      #
      # **Please Note**: When streaming to a block, retries are disabled.
      #
      # # Asynchronous Requests
      #
      # If you are using a HTTP handler that makes asynchronous requests,
      # then you will need to wait for the returned response to be
      # complete before you inspect the response.
      #
      #     response = request.send_request
      #     response.complete?
      #     #=> false
      #
      #     response.on_complete do
      #       response.complete?
      #       #=> true
      #     end
      #
      # The {Response#on_complete on_complete} method can also yield the
      # {Response Response} object to your block.
      #
      #     request.send_request.on_complete do |response|
      #       response.complete?
      #       #=> true
      #     end
      #
      # @return [Response]
      def send_request(options = {}, &block)
        @context.http_response.body = BlockIO.new(&block) if block_given?
        @context.http_response.body = options[:target] if options[:target]
        @handlers.to_stack.call(@context)
      end
<commit_msg>Updated the Request#send_request method documentation.<commit_after>module Seahorse
  module Client
    class Request

      include HandlerBuilder

      # @param [HandlerList] handlers
      # @param [RequestContext] context
      def initialize(handlers, context)
        @handlers = handlers
        @context = context
      end

      # @return [HandlerList]
      attr_reader :handlers

      # @return [RequestContext]
      attr_reader :context

      # Sends the request, returning a {Response} object.
      #
      #     response = request.send_request
      #
      # # Streaming Responses
      #
      # By default, HTTP responses are buffered into memory.  This can be
      # bad if you are downloading large responses, e.g. large files.
      # You can avoid this by streaming the response to a block or some other
      # target.
      #
      # ## Streaming to a File
      #
      # You can stream the raw HTTP response body to a File, or any IO-like
      # object, by passing the `:target` option.
      #
      #     File.open('photo.jpg', 'wb') do |file|
      #       request.send_request(target: file)
      #     end
      #
      # ## Block Streaming
      #
      # Pass a block to `#send_request` and the response will be yielded in
      # chunks to the given block.
      #
      #     # stream the response data
      #     request.send_request do |chunk|
      #       file.write(chunk)
      #     end
      #
      # **Please Note**: When streaming to a block, it is not possible to
      # retry failed requests.
      #
      # @return [Response]
      def send_request(options = {}, &block)
        @context.http_response.body = BlockIO.new(&block) if block_given?
        @context.http_response.body = options[:target] if options[:target]
        @handlers.to_stack.call(@context)
      end

{'fraction_non_alphanumeric': 0.08275697591223467, 'fraction_numerical': 0.0, 'mean_word_length': 1.9206128133704736, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '667153', 'n_tokens_mistral': 1156, 'n_tokens_neox': 1125, 'n_words': 378}