Return the registry group for a component.
(comp: dict)
| 361 | |
| 362 | |
| 363 | def _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 | |
| 386 | def _resolve_one(key: str, comp: dict) -> tuple[str, str | None]: |