byoc.relpath
- byoc.relpath(context: byoc.Context, root_from_meta: typing.Callable[typing.Any, byoc.Path] = <function <lambda>>) byoc.Path
Resolve paths loaded from a file. Relative paths are interpreted as being relative to the parent directory of the file they were loaded from.
- Parameters
context – The context object provided by BYOC to cast functions.
root_from_meta – A callable that returns the parent directory for relative paths, given a metadata object describing how the value in question was loaded. The default implementation assumes that the metadata object has a
location
attribute that specifies the path to the relevant file. This will work if (i) the value was actually loaded from a file and (ii) the default pick function was used (i.e.first
). For other pick functions, you may need to modify this argument accordingly.
- Returns
An absolute path.