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

1"""Abstract class Sparkle Callable.""" 

2 

3from __future__ import annotations 

4from pathlib import Path 

5 

6 

7class SparkleCallable: 

8 """Sparkle Callable class.""" 

9 

10 def __init__( 

11 self: SparkleCallable, directory: Path, runsolver_exec: Path = None 

12 ) -> None: 

13 """Initialize callable. 

14 

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 

23 

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 

30 

31 def build_cmd(self: SparkleCallable) -> list[str | Path]: 

32 """A method that builds the commandline call string.""" 

33 return NotImplementedError 

34 

35 def run(self: SparkleCallable) -> None: 

36 """A method that runs the callable.""" 

37 return NotImplementedError