Source code for jitx.plugin.export
from __future__ import annotations
from abc import abstractmethod, ABC
from typing import TYPE_CHECKING, Any
from ._registry import Plugin
if TYPE_CHECKING:
from jitx.run import RuntimeDesign
[docs]
class ExportError(Exception):
def __init__(self, value: str):
self.value = value
def __str__(self):
return self.value
[docs]
class Export(Plugin, ABC):
[docs]
def preflight(self, *args: Any, **kwargs: Any) -> None:
"""Called before anything is instantiatiated or submitted to the
runtime to allow an early out in case arguments are invalid. Raise an
exception to prevent the export from proceeding."""
[docs]
def submitted(self, design: RuntimeDesign, /, *args: Any, **kwargs: Any):
"""Called after design has been submitted, and currently in process,
but before the runtime state has been captured. Can be used, for
example, to gather information for comparison to the output of the
runtime."""
[docs]
@abstractmethod
def export(self, design: RuntimeDesign, /, *args: Any, **kwargs: Any):
pass