Format docstrings

This commit is contained in:
Marek Wolan
2023-07-04 11:11:52 +01:00
parent 3de6208915
commit 5e270c7673
39 changed files with 208 additions and 409 deletions

View File

@@ -25,8 +25,7 @@ def apply_iers(
acl: AccessControlList,
step: int,
):
"""
Applies IERs to the links (link pattern of life).
"""Applies IERs to the links (link pattern of life).
Args:
network: The network modelled in the environment
@@ -218,8 +217,7 @@ def apply_node_pol(
node_pol: Dict[any, Union[NodeStateInstructionGreen, NodeStateInstructionRed]],
step: int,
):
"""
Applies node pattern of life.
"""Applies node pattern of life.
Args:
nodes: The nodes within the environment

View File

@@ -1,6 +1,5 @@
# Crown Copyright (C) Dstl 2022. DEFCON 703. Shared in confidence.
"""
Information Exchange Requirements for APE.
"""Information Exchange Requirements for APE.
Used to represent an information flow from source to destination.
"""
@@ -22,8 +21,7 @@ class IER(object):
_mission_criticality,
_running=False,
):
"""
Init.
"""Init.
Args:
_id: The IER id
@@ -49,8 +47,7 @@ class IER(object):
self.running = _running
def get_id(self):
"""
Gets IER ID.
"""Gets IER ID.
Returns:
IER ID
@@ -58,8 +55,7 @@ class IER(object):
return self.id
def get_start_step(self):
"""
Gets IER start step.
"""Gets IER start step.
Returns:
IER start step
@@ -67,8 +63,7 @@ class IER(object):
return self.start_step
def get_end_step(self):
"""
Gets IER end step.
"""Gets IER end step.
Returns:
IER end step
@@ -76,8 +71,7 @@ class IER(object):
return self.end_step
def get_load(self):
"""
Gets IER load.
"""Gets IER load.
Returns:
IER load
@@ -85,8 +79,7 @@ class IER(object):
return self.load
def get_protocol(self):
"""
Gets IER protocol.
"""Gets IER protocol.
Returns:
IER protocol
@@ -94,8 +87,7 @@ class IER(object):
return self.protocol
def get_port(self):
"""
Gets IER port.
"""Gets IER port.
Returns:
IER port
@@ -103,8 +95,7 @@ class IER(object):
return self.port
def get_source_node_id(self):
"""
Gets IER source node ID.
"""Gets IER source node ID.
Returns:
IER source node ID
@@ -112,8 +103,7 @@ class IER(object):
return self.source_node_id
def get_dest_node_id(self):
"""
Gets IER destination node ID.
"""Gets IER destination node ID.
Returns:
IER destination node ID
@@ -121,8 +111,7 @@ class IER(object):
return self.dest_node_id
def get_is_running(self):
"""
Informs whether the IER is currently running.
"""Informs whether the IER is currently running.
Returns:
True if running
@@ -130,8 +119,7 @@ class IER(object):
return self.running
def set_is_running(self, _value):
"""
Sets the running state of the IER.
"""Sets the running state of the IER.
Args:
_value: running status
@@ -139,8 +127,7 @@ class IER(object):
self.running = _value
def get_mission_criticality(self):
"""
Gets the IER mission criticality (used in the reward function).
"""Gets the IER mission criticality (used in the reward function).
Returns:
Mission criticality value (0 lowest to 5 highest)

View File

@@ -24,8 +24,7 @@ def apply_red_agent_iers(
acl: AccessControlList,
step: int,
):
"""
Applies IERs to the links (link POL) resulting from red agent attack.
"""Applies IERs to the links (link POL) resulting from red agent attack.
Args:
network: The network modelled in the environment
@@ -214,8 +213,7 @@ def apply_red_agent_node_pol(
node_pol: Dict[str, NodeStateInstructionRed],
step: int,
):
"""
Applies node pattern of life.
"""Applies node pattern of life.
Args:
nodes: The nodes within the environment
@@ -297,8 +295,7 @@ def apply_red_agent_node_pol(
def is_red_ier_incoming(node, iers, node_pol_type):
"""
Checks if the RED IER is incoming.
"""Checks if the RED IER is incoming.
TODO: Write more descriptive docstring with params and returns.
"""