fix: stop on one line when pyyaml is missing

This commit is contained in:
Abdessamad Derraz committed 2026-11-21 05:59:51 +01:00
1 parent eef13547e1
commit 7be8a7cd7b
7 files changed
+22 -30

No files matched your search

+2 -5
View File
@@ -11,6 +11,7 @@ import pkgutil
from abc import ABC, abstractmethod
from pathlib import Path
from model.safeparse import require_yaml
from model.sourcerevision import platform_revision
# Every target scraper reads the network through the platform scrapers'
@@ -48,14 +49,10 @@ class BaseTargetScraper(ABC):
def write_output(self, data: dict, output_path: str) -> None:
"""Write target data to YAML file."""
try:
import yaml
except ImportError as exc:
raise ImportError("PyYAML required: pip install pyyaml") from exc
from core.artifacts import write_text_atomic
write_text_atomic(
output_path, yaml.dump(data, default_flow_style=False, sort_keys=False)
output_path, require_yaml().dump(data, default_flow_style=False, sort_keys=False)
)