Note
This page is a reference documentation. It only explains the function signature, and not how to use it. Please refer to the user guide for the big picture.
brainprep.utils.utils.coerce_to_path¶
- brainprep.utils.utils.coerce_to_path(value, expected_type)[source]¶
Recursively convert values to pathlib.Path based on expected type annotations.
- Parameters:
- valueAny
The input value to be coerced.
- expected_typetype
The expected type annotation (e.g., File, List[File], Dict[str, Directory], Union[str, Directory]).
- Returns:
- typed_valueAny
The coerced value, with File and Directory converted to pathlib.Path.