<commit_before>module Bamboo
  module Client
    module Http
      class Abstract
        attr_reader :uri

        def initialize(url)
          @uri = URI.parse url
        end

        private

        def uri_for(uri_or_path, params = nil)
          if uri_or_path.kind_of? URI
            u = uri_or_path.dup

            u.host   = @uri.host
            u.port   = @uri.port
            u.scheme = @uri.scheme
            u.path   = File.join(uri.path, @uri.path)
          else
            u = uri.dup
            u.path = File.join(uri.path, uri_or_path)
          end

          u.query = query_string_for(params) if params
          u.to_s
        end

        def query_string_for(params)
          params.map { |k, v| "#{k.to_s}=#{CGI.escape(v.to_s)}" }.join('&')
        end

      end # Abstract
    end # Http
  end # Client
end # Bamboo<commit_msg>uri_for is only called with an URI that already  has the full path (with prefix/context).<commit_after>module Bamboo
  module Client
    module Http
      class Abstract
        attr_reader :uri

        def initialize(url)
          @uri = URI.parse url
        end

        private

        # argument is only an uri if its coming from a result set.
        # in this case, we don't need to prefix the path anymore.
        def uri_for(uri_or_path, params = nil)
          if uri_or_path.kind_of? URI
            u = uri_or_path.dup

            u.host   = @uri.host
            u.port   = @uri.port
            u.scheme = @uri.scheme
          else
            u = uri.dup
            u.path = File.join(uri.path, uri_or_path)
          end

          u.query = query_string_for(params) if params
          u.to_s
        end

        def query_string_for(params)
          params.map { |k, v| "#{k.to_s}=#{CGI.escape(v.to_s)}" }.join('&')
        end

      end # Abstract
    end # Http
  end # Client
end # Bamboo
{'fraction_non_alphanumeric': 0.08975039830058418, 'fraction_numerical': 0.0, 'mean_word_length': 1.50199203187251, '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': '6026687', 'n_tokens_mistral': 608, 'n_tokens_neox': 590, 'n_words': 161}