code: def progress_iter(
      stages: Dict[str, StageInfo]
  ) -> Iterator[Tuple[str, StageInfo]]:
      total = len(stages)
      desc = "Adding..."
      with ui.progress(
          stages.items(),
          total=total,
          desc=desc,
          unit="file",
          leave=True,
      ) as pbar:
          if total == 1:
              pbar.bar_format = desc
              pbar.refresh()
  
          for item, stage_info in pbar:
              if total > 1:
                  pbar.set_msg(str(stage_info.stage.outs[0]))
                  pbar.refresh()
              yield item, stage_info
              if total == 1:  # restore bar format for stats
                  pbar.bar_format = pbar.BAR_FMT_DEFAULT
  
file_path: dvc/dvc/repo/add.py
imports: import os
  from contextlib import contextmanager
  from typing import TYPE_CHECKING, Dict, Iterator, List, NamedTuple, Optional, Tuple, Union
  from dvc.exceptions import CacheLinkError, DvcException, OutputDuplicationError, OutputNotFoundError, OverlappingOutputPathsError
  from dvc.repo.scm_context import scm_context
  from dvc.ui import ui
  from dvc.utils import glob_targets, resolve_output, resolve_paths
  from .None import locked
label_desc: Use image node_id 4 for calling a global function with example usage: progress_iter(stages) without return types