Skip to content

Commit 2918597

Browse files
committed
[OMCSessionZMQ] cleanup / remove OMCSessionZMQ compatibility class
1 parent b1aba64 commit 2918597

File tree

2 files changed

+2
-78
lines changed

2 files changed

+2
-78
lines changed

OMPython/OMCSession.py

Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -535,82 +535,6 @@ def get_cmd(self) -> list[str]:
535535
return cmdl
536536

537537

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

0 commit comments

Comments
 (0)