feat(slice-1): implement tracer bullet pipeline with PyYAML check and pure-python fallback
This commit is contained in:
1 parent
937acc2548
commit
68802710b0
12 files changed
+331
-1
No files matched your search
@@ -0,0 +1,16 @@
|
||||
from abc import ABC, abstractmethod
|
||||
from pathlib import Path
|
||||
from inventory_collector.models import InventoryData
|
||||
|
||||
class BaseExporter(ABC):
|
||||
@abstractmethod
|
||||
def export(self, data: InventoryData) -> str:
|
||||
"""Export inventory data to a formatted string representation."""
|
||||
raise NotImplementedError
|
||||
|
||||
def write_to_file(self, data: InventoryData, target: Path) -> None:
|
||||
"""Export inventory data and write to target path, creating parent dirs if needed."""
|
||||
target = Path(target).expanduser().resolve()
|
||||
target.parent.mkdir(parents=True, exist_ok=True)
|
||||
content = self.export(data)
|
||||
target.write_text(content, encoding="utf-8")
|
||||
Reference in new issue
Block a user