Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 0 additions & 76 deletions OMPython/OMCSession.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,82 +500,6 @@ def get_cmd(self) -> list[str]:
return cmdl


class OMCSessionZMQ:
"""
This class is a compatibility layer for the new schema using OMCSession* classes.
"""

def __init__(
self,
timeout: float = 10.00,
omhome: Optional[str] = None,
omc_process: Optional[OMCSession] = None,
) -> None:
"""
Initialisation for OMCSessionZMQ
"""
warnings.warn(message="The class OMCSessionZMQ is depreciated and will be removed in future versions; "
"please use OMCProcess* classes instead!",
category=DeprecationWarning,
stacklevel=2)

if omc_process is None:
omc_process = OMCSessionLocal(omhome=omhome, timeout=timeout)
elif not isinstance(omc_process, OMCSession):
raise OMCSessionException("Invalid definition of the OMC process!")
self.omc_process = omc_process

def __del__(self):
del self.omc_process

@staticmethod
def escape_str(value: str) -> str:
"""
Escape a string such that it can be used as string within OMC expressions, i.e. escape all double quotes.
"""
return OMCSession.escape_str(value=value)

def omcpath(self, *path) -> OMCPath:
"""
Create an OMCPath object based on the given path segments and the current OMC process definition.
"""
return self.omc_process.omcpath(*path)

def omcpath_tempdir(self, tempdir_base: Optional[OMCPath] = None) -> OMCPath:
"""
Get a temporary directory using OMC. It is our own implementation as non-local usage relies on OMC to run all
filesystem related access.
"""
return self.omc_process.omcpath_tempdir(tempdir_base=tempdir_base)

def omc_run_data_update(self, omc_run_data: OMCSessionRunData) -> OMCSessionRunData:
"""
Modify data based on the selected OMCProcess implementation.

Needs to be implemented in the subclasses.
"""
return self.omc_process.omc_run_data_update(omc_run_data=omc_run_data)

def run_model_executable(self, cmd_run_data: OMCSessionRunData) -> int:
"""
Run the command defined in cmd_run_data. This class is defined as static method such that there is no need to
keep instances of over classes around.
"""
return self.omc_process.run_model_executable(cmd_run_data=cmd_run_data)

def execute(self, command: str):
return self.omc_process.execute(command=command)

def sendExpression(self, command: str, parsed: bool = True) -> Any:
"""
Send an expression to the OMC server and return the result.

The complete error handling of the OMC result is done within this method using '"getMessagesStringInternal()'.
Caller should only check for OMCSessionException.
"""
return self.omc_process.sendExpression(command=command, parsed=parsed)


class PostInitCaller(type):
"""
Metaclass definition to define a new function __post_init__() which is called after all __init__() functions where
Expand Down
2 changes: 0 additions & 2 deletions OMPython/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
OMCSessionCmd,
OMCSessionException,
OMCSessionRunData,
OMCSessionZMQ,
OMCSessionPort,
OMCSessionLocal,
OMCSessionDocker,
Expand All @@ -42,7 +41,6 @@
'OMCSessionCmd',
'OMCSessionException',
'OMCSessionRunData',
'OMCSessionZMQ',
'OMCSessionPort',
'OMCSessionLocal',
'OMCSessionDocker',
Expand Down
Loading