dgs.utils.files.to_abspath

dgs.utils.files.to_abspath(filepath: str, root: str = '/home/runner/work/dynamically-gated-similarities/dynamically-gated-similarities') str[source]

Given a path return the absolute path of this file or directory. Will first check if the filepath already is an absolute file or path and then if it is a local project file.

Parameters:
  • filepath – str or path object as local or abspath.

  • root (FilePath) – The absolute path to the root of the project. It can be modified to point to other locations. Default: PROJECT_ROOT.

Returns:

A valid path, if one exists, as an absolute and normalized path.

Raises:

InvalidPathException – If the path doesn’t exist globally or locally.