<commit_before>module Codeforces::Helper

  def each_contest
    api.contest.list.each {|contest| yield(contest) if block_given? }
  end

  def user(handle)
    create_user api.user.info(handle).first
  end

  def users
    create_users api.user.rated_list.map {|u| create_user u }
  end

  def each_status
    api.problemset.recent_status.map {|s| create_submission s }.each {|status| yield(status) if block_given? }
  end

end<commit_msg>helper: add contest()<commit_after>module Codeforces::Helper

  def contest(query)
    if query.is_a?(Integer)
      contests.select {|c| query === c.id }.first
    else
      ret = contests.select {|c| query === c.name }
      raise "Error: contest is not found" if ret.empty?
      raise "Error: query is ambiguous" if ret.length > 1
      ret.first
    end
  end

  def contests
    api.contest.list
  end

  def each_contest
    contests.each {|contest| yield(contest) if block_given? }
  end

  def user(handle)
    create_user api.user.info(handle).first
  end

  def users
    create_users api.user.rated_list.map {|u| create_user u }
  end

  def recent_status
    api.problemset.recent_status.map {|s| create_submission s }
  end

  def each_status
    recent_status.each {|status| yield(status) if block_given? }
  end

end
{'fraction_non_alphanumeric': 0.10054988216810684, 'fraction_numerical': 0.0007855459544383347, 'mean_word_length': 3.2466666666666666, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '1171624', 'n_tokens_mistral': 460, 'n_tokens_neox': 441, 'n_words': 114}