@@ -691,67 +691,6 @@ def run(self) -> int:
691691 return returncode
692692
693693
694- class OMCSessionZMQ :
695- """
696- This class is a compatibility layer for the new schema using OMCSession* classes.
697- """
698-
699- def __init__ (
700- self ,
701- timeout : float = 10.00 ,
702- omhome : Optional [str ] = None ,
703- omc_process : Optional [OMCSessionABC ] = None ,
704- ) -> None :
705- """
706- Initialisation for OMCSessionZMQ
707- """
708- warnings .warn (message = "The class OMCSessionZMQ is depreciated and will be removed in future versions; "
709- "please use OMCProcess* classes instead!" ,
710- category = DeprecationWarning ,
711- stacklevel = 2 )
712-
713- if omc_process is None :
714- omc_process = OMCSessionLocal (omhome = omhome , timeout = timeout )
715- elif not isinstance (omc_process , OMCSessionABC ):
716- raise OMCSessionException ("Invalid definition of the OMC process!" )
717- self .omc_process = omc_process
718-
719- def __del__ (self ):
720- del self .omc_process
721-
722- @staticmethod
723- def escape_str (value : str ) -> str :
724- """
725- Escape a string such that it can be used as string within OMC expressions, i.e. escape all double quotes.
726- """
727- return OMCSessionABC .escape_str (value = value )
728-
729- def omcpath (self , * path ) -> OMPathABC :
730- """
731- Create an OMCPath object based on the given path segments and the current OMC process definition.
732- """
733- return self .omc_process .omcpath (* path )
734-
735- def omcpath_tempdir (self , tempdir_base : Optional [OMPathABC ] = None ) -> OMPathABC :
736- """
737- Get a temporary directory using OMC. It is our own implementation as non-local usage relies on OMC to run all
738- filesystem related access.
739- """
740- return self .omc_process .omcpath_tempdir (tempdir_base = tempdir_base )
741-
742- def execute (self , command : str ):
743- return self .omc_process .execute (command = command )
744-
745- def sendExpression (self , command : str , parsed : bool = True ) -> Any :
746- """
747- Send an expression to the OMC server and return the result.
748-
749- The complete error handling of the OMC result is done within this method using '"getMessagesStringInternal()'.
750- Caller should only check for OMCSessionException.
751- """
752- return self .omc_process .sendExpression (expr = command , parsed = parsed )
753-
754-
755694class PostInitCaller (type ):
756695 """
757696 Metaclass definition to define a new function __post_init__() which is called after all __init__() functions where
@@ -1387,6 +1326,77 @@ def _omc_port_get(self) -> str:
13871326 return port
13881327
13891328
1329+ class OMCSessionZMQ (OMSessionABC ):
1330+ """
1331+ This class is a compatibility layer for the new schema using OMCSession* classes.
1332+ """
1333+
1334+ def __init__ (
1335+ self ,
1336+ timeout : float = 10.00 ,
1337+ omhome : Optional [str ] = None ,
1338+ omc_process : Optional [OMCSessionABC ] = None ,
1339+ ) -> None :
1340+ """
1341+ Initialisation for OMCSessionZMQ
1342+ """
1343+ warnings .warn (message = "The class OMCSessionZMQ is depreciated and will be removed in future versions; "
1344+ "please use OMCProcess* classes instead!" ,
1345+ category = DeprecationWarning ,
1346+ stacklevel = 2 )
1347+
1348+ if omc_process is None :
1349+ omc_process = OMCSessionLocal (omhome = omhome , timeout = timeout )
1350+ elif not isinstance (omc_process , OMCSessionABC ):
1351+ raise OMCSessionException ("Invalid definition of the OMC process!" )
1352+ self .omc_process = omc_process
1353+
1354+ def __del__ (self ):
1355+ if hasattr (self , 'omc_process' ):
1356+ del self .omc_process
1357+
1358+ @staticmethod
1359+ def escape_str (value : str ) -> str :
1360+ """
1361+ Escape a string such that it can be used as string within OMC expressions, i.e. escape all double quotes.
1362+ """
1363+ return OMCSessionABC .escape_str (value = value )
1364+
1365+ def omcpath (self , * path ) -> OMPathABC :
1366+ """
1367+ Create an OMCPath object based on the given path segments and the current OMC process definition.
1368+ """
1369+ return self .omc_process .omcpath (* path )
1370+
1371+ def omcpath_tempdir (self , tempdir_base : Optional [OMPathABC ] = None ) -> OMPathABC :
1372+ """
1373+ Get a temporary directory using OMC. It is our own implementation as non-local usage relies on OMC to run all
1374+ filesystem related access.
1375+ """
1376+ return self .omc_process .omcpath_tempdir (tempdir_base = tempdir_base )
1377+
1378+ def execute (self , command : str ):
1379+ return self .omc_process .execute (command = command )
1380+
1381+ def sendExpression (self , command : str , parsed : bool = True ) -> Any :
1382+ """
1383+ Send an expression to the OMC server and return the result.
1384+
1385+ The complete error handling of the OMC result is done within this method using '"getMessagesStringInternal()'.
1386+ Caller should only check for OMCSessionException.
1387+ """
1388+ return self .omc_process .sendExpression (expr = command , parsed = parsed )
1389+
1390+ def get_version (self ) -> str :
1391+ return self .omc_process .get_version ()
1392+
1393+ def model_execution_prefix (self , cwd : Optional [OMPathABC ] = None ) -> list [str ]:
1394+ return self .omc_process .model_execution_prefix (cwd = cwd )
1395+
1396+ def set_workdir (self , workdir : OMPathABC ) -> None :
1397+ return self .omc_process .set_workdir (workdir = workdir )
1398+
1399+
13901400class OMCSessionDockerABC (OMCSessionABC , metaclass = abc .ABCMeta ):
13911401 """
13921402 Base class for OMCSession implementations which run the OMC server in a Docker container.
0 commit comments