<commit_before>class TwitterSearcher
  attr_reader :since_id
  def initialize(client, q, since_id = 0)
    @client, @q, @since_id = client, q, since_id
  end

  def each(&block)
    search_for_term do |tweet|
      @since_id = tweet.id if tweet.id > since_id
      block.call(tweet)
    end
  end

  private
  attr_reader :client, :q
  def search_for_term(&block)
    results = client.search(q, since_id: since_id)
    results.statuses.each(&block)
  end
end
<commit_msg>Adding a random failure to the searcher to simulate network or other errors.<commit_after>class TwitterSearcher
  attr_reader :since_id
  def initialize(client, q, since_id = 0)
    @client, @q, @since_id = client, q, since_id
  end

  def each(&block)
    raise "Ow!#{q}" if rand(3) == 1
    search_for_term do |tweet|
      @since_id = tweet.id if tweet.id > since_id
      block.call(tweet)
    end
  end

  private
  attr_reader :client, :q
  def search_for_term(&block)
    results = client.search(q, since_id: since_id)
    results.statuses.each(&block)
  end
end

{'fraction_non_alphanumeric': 0.10086455331412104, 'fraction_numerical': 0.0038424591738712775, 'mean_word_length': 3.452991452991453, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3064805', 'n_tokens_mistral': 384, 'n_tokens_neox': 373, 'n_words': 101}