Coverage for sparkle/types/sparkle_callable.py: 88%
16 statements
« prev ^ index » next coverage.py v7.10.7, created at 2025-09-29 10:17 +0000
« prev ^ index » next coverage.py v7.10.7, created at 2025-09-29 10:17 +0000
1"""Abstract class Sparkle Callable."""
3from __future__ import annotations
4from pathlib import Path
7class SparkleCallable:
8 """Sparkle Callable class."""
10 def __init__(
11 self: SparkleCallable, directory: Path, runsolver_exec: Path = None
12 ) -> None:
13 """Initialize callable.
15 Args:
16 directory: Directory of the callable.
17 runsolver_exec: Path to the runsolver executable.
18 By default, runsolver in solver_directory.
19 """
20 self.directory = directory
21 self.name = directory.name
22 self._runsolver_exec = runsolver_exec
24 @property
25 def runsolver_exec(self: SparkleCallable) -> Path:
26 """Return the path of the runsolver executable."""
27 if self._runsolver_exec is None:
28 return self.directory / "runsolver"
29 return self._runsolver_exec
31 def build_cmd(self: SparkleCallable) -> list[str | Path]:
32 """A method that builds the commandline call string."""
33 return NotImplementedError
35 def run(self: SparkleCallable) -> None:
36 """A method that runs the callable."""
37 return NotImplementedError