<commit_before>require 'eventmachine'

module Downloader
  module Downloads
    class HTTP
      include EM::Deferrable
      attr_accessor :message, :download_id, :status, :downloaded_file_name
      
      def initialize(download_id)
        self.download_id = download_id
      end

      def get(uri, options={})
        download_uri = URI.parse(uri)
        self.downloaded_file_name = "#{self.download_id}_#{download_uri.path.split('/').last}"
        download_path = ENV['UUT_DOWNLOAD_PATH'] || File.join(ENV['HOME'], 'leeching')

        f = IO.popen("wget #{uri} -O #{File.join(download_path, downloaded_file_name)} 2>&1", "r") do |pipe|
          pipe.each do |line|
            sleep 1
            if line.match(/\d%/)
              line.split().each do |part|
                p part if part.match(/\d%/)<commit_msg>require uri for working with URIs<commit_after>require 'eventmachine'
require 'uri'

module Downloader
  module Downloads
    class HTTP
      include EM::Deferrable
      attr_accessor :message, :download_id, :status, :downloaded_file_name
      
      def initialize(download_id)
        self.download_id = download_id
      end

      def get(uri, options={})
        download_uri = ::URI.parse(uri)
        self.downloaded_file_name = "#{self.download_id}_#{download_uri.path.split('/').last}"
        download_path = ENV['UUT_DOWNLOAD_PATH'] || File.join(ENV['HOME'], 'leeching')

        f = IO.popen("wget #{uri} -O #{File.join(download_path, downloaded_file_name)} 2>&1", "r") do |pipe|
          pipe.each do |line|
            sleep 1
            if line.match(/\d%/)
              line.split().each do |part|
                p part if part.match(/\d%/)
{'fraction_non_alphanumeric': 0.13372781065088757, 'fraction_numerical': 0.0035502958579881655, 'mean_word_length': 2.567510548523207, 'pattern_counts': {'":': 0, '<': 3, '<?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': 28, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2247637', 'n_tokens_mistral': 544, 'n_tokens_neox': 530, 'n_words': 116}