<commit_before>class Android::Import
  WORKOUTS_SQL = "select * from workouts"
  attr_reader :user, :program

  def initialize(user, program)
    @user = user
    @program = program
  end

  def can_parse?(directory)
    File.exist?(database_file(directory))
  end

  def import_from(directory)
    database(directory) do |db|
      db.execute(WORKOUTS_SQL) do |row|
        import(row)
      end
    end
  end

  def import(row)
    create_workout_from(map_from(row), program)
  end

  private

  def database_file(dir)
    "#{dir}/stronglifts.db"
  end

  def database(dir)
    yield SQLite3::Database.new(database_file(dir))
  end

  def create_workout_from(workout_row, program)
    ActiveRecord::Base.transaction do
      training_session_for(workout_row) do |training_session, workout|
        training_session.exercise_sessions.destroy_all
        workout.exercise_workouts.each_with_index do |exercise_workout, index|
          exercise_row = workout_row.exercises[index]
          training_session.train(
            exercise_workout.exercise,<commit_msg>remove unused parameter.<commit_after>class Android::Import
  WORKOUTS_SQL = "select * from workouts"
  attr_reader :user, :program

  def initialize(user, program)
    @user = user
    @program = program
  end

  def can_parse?(directory)
    File.exist?(database_file(directory))
  end

  def import_from(directory)
    database(directory) do |db|
      db.execute(WORKOUTS_SQL) do |row|
        import(row)
      end
    end
  end

  def import(row)
    create_workout_from(map_from(row))
  end

  private

  def database_file(dir)
    "#{dir}/stronglifts.db"
  end

  def database(dir)
    yield SQLite3::Database.new(database_file(dir))
  end

  def create_workout_from(workout_row)
    ActiveRecord::Base.transaction do
      training_session_for(workout_row) do |training_session, workout|
        training_session.exercise_sessions.destroy_all
        workout.exercise_workouts.each_with_index do |exercise_workout, index|
          exercise_row = workout_row.exercises[index]
          training_session.train(
            exercise_workout.exercise,
{'fraction_non_alphanumeric': 0.08628005657708628, 'fraction_numerical': 0.000942951438000943, 'mean_word_length': 3.534188034188034, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5367587', 'n_tokens_mistral': 691, 'n_tokens_neox': 672, 'n_words': 131}