class_docstr: Creates paths related to the slurm job and its submission
class_docstr_tok: ["Creates","paths","related","to","the","slurm","job","and","its","submission"]
docstr: Replace id tag by actual id if available
docstr_tok: ["Replace","id","tag","by","actual","id","if","available"]
code: def _format_id(self, path: tp.Union[Path, str]) -> Path:
      """Replace id tag by actual id if available"""
      if self.job_id is None:
          return Path(path)
      replaced_path = (
          str(path)
          .replace("%j", str(self.job_id))
          .replace("%t", str(self.task_id))
      )
      array_id, *array_index = str(self.job_id).split("_", 1)
      if "%a" in replaced_path:
          if len(array_index) != 1:
              raise ValueError(
                  "%a is in the folder path but this is not a job array"
              )
          replaced_path = replaced_path.replace("%a", array_index[0])
      return Path(replaced_path.replace("%A", array_id))
  
imports: import contextlib
  import io
  import itertools
  import os
  import pickle
  import select
  import shutil
  import subprocess
  import sys
  import tarfile
  import typing
  from pathlib import Path
  import cloudpickle
label_desc: Use image node_id 8 for calling the JobPaths obj's underlying member method code with example usage: obj._format_id(path) and returns: Path, Path