Format docstrings

This commit is contained in:
Marek Wolan
2023-07-04 11:11:52 +01:00
parent 91273b2f99
commit 9244c160b1
39 changed files with 208 additions and 409 deletions

View File

@@ -26,8 +26,7 @@ class ServiceNode(ActiveNode):
file_system_state: FileSystemState,
config_values: TrainingConfig,
):
"""
Init.
"""Init.
:param node_id: The node ID
:param name: The node name
@@ -53,16 +52,14 @@ class ServiceNode(ActiveNode):
self.services: Dict[str, Service] = {}
def add_service(self, service: Service):
"""
Adds a service to the node.
"""Adds a service to the node.
:param service: The service to add
"""
self.services[service.name] = service
def has_service(self, protocol_name: str) -> bool:
"""
Indicates whether a service is on a node.
"""Indicates whether a service is on a node.
:param protocol_name: The service (protocol)e.
:return: True if service (protocol) is on the node, otherwise False.
@@ -73,12 +70,10 @@ class ServiceNode(ActiveNode):
return False
def service_running(self, protocol_name: str) -> bool:
"""
Indicates whether a service is in a running state on the node.
"""Indicates whether a service is in a running state on the node.
:param protocol_name: The service (protocol)
:return: True if service (protocol) is in a running state on the
node, otherwise False.
:return: True if service (protocol) is in a running state on the node, otherwise False.
"""
for service_key, service_value in self.services.items():
if service_key == protocol_name:
@@ -89,12 +84,10 @@ class ServiceNode(ActiveNode):
return False
def service_is_overwhelmed(self, protocol_name: str) -> bool:
"""
Indicates whether a service is in an overwhelmed state on the node.
"""Indicates whether a service is in an overwhelmed state on the node.
:param protocol_name: The service (protocol)
:return: True if service (protocol) is in an overwhelmed state on the
node, otherwise False.
:return: True if service (protocol) is in an overwhelmed state on the node, otherwise False.
"""
for service_key, service_value in self.services.items():
if service_key == protocol_name:
@@ -105,8 +98,7 @@ class ServiceNode(ActiveNode):
return False
def set_service_state(self, protocol_name: str, software_state: SoftwareState):
"""
Sets the software_state of a service (protocol) on the node.
"""Sets the software_state of a service (protocol) on the node.
:param protocol_name: The service (protocol).
:param software_state: The software_state.
@@ -134,8 +126,7 @@ class ServiceNode(ActiveNode):
)
def set_service_state_if_not_compromised(self, protocol_name: str, software_state: SoftwareState):
"""
Sets the software_state of a service (protocol) on the node.
"""Sets the software_state of a service (protocol) on the node.
Done if the software_state is not "compromised".
@@ -161,8 +152,7 @@ class ServiceNode(ActiveNode):
)
def get_service_state(self, protocol_name):
"""
Gets the state of a service.
"""Gets the state of a service.
:return: The software_state of the service.
"""