code: def _get_stage_files(stage: "Stage") -> List[str]:
      from dvc.dvcfile import ProjectFile
      from dvc.utils import relpath
  
      ret: List[str] = []
      file = stage.dvcfile
      ret.append(file.relpath)
      if isinstance(file, ProjectFile):
          ret.append(file._lockfile.relpath)
  
      for dep in stage.deps:
          if (
              not dep.use_scm_ignore
              and dep.is_in_repo
              and not stage.repo.dvcfs.isdvc(
                  stage.repo.dvcfs.from_os_path(str(dep))
              )
          ):
              ret.append(relpath(dep.fs_path))
  
      for out in stage.outs:
          if not out.use_scm_ignore and out.is_in_repo:
              ret.append(relpath(out.fs_path))
      return ret
  
imports: import os
  import pathlib
  from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union
  from funcy import concat, first, lsplit, rpartial
  from dvc.annotations import ANNOTATION_FIELDS
  from dvc.exceptions import InvalidArgumentError
  from dvc_data.hashfile.meta import Meta
  from .exceptions import MissingDataSource, StageExternalOutputsError, StagePathNotDirectoryError, StagePathNotFoundError, StagePathOutsideError
label_desc: Use image node_id 17 for calling a global function with example usage: _get_stage_files(stage) and returns: ret