code: def tmp_digits_dataset(
      prefix: str,
      train_line_count: int,
      train_line_count_empty: int,
      train_max_length: int,
      dev_line_count: int,
      dev_max_length: int,
      test_line_count: int,
      test_line_count_empty: int,
      test_max_length: int,
      sort_target: bool = False,
      seed_train: int = 13,
      seed_dev: int = 13,
      source_text_prefix_token: str = "",
      with_n_source_factors: int = 0,
      with_n_target_factors: int = 0,
  ) -> Dict[str, Any]:
      """
      Creates a temporary dataset with train, dev, and test. Returns a dictionary with paths to the respective temporary
      files.
      """
      if source_text_prefix_token:
          sockeye.utils.check_condition(
              with_n_source_factors == 0,
              "The digits dataset does not support source factors and source text prefix token "
              "at the same time.",
          )
      with TemporaryDirectory(prefix=prefix) as work_dir:
          # Simple digits files for train/dev data
          train_source_path = os.path.join(work_dir, "train.src")
          train_target_path = os.path.join(work_dir, "train.tgt")
          dev_source_path = os.path.join(work_dir, "dev.src")
          dev_target_path = os.path.join(work_dir, "dev.tgt")
          test_source_path = os.path.join(work_dir, "test.src")
          test_target_path = os.path.join(work_dir, "test.tgt")
          test_source_with_target_prefix_path = os.path.join(
              work_dir, "test_source_with_target_prefix.json"
          )
          generate_digits_file(
              train_source_path,
              train_target_path,
              train_line_count,
              train_max_length,
              line_count_empty=train_line_count_empty,
              sort_target=sort_target,
              seed=seed_train,
              source_text_prefix_token=source_text_prefix_token,
          )
          generate_digits_file(
              dev_source_path,
              dev_target_path,
              dev_line_count,
              dev_max_length,
              sort_target=sort_target,
              seed=seed_dev,
              source_text_prefix_token=source_text_prefix_token,
          )
          generate_digits_file(
              test_source_path,
              test_target_path,
              test_line_count,
              test_max_length,
              line_count_empty=test_line_count_empty,
              sort_target=sort_target,
              seed=seed_dev,
              source_text_prefix_token=source_text_prefix_token,
          )
          data = {
              "work_dir": work_dir,
              "train_source": train_source_path,
              "train_target": train_target_path,
              "dev_source": dev_source_path,
              "dev_target": dev_target_path,
              "test_source": test_source_path,
              "test_target": test_target_path,
              "test_source_with_target_prefix": test_source_with_target_prefix_path,
          }
  
          if with_n_source_factors > 0:
              data["train_source_factors"] = []
              data["dev_source_factors"] = []
              data["test_source_factors"] = []
              for i in range(with_n_source_factors):
                  train_factor_path = (
                      train_source_path + ".factors%d" % i
                  )
                  dev_factor_path = dev_source_path + ".factors%d" % i
                  test_factor_path = test_source_path + ".factors%d" % i
                  generate_low_high_factors(
                      train_source_path, train_factor_path
                  )
                  generate_low_high_factors(
                      dev_source_path, dev_factor_path
                  )
                  generate_low_high_factors(
                      test_source_path, test_factor_path
                  )
                  data["train_source_factors"].append(train_factor_path)
                  data["dev_source_factors"].append(dev_factor_path)
                  data["test_source_factors"].append(test_factor_path)
  
          if with_n_target_factors > 0:
              data["train_target_factors"] = []
              data["dev_target_factors"] = []
              data["test_target_factors"] = []
              for i in range(with_n_target_factors):
                  train_factor_path = (
                      train_target_path + ".factors%d" % i
                  )
                  dev_factor_path = dev_target_path + ".factors%d" % i
                  test_factor_path = test_target_path + ".factors%d" % i
                  generate_odd_even_factors(
                      train_target_path, train_factor_path
                  )
                  generate_odd_even_factors(
                      dev_target_path, dev_factor_path
                  )
                  generate_odd_even_factors(
                      test_target_path, test_factor_path
                  )
                  data["train_target_factors"].append(train_factor_path)
                  data["dev_target_factors"].append(dev_factor_path)
                  data["test_target_factors"].append(test_factor_path)
  
          source_factors_path = (
              None
              if "test_source_factors" not in data
              else data["test_source_factors"]
          )
          target_factors_path = (
              None
              if "test_target_factors" not in data
              else data["test_target_factors"]
          )
          generate_json_input_file_with_tgt_prefix(
              test_source_path,
              test_target_path,
              test_source_with_target_prefix_path,
              source_factors_path,
              target_factors_path,
          )
          yield data
  
imports: import json
  import logging
  import os
  import random
  import sys
  from contextlib import contextmanager
  from tempfile import TemporaryDirectory
  from typing import Any, Dict, List, Optional
  from unittest.mock import patch
  import sockeye.constants
  import sockeye.prepare_data
  import sockeye.train
  import sockeye.translate
  import sockeye.lexicon
  import sockeye.utils
label_desc: Use image node_id 6 for calling a global function with example usage: tmp_digits_dataset(prefix, train_line_count, train_line_count_empty, train_max_length, dev_line_count, dev_max_length, test_line_count, test_line_count_empty, test_max_length, sort_target, seed_train, seed_dev, source_text_prefix_token, with_n_source_factors, with_n_target_factors) without return types