code: def _add(
      stage: "Stage",
      source: Optional[str] = None,
      no_commit: bool = False,
  ) -> None:
      out = stage.outs[0]
      path = out.fs.abspath(source) if source else None
      try:
          stage.add_outs(path, no_commit=no_commit)
      except CacheLinkError:
          stage.dump()
          raise
      stage.dump()
  
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 7 for calling a global function with example usage: _add(stage, source, no_commit) without return types