<commit_before>class Tritium::Engines::Debug
  class Step::Node < Step
    def search(selector)
      @object.xpath(selector)
    end
    
    def select(selector)
      start = Time.now
      child_nodeset = search(selector)
      
      debug_log("Searching #{object.path} with #{selector} and found #{child_nodeset.size} matches")
      
      @debug[:search_time_ns] = ((Time.now - start) * 1000000000).to_i
      
      child_nodeset.each_with_index do |child_node, index|
        debug_log("Match ##{index + 1} at #{child_node.path}")
        @name = child_node.path
        execute_children_on(child_node)
      end
    end
    
    def remove
      debug_log("Removing #{object.path}")
      object.remove
    end
    
    def html
      debug_log("Opening the raw text HTML of #{@object.path}")
      @object.inner_html = execute_children_on(@object.inner_html)
    end
    
    def text
      @object.content = execute_children_on(@object.content)
    end
    
    def attribute(name)
      attribute_node = @object.attributes[name]
      if attribute_node.nil?
        @object[name] = ""
        attribute_node = @object.attributes[name]
      end
      <commit_msg>closing copy_here issue reported by omar<commit_after>class Tritium::Engines::Debug
  class Step::Node < Step
    def search(selector)
      @object.xpath(selector)
    end
    
    def select(selector)
      start = Time.now
      child_nodeset = search(selector)
      
      debug_log("Searching #{object.path} with #{selector} and found #{child_nodeset.size} matches")
      
      @debug[:search_time_ns] = ((Time.now - start) * 1000000000).to_i
      
      child_nodeset.each_with_index do |child_node, index|
        debug_log("Match ##{index + 1} at #{child_node.path}")
        @name = child_node.path
        execute_children_on(child_node)
      end
    end
    
    def remove
      #debug_log("Removing #{object.path}")
      object.remove
    end
    
    def html
      debug_log("Opening the raw text HTML of #{@object.path}")
      @object.inner_html = execute_children_on(@object.inner_html)
    end
    
    def text
      @object.content = execute_children_on(@object.content)
    end
    
    def attribute(name)
      attribute_node = @object.attributes[name]
      if attribute_node.nil?
        @object[name] = ""
        attribute_node = @object.attributes[name]
      end
      
{'fraction_non_alphanumeric': 0.10537363560033586, 'fraction_numerical': 0.009235936188077247, 'mean_word_length': 2.5147492625368733, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, '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': '6321317', 'n_tokens_mistral': 755, 'n_tokens_neox': 739, 'n_words': 153}