MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / _classify_registry

Function _classify_registry

deploy/sbom/resolve_licenses.py:363–383  ·  view source on GitHub ↗

Return the registry group for a component.

(comp: dict)

Source from the content-addressed store, hash-verified

361
362
363def _classify_registry(comp: dict) -> str:
364 """Return the registry group for a component."""
365 purl = comp.get("purl", "")
366 name = comp.get("name", "")
367 comp_type = comp.get("type", "")
368
369 if name in KNOWN_LICENSES:
370 return "known"
371 if purl.startswith("pkg:cargo/"):
372 return "crates.io"
373 if purl.startswith("pkg:npm/"):
374 return "npm"
375 if purl.startswith("pkg:pypi/"):
376 return "pypi"
377 if purl.startswith("pkg:golang/"):
378 return "golang"
379 if purl.startswith("pkg:deb/"):
380 return "deb"
381 if comp_type == "operating-system" or not purl:
382 return "known"
383 return "other"
384
385
386def _resolve_one(key: str, comp: dict) -> tuple[str, str | None]:

Callers 1

mainFunction · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected