<commit_before>module MWS
  module API

    class Query

      def initialize(params)
        @params = params
        params[:lists].each do |field,label|
          [params.delete(field)].compact.flatten.each_with_index do |item,i|
            params["#{label}.#{i+1}"] = item
          end
        end unless params[:lists].nil?
      end

      def canonical
        [@params[:verb].to_s.upcase, @params[:host], @params[:uri], build_sorted_query].join("\n")
      end

      def signature
        digest = OpenSSL::Digest::Digest.new('sha256')
        key = @params[:secret_access_key]
        Base64.encode64(OpenSSL::HMAC.digest(digest, key, canonical)).chomp
      end

      def request_uri<commit_msg>OpenSSL::Digest::Digest is deprecated; use OpenSSL::Digest instead<commit_after>module MWS
  module API

    class Query

      def initialize(params)
        @params = params
        params[:lists].each do |field,label|
          [params.delete(field)].compact.flatten.each_with_index do |item,i|
            params["#{label}.#{i+1}"] = item
          end
        end unless params[:lists].nil?
      end

      def canonical
        [@params[:verb].to_s.upcase, @params[:host], @params[:uri], build_sorted_query].join("\n")
      end

      def signature
        klass = OpenSSL::Digest.respond_to?(:new) ? OpenSSL::Digest : OpenSSL::Digest::Digest
        digest = klass.new('sha256')
        key = @params[:secret_access_key]
        Base64.encode64(OpenSSL::HMAC.digest(digest, key, canonical)).chomp
      end

      def request_uri
{'fraction_non_alphanumeric': 0.13380736910148675, 'fraction_numerical': 0.010342598577892695, 'mean_word_length': 2.650943396226415, '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': '1042593', 'n_tokens_mistral': 494, 'n_tokens_neox': 470, 'n_words': 92}