Source code for core.IOInterface

from abc import ABC, abstractmethod
from pathlib import Path

from core.BooleanFunction import BooleanFunction


[docs] class IOInterface(ABC):
[docs] @abstractmethod def to_string(self) -> str: pass
[docs] @staticmethod @abstractmethod def from_string(content: str) -> BooleanFunction: pass
[docs] @staticmethod @abstractmethod def read(filepath: Path) -> BooleanFunction: pass
[docs] def write(self, file_path: Path): with open(file_path, 'w') as f: content = self.to_string() f.write(content)