Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions OMPython/ModelicaSystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@
)

from OMPython.compatibility_v400 import (
depreciated_class,
deprecated_class,
)

# define logger using the current module name as ID
logger = logging.getLogger(__name__)


@depreciated_class(msg="Please use class ModelicaSystemOMC instead!")
@deprecated_class(msg="Please use class ModelicaSystemOMC instead!")
class ModelicaSystem(ModelicaSystemOMC):
"""
High-level interface for loading, compiling, and simulating Modelica models.
Expand Down Expand Up @@ -432,7 +432,7 @@ def getOutputs(
raise ModelicaSystemError("Invalid data!")


@depreciated_class(msg="Please use class ModelicaDoEOMC instead!")
@deprecated_class(msg="Please use class ModelicaDoEOMC instead!")
class ModelicaSystemDoE(ModelicaDoEOMC):
"""
Compatibility class for Design of Experiments (DoE) with Modelica models.
Expand All @@ -441,7 +441,7 @@ class ModelicaSystemDoE(ModelicaDoEOMC):
"""


@depreciated_class(msg="Please use class ModelExecutionConfig instead!")
@deprecated_class(msg="Please use class ModelExecutionConfig instead!")
class ModelicaSystemCmd(ModelExecutionConfig):
"""
Compatibility wrapper for model execution configuration.
Expand Down Expand Up @@ -484,7 +484,7 @@ def parse_simflags(simflags: str) -> dict[str, Optional[str | dict[str, Any] | n
ModelExecutionException: If a flag or override definition is malformed.
"""
warnings.warn(
message="The argument 'simflags' is depreciated and will be removed in future versions; "
message="The argument 'simflags' is deprecated and will be removed in future versions; "
"please use 'simargs' instead",
category=DeprecationWarning,
stacklevel=2,
Expand Down
22 changes: 11 additions & 11 deletions OMPython/OMCSession.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,24 @@
)

from OMPython.compatibility_v400 import (
depreciated_class,
deprecated_class,
)

# define logger using the current module name as ID
logger = logging.getLogger(__name__)


@depreciated_class(msg="Please use class OMSessionException instead!")
@deprecated_class(msg="Please use class OMSessionException instead!")
class OMCSessionException(OMSessionException):
"""
Just a compatibility layer ...
"""


@depreciated_class(msg="Please use OMCSession*.sendExpression(...) instead!")
@deprecated_class(msg="Please use OMCSession*.sendExpression(...) instead!")
class OMCSessionCmd:
"""
Implementation of Open Modelica Compiler API functions. Depreciated!
Implementation of Open Modelica Compiler API functions. Deprecated!
"""

def __init__(self, session: OMSessionABC, readonly: bool = False):
Expand Down Expand Up @@ -289,7 +289,7 @@ def getClassNames(self, className=None, recursive=False, qualified=False, sort=F
return self._ask(question='getClassNames', opt=opt)


@depreciated_class(msg="Please use OMCSession* classes instead!")
@deprecated_class(msg="Please use OMCSession* classes instead!")
class OMCSessionZMQ(OMSessionABC):
"""
This class is a compatibility layer for the new schema using OMCSession* classes.
Expand Down Expand Up @@ -347,7 +347,7 @@ def execute(self, command: str):
The unparsed OMC response.
"""
warnings.warn(
message="This function is depreciated and will be removed in future versions; "
message="This function is deprecated and will be removed in future versions; "
"please use sendExpression() instead",
category=DeprecationWarning,
stacklevel=2,
Expand Down Expand Up @@ -383,35 +383,35 @@ def set_workdir(self, workdir: OMPathABC) -> None:
return self.omc_process.set_workdir(workdir=workdir)


@depreciated_class(msg="Please use class OMCSessionLocal instead!")
@deprecated_class(msg="Please use class OMCSessionLocal instead!")
class OMCProcessLocal(OMCSessionLocal):
"""
Just a wrapper class; OMCProcessLocal => OMCSessionLocal
"""


@depreciated_class(msg="Please use class OMCSessionPort instead!")
@deprecated_class(msg="Please use class OMCSessionPort instead!")
class OMCProcessPort(OMCSessionPort):
"""
Just a wrapper class; OMCProcessPort => OMCSessionPort
"""


@depreciated_class(msg="Please use class OMCSessionDocker instead!")
@deprecated_class(msg="Please use class OMCSessionDocker instead!")
class OMCProcessDocker(OMCSessionDocker):
"""
Just a wrapper class; OMCProcessDocker => OMCSessionDocker
"""


@depreciated_class(msg="Please use class OMCSessionDockerContainer instead!")
@deprecated_class(msg="Please use class OMCSessionDockerContainer instead!")
class OMCProcessDockerContainer(OMCSessionDockerContainer):
"""
Just a wrapper class; OMCProcessDockerContainer => OMCSessionDockerContainer
"""


@depreciated_class(msg="Please use class OMCSessionWSL instead!")
@deprecated_class(msg="Please use class OMCSessionWSL instead!")
class OMCProcessWSL(OMCSessionWSL):
"""
Just a wrapper class; OMCProcessWSL => OMCSessionWSL
Expand Down
12 changes: 6 additions & 6 deletions OMPython/compatibility_v400.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@
from typing import Optional


def depreciated_class(msg: Optional[str] = None):
def deprecated_class(msg: Optional[str] = None):
"""
Decorator for depreciated / compatibility classes.
Decorator for deprecated / compatibility classes.
"""

def depreciated(cls):
def deprecated(cls):
"""
Helper functions to do the decoration part.
"""

class Wrapper(cls):
"""
Wrapper to define the depreciation message.
Wrapper to define the deprecation message.
"""

def __init__(self, *args, **kwargs):
"""Construct the deprecated class and emit a deprecation warning."""
message = f"The class {cls.__name__} is depreciated and will be removed in future versions!"
message = f"The class {cls.__name__} is deprecated and will be removed in future versions!"
if msg is not None:
message += f" {msg}"

Expand All @@ -37,4 +37,4 @@ def __init__(self, *args, **kwargs):

return Wrapper

return depreciated
return deprecated
Loading