<commit_before>class GenericID
  def number_length; 0; end;
  def check_digits_length; 1; end;

  def initialize number
    @number = clear_number(number)

    if number_length > 0 
      raise ArgumentError.new "invalid number" if @number.length != number_length
    end
  end

  def check_digits
    @check_digits ||= begin
      @number[-check_digits_length, check_digits_length]
    end
  end

  def sequential
    @sequential ||= begin
      @number[0, @number.length - check_digits_length]
    end
  end

  def valid?
    @valid ||= begin
      valid_number == @number and not invalid_sequential?
    end
  end

  def invalid_sequential?
    @invalid_sequential ||=begin
      sequential.chars.to_a.uniq.count.eql? 1
    end
  end

  def to_s
    "#{sequential}-#{check_digits}"
  end

  protected
  def mod11 number
    Mod11.new(number)
  end

  def valid_number
    mod11(sequential) * check_digits_length
  end

  def clear_number number
    number.to_s.scan(/\d/).join<commit_msg>Invalid id if has TypeError exception<commit_after>class GenericID
  def number_length; 0; end;
  def check_digits_length; 1; end;

  def initialize number
    @number = clear_number(number)

    if number_length > 0 
      raise ArgumentError.new "invalid number" if @number.length != number_length
    end
  end

  def check_digits
    @check_digits ||= begin
      @number[-check_digits_length, check_digits_length]
    end
  end

  def sequential
    @sequential ||= begin
      @number[0, @number.length - check_digits_length]
    end
  end

  def valid?
    @valid ||= begin
      valid_number == @number and not invalid_sequential?
    rescue TypeError
      false
    end
  end

  def invalid_sequential?
    @invalid_sequential ||=begin
      sequential.chars.to_a.uniq.count.eql? 1
    end
  end

  def to_s
    "#{sequential}-#{check_digits}"
  end

  protected
  def mod11 number
    Mod11.new(number)
  end

  def valid_number
    mod11(sequential) * check_digits_length
  end

  def clear_number number
    number.to_s.scan(/\d/).join
{'fraction_non_alphanumeric': 0.08239333006375674, 'fraction_numerical': 0.010789602746444336, 'mean_word_length': 2.9458413926499034, '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': '6163458', 'n_tokens_mistral': 715, 'n_tokens_neox': 681, 'n_words': 171}