gui.model.inside_repository

gui.model.inside_repository(root, path)

Whether a file lies below the repository root (symbolic links resolved).

Parameters

Name Type Description Default
root Path | str The repository root. required
path Path The file, which need not exist. required

Returns

Name Type Description
bool bool True if path is the root or below it.

Examples

from pathlib import Path

from spotregen.gui.model import inside_repository

print(inside_repository("/work/demo", Path("/work/demo/regen/runs/a.md")))
print(inside_repository("/work/demo", Path("/tmp/a.md")))
True
False