MCPcopy
hub / github.com/p-e-w/heretic / format_hf_link

Function format_hf_link

src/heretic/utils.py:397–410  ·  view source on GitHub ↗
(
    path: str,
    commit: str | None = None,
    is_dataset: bool = False,
)

Source from the content-addressed store, hash-verified

395
396
397def format_hf_link(
398 path: str,
399 commit: str | None = None,
400 is_dataset: bool = False,
401) -> str:
402 prefix = "datasets/" if is_dataset else ""
403 base_url = f"https://huggingface.co/{prefix}{path}"
404 link = f"[{path}]({base_url})"
405
406 if commit:
407 commit_url = f"{base_url}/commit/{commit}"
408 link += f" (Commit: [`{commit[:7]}`]({commit_url}))"
409
410 return link
411
412
413def generate_reproduce_readme(

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected