Closed
Description
The VariableFactory
just requires the create_variable
method and dims
attribute to a class. However, if the class has to_dict
and is registered for deserialize
function, then that gives the additional benefit of serialization and deserialization. I don't know the best way to type this or if it is even an issue
Maybe there a protocol with optional methods? or something like below should also be specified:
@runtime_checkable
class SerializableVariableFactory(Protocol):
dims: tuple[str, ...]
def create_variable(self, name: str) -> Variable:
...
def to_dict(self) -> dict[str, Any]:
...