77
88import logging
99from typing import Any , Optional
10- import warnings
1110
1211import pyparsing
1312
1716 OMSessionException ,
1817)
1918from OMPython .om_session_omc import (
20- DockerPopen ,
2119 OMCSessionABC ,
2220 OMCSessionDocker ,
2321 OMCSessionDockerContainer ,
2624 OMCSessionWSL ,
2725)
2826
27+ from OMPython .compatibility_v400 import (
28+ depreciated_class ,
29+ )
2930
3031# define logger using the current module name as ID
3132logger = logging .getLogger (__name__ )
3233
3334
35+ @depreciated_class (msg = "Please use class OMSessionException instead!" )
3436class OMCSessionException (OMSessionException ):
3537 """
3638 Just a compatibility layer ...
3739 """
3840
3941
42+ @depreciated_class (msg = "Please use OMCSession*.sendExpression(...) instead!" )
4043class OMCSessionCmd :
4144 """
4245 Implementation of Open Modelica Compiler API functions. Depreciated!
4346 """
4447
4548 def __init__ (self , session : OMSessionABC , readonly : bool = False ):
46- warnings .warn (
47- message = "The class OMCSessionCMD is depreciated and will be removed in future versions; "
48- "please use OMCSession*.sendExpression(...) instead!" ,
49- category = DeprecationWarning ,
50- stacklevel = 2 ,
51- )
52-
5349 if not isinstance (session , OMSessionABC ):
5450 raise OMSessionException ("Invalid OMC process definition!" )
5551 self ._session = session
@@ -228,6 +224,7 @@ def getClassNames(self, className=None, recursive=False, qualified=False, sort=F
228224 return self ._ask (question = 'getClassNames' , opt = opt )
229225
230226
227+ @depreciated_class (msg = "Please use OMCSession* classes instead!" )
231228class OMCSessionZMQ (OMSessionABC ):
232229 """
233230 This class is a compatibility layer for the new schema using OMCSession* classes.
@@ -242,11 +239,6 @@ def __init__(
242239 """
243240 Initialisation for OMCSessionZMQ
244241 """
245- warnings .warn (message = "The class OMCSessionZMQ is depreciated and will be removed in future versions; "
246- "please use OMCProcess* classes instead!" ,
247- category = DeprecationWarning ,
248- stacklevel = 2 )
249-
250242 if omc_process is None :
251243 omc_process = OMCSessionLocal (omhome = omhome , timeout = timeout )
252244 elif not isinstance (omc_process , OMCSessionABC ):
@@ -301,9 +293,36 @@ def set_workdir(self, workdir: OMPathABC) -> None:
301293 return self .omc_process .set_workdir (workdir = workdir )
302294
303295
304- DummyPopen = DockerPopen
305- OMCProcessLocal = OMCSessionLocal
306- OMCProcessPort = OMCSessionPort
307- OMCProcessDocker = OMCSessionDocker
308- OMCProcessDockerContainer = OMCSessionDockerContainer
309- OMCProcessWSL = OMCSessionWSL
296+ @depreciated_class (msg = "Please use class OMCSessionLocal instead!" )
297+ class OMCProcessLocal (OMCSessionLocal ):
298+ """
299+ Just a wrapper class; OMCProcessLocal => OMCSessionLocal
300+ """
301+
302+
303+ @depreciated_class (msg = "Please use class OMCSessionPort instead!" )
304+ class OMCProcessPort (OMCSessionPort ):
305+ """
306+ Just a wrapper class; OMCProcessPort => OMCSessionPort
307+ """
308+
309+
310+ @depreciated_class (msg = "Please use class OMCSessionDocker instead!" )
311+ class OMCProcessDocker (OMCSessionDocker ):
312+ """
313+ Just a wrapper class; OMCProcessDocker => OMCSessionDocker
314+ """
315+
316+
317+ @depreciated_class (msg = "Please use class OMCSessionDockerContainer instead!" )
318+ class OMCProcessDockerContainer (OMCSessionDockerContainer ):
319+ """
320+ Just a wrapper class; OMCProcessDockerContainer => OMCSessionDockerContainer
321+ """
322+
323+
324+ @depreciated_class (msg = "Please use class OMCSessionWSL instead!" )
325+ class OMCProcessWSL (OMCSessionWSL ):
326+ """
327+ Just a wrapper class; OMCProcessWSL => OMCSessionWSL
328+ """
0 commit comments