Skip to content

Commit c80d31d

Browse files
committed
[ModelicaSystem] try to make mypy happy
1 parent f958964 commit c80d31d

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

OMPython/ModelicaSystem.py

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1469,15 +1469,15 @@ def load_module_from_path(module_name, file_path):
14691469
overrideLinearFile = self._tempdir / f'{self._model_name}_override_linear.txt'
14701470

14711471
with open(file=overrideLinearFile, mode="w", encoding="utf-8") as fh:
1472-
for key, value in self._override_variables.items():
1473-
fh.write(f"{key}={value}\n")
1474-
for key, value in self._linearization_options.items():
1475-
fh.write(f"{key}={value}\n")
1472+
for key1, value1 in self._override_variables.items():
1473+
fh.write(f"{key1}={value1}\n")
1474+
for key2, value2 in self._linearization_options.items():
1475+
fh.write(f"{key2}={value2}\n")
14761476

14771477
om_cmd.arg_set(key="overrideFile", val=overrideLinearFile.as_posix())
14781478

14791479
if self._has_inputs:
1480-
nameVal = self.getInputs()
1480+
nameVal = self._inputs
14811481
for n in nameVal:
14821482
tupleList = nameVal.get(n)
14831483
if tupleList is not None:
@@ -1524,8 +1524,20 @@ def load_module_from_path(module_name, file_path):
15241524
self._linearized_inputs = inputVars
15251525
self._linearized_outputs = outputVars
15261526
self._linearized_states = stateVars
1527-
return LinearizationResult(n, m, p, A, B, C, D, x0, u0, stateVars,
1528-
inputVars, outputVars)
1527+
# TODO: why is here a mypy warning?
1528+
return LinearizationResult(
1529+
int(n),
1530+
int(m),
1531+
int(p),
1532+
A,
1533+
B,
1534+
C,
1535+
D,
1536+
x0,
1537+
u0,
1538+
stateVars,
1539+
inputVars,
1540+
outputVars)
15291541
except ModuleNotFoundError as ex:
15301542
raise ModelicaSystemError("No module named 'linearized_model'") from ex
15311543

0 commit comments

Comments
 (0)