Skip to content

trudag.utils

OUTPUT_QUOTE module-attribute

OUTPUT_QUOTE = f'{BLUE}```{RESET_ALL}'

Filename in the root directory assumed to contain a dot graph generated by trudag.

dump_scores

dump_scores(
    scores: dict[str, ItemScore], dump: Path
) -> None

Outputs the provided Trustable scores to a provided dump path as one of the supported files.

get_branch_name

get_branch_name() -> str | None

The branch name

get_ci_job_id

get_ci_job_id() -> str | None

The CI job id

get_commit_sha

get_commit_sha() -> str | None

The git commit sha for HEAD, if it exists.

get_commit_timestamp

get_commit_timestamp() -> int | None

The UNIX timestamp in seconds for commit at HEAD.

get_last_tag

get_last_tag() -> str | None

The most recent git tag (either annotated or lightweight) for HEAD, if it exists.

Returned string has format <latest tag>-<# commits since last tag>-<short SHA> if the current commit is not tagged. If the commit is tagged, return <latest tag>

get_root_dir

get_root_dir() -> str

Returns the top level directory of the git repository. If no git repository is found returns the current working directory.

get_workdir

get_workdir() -> Path

Get the cli working directory.

If the current working directory is a git repo, return the top level directory of the repo. If not, return the current working directory.

make_dotfile

make_dotfile(filepath: Path, graph_name: str) -> None

Make a dotfile representing an empty database at path and using a graph_name.