Skip to content

Commit 3a851c2

Browse files
committed
[OMCSessionZMQ] cleanup / remove OMCSessionZMQ compatibility class
1 parent d7deb6b commit 3a851c2

File tree

2 files changed

+2
-79
lines changed

2 files changed

+2
-79
lines changed

OMPython/OMCSession.py

Lines changed: 0 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -537,83 +537,6 @@ def get_cmd(self) -> list[str]:
537537
return cmdl
538538

539539

540-
class OMCSessionZMQ:
541-
"""
542-
This class is a compatibility layer for the new schema using OMCSession* classes.
543-
"""
544-
545-
def __init__(
546-
self,
547-
timeout: float = 10.00,
548-
omhome: Optional[str] = None,
549-
omc_process: Optional[OMCSession] = None,
550-
) -> None:
551-
"""
552-
Initialisation for OMCSessionZMQ
553-
"""
554-
warnings.warn(message="The class OMCSessionZMQ is depreciated and will be removed in future versions; "
555-
"please use OMCProcess* classes instead!",
556-
category=DeprecationWarning,
557-
stacklevel=2)
558-
559-
if omc_process is None:
560-
omc_process = OMCSessionLocal(omhome=omhome, timeout=timeout)
561-
elif not isinstance(omc_process, OMCSession):
562-
raise OMCSessionException("Invalid definition of the OMC process!")
563-
self.omc_process = omc_process
564-
565-
def __del__(self):
566-
del self.omc_process
567-
568-
@staticmethod
569-
def escape_str(value: str) -> str:
570-
"""
571-
Escape a string such that it can be used as string within OMC expressions, i.e. escape all double quotes.
572-
"""
573-
return OMCSession.escape_str(value=value)
574-
575-
def omcpath(self, *path) -> OMCPath:
576-
"""
577-
Create an OMCPath object based on the given path segments and the current OMC process definition.
578-
"""
579-
return self.omc_process.omcpath(*path)
580-
581-
def omcpath_tempdir(self, tempdir_base: Optional[OMCPath] = None) -> OMCPath:
582-
"""
583-
Get a temporary directory using OMC. It is our own implementation as non-local usage relies on OMC to run all
584-
filesystem related access.
585-
"""
586-
return self.omc_process.omcpath_tempdir(tempdir_base=tempdir_base)
587-
588-
def omc_run_data_update(self, omc_run_data: OMCSessionRunData) -> OMCSessionRunData:
589-
"""
590-
Modify data based on the selected OMCProcess implementation.
591-
592-
Needs to be implemented in the subclasses.
593-
"""
594-
return self.omc_process.omc_run_data_update(omc_run_data=omc_run_data)
595-
596-
@staticmethod
597-
def run_model_executable(cmd_run_data: OMCSessionRunData) -> int:
598-
"""
599-
Run the command defined in cmd_run_data. This class is defined as static method such that there is no need to
600-
keep instances of over classes around.
601-
"""
602-
return OMCSession.run_model_executable(cmd_run_data=cmd_run_data)
603-
604-
def execute(self, command: str):
605-
return self.omc_process.execute(command=command)
606-
607-
def sendExpression(self, command: str, parsed: bool = True) -> Any:
608-
"""
609-
Send an expression to the OMC server and return the result.
610-
611-
The complete error handling of the OMC result is done within this method using '"getMessagesStringInternal()'.
612-
Caller should only check for OMCSessionException.
613-
"""
614-
return self.omc_process.sendExpression(command=command, parsed=parsed)
615-
616-
617540
class PostInitCaller(type):
618541
"""
619542
Metaclass definition to define a new function __post_init__() which is called after all __init__() functions where

OMPython/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
OMCSessionCmd,
4848
OMCSessionException,
4949
OMCSessionRunData,
50-
OMCSessionZMQ,
50+
OMCSession,
5151
OMCSessionPort,
5252
OMCSessionLocal,
5353
OMCSessionDocker,
@@ -66,7 +66,7 @@
6666
'OMCSessionCmd',
6767
'OMCSessionException',
6868
'OMCSessionRunData',
69-
'OMCSessionZMQ',
69+
'OMCSession',
7070
'OMCSessionPort',
7171
'OMCSessionLocal',
7272
'OMCSessionDocker',

0 commit comments

Comments
 (0)