From 18592f78587865ce6e59bd9b6093236e29b7c9fb Mon Sep 17 00:00:00 2001 From: syntron Date: Sat, 12 Jul 2025 00:57:53 +0200 Subject: [PATCH] [OMCProcess*] add docstrings --- OMPython/OMCSession.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/OMPython/OMCSession.py b/OMPython/OMCSession.py index ac99dc05..84ba51fb 100644 --- a/OMPython/OMCSession.py +++ b/OMPython/OMCSession.py @@ -483,11 +483,17 @@ def __del__(self): self._omc_process = None def get_port(self) -> Optional[str]: + """ + Get the port to connect to the OMC process. + """ if not isinstance(self._omc_port, str): raise OMCSessionException(f"Invalid port to connect to OMC process: {self._omc_port}") return self._omc_port def get_log(self) -> str: + """ + Get the log file content of the OMC session. + """ if self._omc_loghandle is None: raise OMCSessionException("Log file not available!") @@ -509,6 +515,9 @@ def _get_portfile_path(self) -> Optional[pathlib.Path]: class OMCProcessPort(OMCProcess): + """ + OMCProcess implementation which uses a port to connect to an already running OMC server. + """ def __init__( self, @@ -519,6 +528,9 @@ def __init__( class OMCProcessLocal(OMCProcess): + """ + OMCProcess implementation which runs the OMC server locally on the machine (Linux / Windows). + """ def __init__( self, @@ -600,6 +612,9 @@ def _omc_port_get(self) -> str: class OMCProcessDockerHelper(OMCProcess): + """ + Base class for OMCProcess implementations which run the OMC server in a Docker container. + """ def __init__( self, @@ -692,6 +707,9 @@ def _omc_port_get(self) -> str: return port def get_server_address(self) -> Optional[str]: + """ + Get the server address of the OMC server running in a Docker container. + """ if self._dockerNetwork == "separate" and isinstance(self._dockerCid, str): output = subprocess.check_output(["docker", "inspect", self._dockerCid]).decode().strip() return json.loads(output)[0]["NetworkSettings"]["IPAddress"] @@ -699,6 +717,9 @@ def get_server_address(self) -> Optional[str]: return None def get_docker_container_id(self) -> str: + """ + Get the Docker container ID of the Docker container with the OMC server. + """ if not isinstance(self._dockerCid, str): raise OMCSessionException(f"Invalid docker container ID: {self._dockerCid}!") @@ -706,6 +727,9 @@ def get_docker_container_id(self) -> str: class OMCProcessDocker(OMCProcessDockerHelper): + """ + OMC process running in a Docker container. + """ def __init__( self, @@ -847,6 +871,9 @@ def _docker_omc_start(self) -> Tuple[subprocess.Popen, DummyPopen, str]: class OMCProcessDockerContainer(OMCProcessDockerHelper): + """ + OMC process running in a Docker container (by container ID). + """ def __init__( self, @@ -936,6 +963,9 @@ def _docker_omc_start(self) -> Tuple[subprocess.Popen, DummyPopen]: class OMCProcessWSL(OMCProcess): + """ + OMC process running in Windows Subsystem for Linux (WSL). + """ def __init__( self,