Utilities#

General-purpose path and config resolution helpers used throughout the pipeline.

thesis.core.utils#

Core utility functions for path and config handling.

thesis.core.utils.utils.to_path(v)[source]#
Overloads:
  • v (None) → None

  • v (Union[str, Path]) → Path

Parameters:

v (str | Path | None)

Return type:

Path | None

Convert a string or Path to a Path object, expanding ~ and environment variables.

Parameters:

v (Union[str, Path, None]) – Path value as string, Path, or None

Returns:

Expanded Path object, or None if input was None

Return type:

Path | None

thesis.core.utils.utils.resolve_path(base, value)[source]#

Resolve a path relative to a base directory, expanding ~ and environment variables.

Parameters:
  • base (Path) – Base directory for relative paths

  • value (Union[Path, str]) – Path to resolve (absolute or relative)

Return type:

Path

Returns:

Resolved Path object. If value is absolute, returns it expanded. Otherwise, returns base / expanded_value.

thesis.core.utils.utils.write_list_file(paths, out_file)[source]#

Write a list of paths to a text file, one per line.

Parameters:
  • paths (Iterable[Path]) – Iterable of Path objects to write

  • out_file (Path) – Output file path

Return type:

Path

Returns:

Path to the written file