<commit_before>require 'delegate'
require 'net/https'

require 'papertrail/okjson'

module Papertrail

  # Used because Net::HTTPOK in Ruby 1.8 has no body= method
  class HttpResponse < SimpleDelegator

    def initialize(response)
      super(response)
    end

    def body
      @body ||= Papertrail::OkJson.decode(__getobj__.body.dup.force_encoding('UTF-8'))
    end

  end

  class HttpClient
    ESCAPE_RE = /[^a-zA-Z0-9 .~_-]/

    def initialize(ssl)
      @ssl = ssl
      @headers = {}
    end<commit_msg>Only call String.force_encoding when it exists<commit_after>require 'delegate'
require 'net/https'

require 'papertrail/okjson'

module Papertrail

  # Used because Net::HTTPOK in Ruby 1.8 has no body= method
  class HttpResponse < SimpleDelegator

    def initialize(response)
      super(response)
    end

    def body
      if __getobj__.body.respond_to?(:force_encoding)
        @body ||= Papertrail::OkJson.decode(__getobj__.body.dup.force_encoding('UTF-8'))
      else
        @body ||= Papertrail::OkJson.decode(__getobj__.body.dup)
      end
    end

  end

  class HttpClient
    ESCAPE_RE = /[^a-zA-Z0-9 .~_-]/

    def initialize(ssl)
      @ssl = ssl
      @headers = {}
    end
{'fraction_non_alphanumeric': 0.11101905550952776, 'fraction_numerical': 0.008285004142502071, 'mean_word_length': 2.9093851132686086, 'pattern_counts': {'":': 0, '<': 5, '<?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': '7460806', 'n_tokens_mistral': 422, 'n_tokens_neox': 401, 'n_words': 92}