Skip to content

Commit 2e0f365

Browse files
committed
[OMCCmd] session => omc_process
1 parent f07ebb3 commit 2e0f365

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

OMPython/OMCSession.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,10 @@ class OMCCmd:
9999
Implementation of Open Modelica Compiler API functions. Depreciated!
100100
"""
101101

102-
def __init__(self, session: OMCSessionZMQ, readonly: bool = False):
103-
if not isinstance(session, OMCSessionZMQ):
104-
raise OMCProcessException("Invalid session definition!")
105-
self._session = session
102+
def __init__(self, omc_process: OMCProcess, readonly: bool = False):
103+
if not isinstance(omc_process, OMCProcess):
104+
raise OMCProcessException("Invalid OMC process definition!")
105+
self._omc_process = omc_process
106106
self._readonly = readonly
107107
self._omc_cache: dict[tuple[str, bool], Any] = {}
108108

@@ -123,7 +123,7 @@ def _ask(self, question: str, opt: Optional[list[str]] = None, parsed: bool = Tr
123123
return self._omc_cache[p]
124124

125125
try:
126-
res = self._session.sendExpression(expression, parsed=parsed)
126+
res = self._omc_process.sendExpression(expression, parsed=parsed)
127127
except OMCProcessException as ex:
128128
raise OMCProcessException(f"OMC _ask() failed: {expression} (parsed={parsed})") from ex
129129

tests/test_OMSessionCmd.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
def test_isPackage():
55
omczmq = OMPython.OMCSessionZMQ()
6-
omccmd = OMPython.OMCCmd(session=omczmq)
6+
omccmd = OMPython.OMCCmd(omc_process=omczmq)
77
assert not omccmd.isPackage('Modelica')
88

99

@@ -13,7 +13,7 @@ def test_isPackage2():
1313
model_name="Modelica.Electrical.Analog.Examples.CauerLowPassAnalog",
1414
libraries=["Modelica"],
1515
)
16-
omccmd = OMPython.OMCCmd(session=mod.get_omc_process())
16+
omccmd = OMPython.OMCCmd(omc_process=mod.get_omc_process())
1717
assert omccmd.isPackage('Modelica')
1818

1919

0 commit comments

Comments
 (0)