datalad_next.constraints.EnsurePath
- class datalad_next.constraints.EnsurePath(*, path_type: type = <class 'pathlib.Path'>, is_format: str | None = None, lexists: bool | None = None, is_mode: Callable | None = None, ref: Path | None = None, ref_is: str = 'parent-or-same-as', dsarg: DatasetParameter | None = None)[source]
Bases:
Constraint
Ensures input is convertible to a (platform) path and returns a Path
Optionally, the path can be tested for existence and whether it is absolute or relative.
- for_dataset(dataset: DatasetParameter) Constraint [source]
Return an similarly parametrized variant that resolves paths against a given dataset (argument)