Skip to content

Commit 70336b9

Browse files
committed
Allow float timeouts
The type hints were misleadingly saying int, when in fact subprocess.run accepts float timeouts.
1 parent 6104f06 commit 70336b9

1 file changed

Lines changed: 3 additions & 12 deletions

File tree

OMPython/ModelicaSystem.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -117,16 +117,7 @@ class ModelicaSystemCmd:
117117
Execute a simulation by running the compiled model.
118118
"""
119119

120-
def __init__(self, runpath: pathlib.Path, modelname: str, timeout: Optional[int] = None) -> None:
121-
"""
122-
Initialisation
123-
124-
Parameters
125-
----------
126-
runpath : pathlib.Path
127-
modelname : str
128-
timeout : Optional[int], None
129-
"""
120+
def __init__(self, runpath: pathlib.Path, modelname: str, timeout: Optional[float] = None) -> None:
130121
self._runpath = pathlib.Path(runpath).resolve().absolute()
131122
self._modelname = modelname
132123
self._timeout = timeout
@@ -819,7 +810,7 @@ def simulate(self,
819810
resultfile: Optional[str] = None,
820811
simflags: Optional[str] = None,
821812
simargs: Optional[dict[str, Optional[str | dict[str, str]]]] = None,
822-
timeout: Optional[int] = None) -> None:
813+
timeout: Optional[float] = None) -> None:
823814
"""Simulate the model according to simulation options.
824815
825816
See setSimulationOptions().
@@ -1212,7 +1203,7 @@ def optimize(self): # 21
12121203

12131204
def linearize(self, lintime: Optional[float] = None, simflags: Optional[str] = None,
12141205
simargs: Optional[dict[str, Optional[str | dict[str, str]]]] = None,
1215-
timeout: Optional[int] = None) -> LinearizationResult:
1206+
timeout: Optional[float] = None) -> LinearizationResult:
12161207
"""Linearize the model according to linearization options.
12171208
12181209
See setLinearizationOptions.

0 commit comments

Comments
 (0)