Standardise docstring summary line placement.
This commit is contained in:
@@ -52,7 +52,8 @@ class ActiveNode(Node):
|
||||
|
||||
@property
|
||||
def software_state(self) -> SoftwareState:
|
||||
"""Get the software_state.
|
||||
"""
|
||||
Get the software_state.
|
||||
|
||||
:return: The software_state.
|
||||
"""
|
||||
@@ -60,7 +61,8 @@ class ActiveNode(Node):
|
||||
|
||||
@software_state.setter
|
||||
def software_state(self, software_state: SoftwareState):
|
||||
"""Get the software_state.
|
||||
"""
|
||||
Get the software_state.
|
||||
|
||||
:param software_state: Software State.
|
||||
"""
|
||||
@@ -78,7 +80,8 @@ class ActiveNode(Node):
|
||||
)
|
||||
|
||||
def set_software_state_if_not_compromised(self, software_state: SoftwareState):
|
||||
"""Sets Software State if the node is not compromised.
|
||||
"""
|
||||
Sets Software State if the node is not compromised.
|
||||
|
||||
Args:
|
||||
software_state: Software State
|
||||
@@ -104,7 +107,8 @@ class ActiveNode(Node):
|
||||
self._software_state = SoftwareState.GOOD
|
||||
|
||||
def set_file_system_state(self, file_system_state: FileSystemState):
|
||||
"""Sets the file system state (actual and observed).
|
||||
"""
|
||||
Sets the file system state (actual and observed).
|
||||
|
||||
Args:
|
||||
file_system_state: File system state
|
||||
@@ -130,7 +134,8 @@ class ActiveNode(Node):
|
||||
)
|
||||
|
||||
def set_file_system_state_if_not_compromised(self, file_system_state: FileSystemState):
|
||||
"""Sets the file system state (actual and observed) if not in a compromised state.
|
||||
"""
|
||||
Sets the file system state (actual and observed) if not in a compromised state.
|
||||
|
||||
Use for green PoL to prevent it overturning a compromised state
|
||||
|
||||
|
||||
@@ -35,7 +35,8 @@ class NodeStateInstructionGreen(object):
|
||||
self.state = _state
|
||||
|
||||
def get_start_step(self):
|
||||
"""Gets the start step.
|
||||
"""
|
||||
Gets the start step.
|
||||
|
||||
Returns:
|
||||
The start step
|
||||
@@ -43,7 +44,8 @@ class NodeStateInstructionGreen(object):
|
||||
return self.start_step
|
||||
|
||||
def get_end_step(self):
|
||||
"""Gets the end step.
|
||||
"""
|
||||
Gets the end step.
|
||||
|
||||
Returns:
|
||||
The end step
|
||||
@@ -51,7 +53,8 @@ class NodeStateInstructionGreen(object):
|
||||
return self.end_step
|
||||
|
||||
def get_node_id(self):
|
||||
"""Gets the node ID.
|
||||
"""
|
||||
Gets the node ID.
|
||||
|
||||
Returns:
|
||||
The node ID
|
||||
@@ -59,7 +62,8 @@ class NodeStateInstructionGreen(object):
|
||||
return self.node_id
|
||||
|
||||
def get_node_pol_type(self):
|
||||
"""Gets the node pattern of life type (enum).
|
||||
"""
|
||||
Gets the node pattern of life type (enum).
|
||||
|
||||
Returns:
|
||||
The node pattern of life type (enum)
|
||||
@@ -67,7 +71,8 @@ class NodeStateInstructionGreen(object):
|
||||
return self.node_pol_type
|
||||
|
||||
def get_service_name(self):
|
||||
"""Gets the service name.
|
||||
"""
|
||||
Gets the service name.
|
||||
|
||||
Returns:
|
||||
The service name
|
||||
@@ -75,7 +80,8 @@ class NodeStateInstructionGreen(object):
|
||||
return self.service_name
|
||||
|
||||
def get_state(self):
|
||||
"""Gets the state (node or service).
|
||||
"""
|
||||
Gets the state (node or service).
|
||||
|
||||
Returns:
|
||||
The state (node or service)
|
||||
|
||||
@@ -51,7 +51,8 @@ class NodeStateInstructionRed(object):
|
||||
self.source_node_service_state = _pol_source_node_service_state
|
||||
|
||||
def get_start_step(self):
|
||||
"""Gets the start step.
|
||||
"""
|
||||
Gets the start step.
|
||||
|
||||
Returns:
|
||||
The start step
|
||||
@@ -59,7 +60,8 @@ class NodeStateInstructionRed(object):
|
||||
return self.start_step
|
||||
|
||||
def get_end_step(self):
|
||||
"""Gets the end step.
|
||||
"""
|
||||
Gets the end step.
|
||||
|
||||
Returns:
|
||||
The end step
|
||||
@@ -67,7 +69,8 @@ class NodeStateInstructionRed(object):
|
||||
return self.end_step
|
||||
|
||||
def get_target_node_id(self):
|
||||
"""Gets the node ID.
|
||||
"""
|
||||
Gets the node ID.
|
||||
|
||||
Returns:
|
||||
The node ID
|
||||
@@ -75,7 +78,8 @@ class NodeStateInstructionRed(object):
|
||||
return self.target_node_id
|
||||
|
||||
def get_initiator(self):
|
||||
"""Gets the initiator.
|
||||
"""
|
||||
Gets the initiator.
|
||||
|
||||
Returns:
|
||||
The initiator
|
||||
@@ -83,7 +87,8 @@ class NodeStateInstructionRed(object):
|
||||
return self.initiator
|
||||
|
||||
def get_pol_type(self) -> NodePOLType:
|
||||
"""Gets the node pattern of life type (enum).
|
||||
"""
|
||||
Gets the node pattern of life type (enum).
|
||||
|
||||
Returns:
|
||||
The node pattern of life type (enum)
|
||||
@@ -91,7 +96,8 @@ class NodeStateInstructionRed(object):
|
||||
return self.pol_type
|
||||
|
||||
def get_service_name(self):
|
||||
"""Gets the service name.
|
||||
"""
|
||||
Gets the service name.
|
||||
|
||||
Returns:
|
||||
The service name
|
||||
@@ -99,7 +105,8 @@ class NodeStateInstructionRed(object):
|
||||
return self.service_name
|
||||
|
||||
def get_state(self):
|
||||
"""Gets the state (node or service).
|
||||
"""
|
||||
Gets the state (node or service).
|
||||
|
||||
Returns:
|
||||
The state (node or service)
|
||||
@@ -107,7 +114,8 @@ class NodeStateInstructionRed(object):
|
||||
return self.state
|
||||
|
||||
def get_source_node_id(self):
|
||||
"""Gets the source node id (used for initiator type SERVICE).
|
||||
"""
|
||||
Gets the source node id (used for initiator type SERVICE).
|
||||
|
||||
Returns:
|
||||
The source node id
|
||||
@@ -115,7 +123,8 @@ class NodeStateInstructionRed(object):
|
||||
return self.source_node_id
|
||||
|
||||
def get_source_node_service(self):
|
||||
"""Gets the source node service (used for initiator type SERVICE).
|
||||
"""
|
||||
Gets the source node service (used for initiator type SERVICE).
|
||||
|
||||
Returns:
|
||||
The source node service
|
||||
@@ -123,7 +132,8 @@ class NodeStateInstructionRed(object):
|
||||
return self.source_node_service
|
||||
|
||||
def get_source_node_service_state(self):
|
||||
"""Gets the source node service state (used for initiator type SERVICE).
|
||||
"""
|
||||
Gets the source node service state (used for initiator type SERVICE).
|
||||
|
||||
Returns:
|
||||
The source node service state
|
||||
|
||||
@@ -32,7 +32,8 @@ class PassiveNode(Node):
|
||||
|
||||
@property
|
||||
def ip_address(self) -> str:
|
||||
"""Gets the node IP address as an empty string.
|
||||
"""
|
||||
Gets the node IP address as an empty string.
|
||||
|
||||
No concept of IP address for passive nodes for now.
|
||||
|
||||
|
||||
@@ -53,14 +53,16 @@ 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.
|
||||
@@ -71,7 +73,8 @@ 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.
|
||||
@@ -85,7 +88,8 @@ 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.
|
||||
@@ -99,7 +103,8 @@ 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.
|
||||
@@ -127,7 +132,8 @@ 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".
|
||||
|
||||
@@ -153,7 +159,8 @@ 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.
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user