Skip to content

Commit 33aba82

Browse files
committed
[OMCProcess*] add docstrings
1 parent 3e9c55b commit 33aba82

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

OMPython/OMCSession.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,11 +483,17 @@ def __del__(self):
483483
self._omc_process = None
484484

485485
def get_port(self) -> Optional[str]:
486+
"""
487+
Get the port to connect to the OMC process.
488+
"""
486489
if not isinstance(self._omc_port, str):
487490
raise OMCSessionException(f"Invalid port to connect to OMC process: {self._omc_port}")
488491
return self._omc_port
489492

490493
def get_log(self) -> str:
494+
"""
495+
Get the log file content of the OMC session.
496+
"""
491497
if self._omc_loghandle is None:
492498
raise OMCSessionException("Log file not available!")
493499

@@ -509,6 +515,9 @@ def _get_portfile_path(self) -> Optional[pathlib.Path]:
509515

510516

511517
class OMCProcessPort(OMCProcess):
518+
"""
519+
OMCProcess implementation which uses a port to connect to an already running OMC server.
520+
"""
512521

513522
def __init__(
514523
self,
@@ -519,6 +528,9 @@ def __init__(
519528

520529

521530
class OMCProcessLocal(OMCProcess):
531+
"""
532+
OMCProcess implementation which runs the OMC server locally on the machine (Linux / Windows).
533+
"""
522534

523535
def __init__(
524536
self,
@@ -600,6 +612,9 @@ def _omc_port_get(self) -> str:
600612

601613

602614
class OMCProcessDockerHelper(OMCProcess):
615+
"""
616+
Base class for OMCProcess implementations which run the OMC server in a Docker container.
617+
"""
603618

604619
def __init__(
605620
self,
@@ -692,20 +707,29 @@ def _omc_port_get(self) -> str:
692707
return port
693708

694709
def get_server_address(self) -> Optional[str]:
710+
"""
711+
Get the server address of the OMC server running in a Docker container.
712+
"""
695713
if self._dockerNetwork == "separate" and isinstance(self._dockerCid, str):
696714
output = subprocess.check_output(["docker", "inspect", self._dockerCid]).decode().strip()
697715
return json.loads(output)[0]["NetworkSettings"]["IPAddress"]
698716

699717
return None
700718

701719
def get_docker_container_id(self) -> str:
720+
"""
721+
Get the Docker container ID of the Docker container with the OMC server.
722+
"""
702723
if not isinstance(self._dockerCid, str):
703724
raise OMCSessionException(f"Invalid docker container ID: {self._dockerCid}!")
704725

705726
return self._dockerCid
706727

707728

708729
class OMCProcessDocker(OMCProcessDockerHelper):
730+
"""
731+
OMC process running in a Docker container.
732+
"""
709733

710734
def __init__(
711735
self,
@@ -847,6 +871,9 @@ def _docker_omc_start(self) -> Tuple[subprocess.Popen, DummyPopen, str]:
847871

848872

849873
class OMCProcessDockerContainer(OMCProcessDockerHelper):
874+
"""
875+
OMC process running in a Docker container (by container ID).
876+
"""
850877

851878
def __init__(
852879
self,
@@ -936,6 +963,9 @@ def _docker_omc_start(self) -> Tuple[subprocess.Popen, DummyPopen]:
936963

937964

938965
class OMCProcessWSL(OMCProcess):
966+
"""
967+
OMC process running in Windows Subsystem for Linux (WSL).
968+
"""
939969

940970
def __init__(
941971
self,

0 commit comments

Comments
 (0)