quantlab.utils.cli.inside_repository#

quantlab.utils.cli.inside_repository(paths, repo_root)[source]#

Return the paths that resolve inside repo_root.

A script whose output is licensed data (Sharadar’s raw tables and the stores built from them) refuses a directory inside the repository, so the data can never be committed. Symlinks are resolved, so a link out of the repository passes and a link into it does not. Neither directory needs to exist.

Parameters:
pathsiterable of path-like

The directories to check.

repo_rootpath-like

The repository’s top directory.

Returns:
list[pathlib.Path]

The offending paths, as given, in order; empty when none is inside.

Examples

>>> inside_repository([Path("/data/raw"), Path("/home/me/quantlab/data")],
...                   Path("/home/me/quantlab"))
[PosixPath('/home/me/quantlab/data')]