INNER CODE UNIT · Python

_module_exists

valqore/valqore · benchmarks/run_benchmark.py:151

def _module_exists(name: str) -> bool:
    import importlib.util
    return importlib.util.find_spec(name) is not None


def run_kubescape() -> dict:
    if not shutil.which("kubescape"):
        return {"available": False}
    data = _run_json(["kubescape", "scan", str(CORPUS), "--format", "json", "--format-version", "v2"])
    if not data:
        return {"available": False}
    # kubescape v2 JSON: summaryDetails.controls -> failed resources, or results list.
    failed = 0
    try:
        sd = data.get("summaryDetails", {}) if isinstance(data, dict) else {}
        ctrls = sd.get("controls", {}) or {}
        for c in ctrls.values():
            if (c.get("statusInfo", {}) or {}).get("status") == "failed" or c.get("failedResources", 0):

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…