Skip to content

Commit ac68c3b

Browse files
Yvan13120iMicknl
andauthored
Convert integer values to float in value_as_float() function (#1773)
* models.py Variables can sometimes be of type integer, which generates an error line 334 * Modify function to always return a float --------- Co-authored-by: Mick Vleeshouwer <mick@imick.nl>
1 parent 45ae5cf commit ac68c3b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

pyoverkiz/models.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,8 @@ def value_as_float(self) -> float | None:
331331
return None
332332
if self.type == DataType.FLOAT:
333333
return cast(float, self.value)
334+
if self.type == DataType.INTEGER:
335+
return float(cast(int, self.value))
334336
raise TypeError(f"{self.name} is not a float")
335337

336338
@property

0 commit comments

Comments
 (0)