<commit_before>module Pact

  module PactFile

    extend self

    def read uri, options = {}
      open_options = options[:username] ? {} : {http_basic_authentication:[options[:username],options[:password]]}
      pact = open(uri.to_s, open_options) { | file | file.read }
      if options[:save_pactfile_to_tmp]
        save_pactfile_to_tmp pact, ::File.basename(uri.to_s)
      end
      pact
    rescue StandardError => e
      $stderr.puts "Error reading file from #{uri}"
      $stderr.puts "#{e.to_s} #{e.backtrace.join("\n")}"
      raise e
    end

    def save_pactfile_to_tmp pact, name
      ::FileUtils.mkdir_p Pact.configuration.tmp_dir
      ::File.open(Pact.configuration.tmp_dir + "/#{name}", "w") { |file|  file << pact}
    end
  end<commit_msg>fixed the logic to pass the open uri option<commit_after>module Pact

  module PactFile

    extend self

    def read uri, options = {}
      open_options = options[:username] ? {http_basic_authentication:[options[:username],options[:password]]} : {}
      pact = open(uri.to_s, open_options) { | file | file.read }
      if options[:save_pactfile_to_tmp]
        save_pactfile_to_tmp pact, ::File.basename(uri.to_s)
      end
      pact
    rescue StandardError => e
      $stderr.puts "Error reading file from #{uri}"
      $stderr.puts "#{e.to_s} #{e.backtrace.join("\n")}"
      raise e
    end

    def save_pactfile_to_tmp pact, name
      ::FileUtils.mkdir_p Pact.configuration.tmp_dir
      ::File.open(Pact.configuration.tmp_dir + "/#{name}", "w") { |file|  file << pact}
    end
  end
{'fraction_non_alphanumeric': 0.13205128205128205, 'fraction_numerical': 0.0, 'mean_word_length': 3.0971128608923886, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '5512051', 'n_tokens_mistral': 541, 'n_tokens_neox': 526, 'n_words': 115}