Skip to content

Commit 9ebd429

Browse files
committed
[OMCSessionZMQ] cleanup / remove OMCSessionZMQ compatibility class
1 parent 442e417 commit 9ebd429

File tree

1 file changed

+0
-76
lines changed

1 file changed

+0
-76
lines changed

OMPython/OMCSession.py

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

502502

503-
class OMCSessionZMQ:
504-
"""
505-
This class is a compatibility layer for the new schema using OMCSession* classes.
506-
"""
507-
508-
def __init__(
509-
self,
510-
timeout: float = 10.00,
511-
omhome: Optional[str] = None,
512-
omc_process: Optional[OMCSession] = None,
513-
) -> None:
514-
"""
515-
Initialisation for OMCSessionZMQ
516-
"""
517-
warnings.warn(message="The class OMCSessionZMQ is depreciated and will be removed in future versions; "
518-
"please use OMCProcess* classes instead!",
519-
category=DeprecationWarning,
520-
stacklevel=2)
521-
522-
if omc_process is None:
523-
omc_process = OMCSessionLocal(omhome=omhome, timeout=timeout)
524-
elif not isinstance(omc_process, OMCSession):
525-
raise OMCSessionException("Invalid definition of the OMC process!")
526-
self.omc_process = omc_process
527-
528-
def __del__(self):
529-
del self.omc_process
530-
531-
@staticmethod
532-
def escape_str(value: str) -> str:
533-
"""
534-
Escape a string such that it can be used as string within OMC expressions, i.e. escape all double quotes.
535-
"""
536-
return OMCSession.escape_str(value=value)
537-
538-
def omcpath(self, *path) -> OMCPath:
539-
"""
540-
Create an OMCPath object based on the given path segments and the current OMC process definition.
541-
"""
542-
return self.omc_process.omcpath(*path)
543-
544-
def omcpath_tempdir(self, tempdir_base: Optional[OMCPath] = None) -> OMCPath:
545-
"""
546-
Get a temporary directory using OMC. It is our own implementation as non-local usage relies on OMC to run all
547-
filesystem related access.
548-
"""
549-
return self.omc_process.omcpath_tempdir(tempdir_base=tempdir_base)
550-
551-
def omc_run_data_update(self, omc_run_data: OMCSessionRunData) -> OMCSessionRunData:
552-
"""
553-
Modify data based on the selected OMCProcess implementation.
554-
555-
Needs to be implemented in the subclasses.
556-
"""
557-
return self.omc_process.omc_run_data_update(omc_run_data=omc_run_data)
558-
559-
def run_model_executable(self, cmd_run_data: OMCSessionRunData) -> int:
560-
"""
561-
Run the command defined in cmd_run_data. This class is defined as static method such that there is no need to
562-
keep instances of over classes around.
563-
"""
564-
return self.omc_process.run_model_executable(cmd_run_data=cmd_run_data)
565-
566-
def execute(self, command: str):
567-
return self.omc_process.execute(command=command)
568-
569-
def sendExpression(self, command: str, parsed: bool = True) -> Any:
570-
"""
571-
Send an expression to the OMC server and return the result.
572-
573-
The complete error handling of the OMC result is done within this method using '"getMessagesStringInternal()'.
574-
Caller should only check for OMCSessionException.
575-
"""
576-
return self.omc_process.sendExpression(expr=command, parsed=parsed)
577-
578-
579503
class PostInitCaller(type):
580504
"""
581505
Metaclass definition to define a new function __post_init__() which is called after all __init__() functions where

0 commit comments

Comments
 (0)