refactor: split export_native and the exporters

This commit is contained in:
Abdessamad Derraz committed 2026-11-17 07:54:04 +01:00
1 parent e27a808f1b
commit fd60b10de6
14 files changed
+685 -514

No files matched your search

+8 -3
View File
@@ -9,11 +9,16 @@ the data block hands the maintainer something that no longer runs.
from __future__ import annotations
from abc import ABC, abstractmethod
from typing import Generic, TypeVar, Union
from .baseline import NativeFile, NativeSystem, Report
# What a produced file holds: text for every format, bytes besides for one
# that also hands back an archive (MiSTer's bios_db.json.zip).
Content = TypeVar("Content", bound=Union[str, bytes])
class BaseExporter(ABC):
class BaseExporter(ABC, Generic[Content]):
"""Base class for writing a platform's own BIOS file, corrected."""
# A hash field the checker compares to one value: an addition the
@@ -77,14 +82,14 @@ class BaseExporter(ABC):
report: Report,
originals: dict[str, str],
scraped: dict | None = None,
) -> dict[str, str]:
) -> dict[str, Content]:
"""Return {relative output path: file content}."""
@abstractmethod
def validate(
self,
systems: dict[str, NativeSystem],
produced: dict[str, str],
produced: dict[str, Content],
) -> list[str]:
"""Check the produced files against what was asked of them."""