code: def read_v1_context(
      context_root: Optional[pathlib.Path],
      includes: Iterable[pathlib.Path] = (),
      limit: int = constants.MAX_CONTEXT_SIZE,
  ) -> List[bindings.v1File]:
      """
      Return a list of v1Files suitable for submitting a context directory over the v1 REST API.
  
      A .detignore file in a context or include directory, if specified, indicates the wildcard paths
      that should be ignored.  File paths inside the context_root are relative to the context_root.
      File paths from includes are prefixed by the basename of the included directory.
      """
  
      if context_root is None and not includes:
          return []
  
      builder = _Builder(limit)
  
      if context_root is not None:
          # --context must always be a directory.
          if context_root.is_file():
              raise ValueError(
                  f"context path '{context_root}' must be a directory, maybe use an include instead?"
              )
          builder.add(context_root, pathlib.Path(""))
      for i in includes:
          # Some paths like "/" don't have a name we can assign within the tarball.
          name = i.resolve().name
          if not name:
              raise ValueError(
                  f"unable to determine the name of include '{i}'"
              )
          builder.add(i, pathlib.Path(name))
  
      return builder.get_items()
  
file_path: determined/harness/determined/common/context.py
imports: import collections
  import pathlib
  from typing import Any, Dict, Iterable, List, Optional
  from determined.common import constants, detignore, util, v1file_utils
  from determined.common.api import bindings
label_desc: Use image node_id 1 for calling a global function with example usage: read_v1_context(context_root, includes, limit) and returns: builder, list