code: def _collect_params(
      repo: "Repo",
      targets: Union[List[str], Dict[str, List[str]], None] = None,
      stages: Optional[List[str]] = None,
      deps_only: bool = False,
      default_file: Optional[str] = None,
  ) -> Dict[str, List[str]]:
      from dvc.dependency import _merge_params
  
      if isinstance(targets, list):
          targets = {target: [] for target in targets}
  
      params: List[Dict[str, List[str]]] = []
  
      if targets:
          # target is a repo-relative path
          params.extend(
              {file: params} for file, params in targets.items()
          )
  
      if not targets or stages:
          deps = (
              params_from_target(repo, stages)
              if stages
              else repo.index.params
          )
          relpath = repo.fs.relpath
          params.extend(
              {relpath(dep.fs_path, repo.root_dir): list(dep.params)}
              for dep in deps
          )
  
      fs = repo.dvcfs
  
      if not targets and not deps_only and not stages:
          # _collect_top_level_params returns repo-relative paths
          params.extend(
              {param: []} for param in _collect_top_level_params(repo)
          )
          if default_file and fs.exists(
              f"{fs.root_marker}{default_file}"
          ):
              params.append({default_file: []})
  
      # combine all the param files and the keypaths to track
      all_params = _merge_params(params)
  
      ret = {}
      for param, _params in all_params.items():
          # convert to posixpath for DVCFileSystem
          path = fs.from_os_path(param)
          # make paths absolute for DVCFileSystem
          repo_path = f"{fs.root_marker}{path}"
          ret.update(
              {file: _params for file in expand_paths(fs, [repo_path])}
          )
      return ret
  
file_path: dvc/dvc/repo/params/show.py
imports: import os
  from collections import defaultdict
  from itertools import chain
  from typing import TYPE_CHECKING, Any, Dict, Iterator, List, Optional, Tuple, Union
  from dvc.dependency.param import ParamsDependency, read_param_file
  from dvc.log import logger
  from dvc.repo.metrics.show import FileResult, Result
  from dvc.stage import PipelineStage
  from dvc.utils import as_posix, expand_paths
  from dvc.utils.collections import ensure_list
label_desc: Use image node_id 3 for calling a global function with example usage: _collect_params(repo, targets, stages, deps_only, default_file) and returns: ret