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

Function extract_licenses

deploy/sbom/sbom_to_csv.py:21–31  ·  view source on GitHub ↗

Pull license IDs/names from CycloneDX license entries.

(component: dict)

Source from the content-addressed store, hash-verified

19
20
21def extract_licenses(component: dict) -> str:
22 """Pull license IDs/names from CycloneDX license entries."""
23 licenses = component.get("licenses", [])
24 ids = []
25 for entry in licenses:
26 if "expression" in entry:
27 ids.append(entry["expression"])
28 else:
29 lic = entry.get("license", {})
30 ids.append(lic.get("id") or lic.get("name", ""))
31 return " | ".join(filter(None, ids))
32
33
34def sbom_to_csv(json_path: Path) -> Path:

Callers 1

sbom_to_csvFunction · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected