<commit_before>class SprintBoundaryIterator
  include Enumerable
  require "active_support/core_ext/numeric/time"
  require 'pathname'
  require 'yaml'

  def initialize
    old_boundaries_yaml = Pathname.new(__dir__).join("old_sprint_boundaries.yml")
    @old_boundaries = File.exist?(old_boundaries_yaml) ? YAML.load_file(old_boundaries_yaml) : []
  end

  def each
    number, range = next_boundary
    today = Date.today
    while today > range.first do
      yield number, range

      number, range = next_boundary
    end
  end

  private

  # The first sprint when we started doing the cadence that compute_next_range works with properly
  FIRST_AUTOCOMPUTED_NUMBER = 76
  FIRST_AUTOCOMPUTED_RANGE  = Date.parse("Dec 12, 2017")..Date.parse("Jan 1, 2018")

  def next_boundary
    if @old_boundaries.any?
      @last_number, start_date, end_date = @old_boundaries.shift
      @last_range = start_date..end_date
    elsif @last_number.nil?
      @last_number = FIRST_AUTOCOMPUTED_NUMBER
      @last_range  = FIRST_AUTOCOMPUTED_RANGE
    else
      @last_range   = compute_next_range(@last_range)
      @last_number += 1
    end

    [@last_number, @last_range]
  end
<commit_msg>re-added SprintBoundaryIterator.start_range method<commit_after>class SprintBoundaryIterator
  include Enumerable
  require "active_support/core_ext/numeric/time"
  require 'pathname'
  require 'yaml'

  def initialize
    old_boundaries_yaml = Pathname.new(__dir__).join("old_sprint_boundaries.yml")
    @old_boundaries = File.exist?(old_boundaries_yaml) ? YAML.load_file(old_boundaries_yaml) : []
  end

  def each
    number, range = next_boundary
    today = Date.today
    while today > range.first do
      yield number, range

      number, range = next_boundary
    end
  end

  def self.start_range
    self.new.first.last
  end

  private

  # The first sprint when we started doing the cadence that compute_next_range works with properly
  FIRST_AUTOCOMPUTED_NUMBER = 76
  FIRST_AUTOCOMPUTED_RANGE  = Date.parse("Dec 12, 2017")..Date.parse("Jan 1, 2018")

  def next_boundary
    if @old_boundaries.any?
      @last_number, start_date, end_date = @old_boundaries.shift
      @last_range = start_date..end_date
    elsif @last_number.nil?
      @last_number = FIRST_AUTOCOMPUTED_NUMBER
      @last_range  = FIRST_AUTOCOMPUTED_RANGE
    else
      @last_range   = compute_next_range(@last_range)
      @last_number += 1
    end

    [@last_number, @last_range]
  end

{'fraction_non_alphanumeric': 0.07882974400650142, 'fraction_numerical': 0.011377488825680617, 'mean_word_length': 3.662878787878788, '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': '2332453', 'n_tokens_mistral': 870, 'n_tokens_neox': 805, 'n_words': 176}