<commit_before>module Pipe
  def self.[] (things)
    things = [things] unless things.respond_to? :each
    Chute.new.receive_from(things)
  end

  def >> (pipe)
    open(pipe).receive_from(self)
  end

  def receive_from(incoming)
    @incoming = incoming
    self
  end

  def each
    @incoming.each do |one|
      pipe_one(one) { |out| yield out }
    end
  end

  def take
    each { |one| return one }
    return nil # if nothing was yielded
  end

  def all
    all = []
    each { |one| all << one }
    all
  end

  private

  def pipe_one(thing)
    # identity function by default; including classes should override this
    yield thing
  end

  def open(pipe)
    pipe.is_a?(Class) ? pipe.new : pipe
  end
end

class Chute
  include Pipe

  def >> (pipe)
    open(pipe).receive_from(self)
  end

  def open(pipe)
    pipe.is_a?(Class) ? pipe.new : pipe
  end

  def each(&block)
    @incoming.each(&block)
  end
end


<commit_msg>remove unneeded code in Chute<commit_after>module Pipe
  def self.[] (things)
    things = [things] unless things.respond_to? :each
    Chute.new.receive_from(things)
  end

  def >> (pipe)
    open(pipe).receive_from(self)
  end

  def receive_from(incoming)
    @incoming = incoming
    self
  end

  def each
    @incoming.each do |one|
      pipe_one(one) { |out| yield out }
    end
  end

  def take
    each { |one| return one }
    return nil # if nothing was yielded
  end

  def all
    all = []
    each { |one| all << one }
    all
  end

  private

  def pipe_one(thing)
    # identity function by default; including classes should override this
    yield thing
  end

  def open(pipe)
    pipe.is_a?(Class) ? pipe.new : pipe
  end
end

class Chute
  include Pipe
end



{'fraction_non_alphanumeric': 0.09396751740139211, 'fraction_numerical': 0.0, 'mean_word_length': 2.513238289205703, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '6762750', 'n_tokens_mistral': 628, 'n_tokens_neox': 594, 'n_words': 182}