From f1f5c90675220cd60d7a78fa3a4fadbe98ae14e0 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Fri, 19 Jan 2024 15:34:40 +0000 Subject: [PATCH] docs --- pylint.bash | 2 +- spinnman/extended/extended_transceiver.py | 3 +- spinnman/messages/scp/enums/signal.py | 5 ++ .../messages/scp/impl/fixed_route_read.py | 5 ++ spinnman/messages/sdp/sdp_header.py | 5 ++ .../system_variable_boot_values.py | 18 +++++-- spinnman/model/diagnostic_filter.py | 50 +++++++++++++++++++ 7 files changed, 83 insertions(+), 5 deletions(-) diff --git a/pylint.bash b/pylint.bash index 0731c5993..ccd77c183 100644 --- a/pylint.bash +++ b/pylint.bash @@ -28,5 +28,5 @@ cat "../SupportScripts/actions/pylint/default_dict.txt" >$dict cat ".pylint_dict.txt" >>$dict # pylint --output-format=colorized --disable=R --persistent=no --jobs=1 --rcfile=../SupportScripts/actions/pylint/strict_rcfile --spelling-dict=en_GB --spelling-private-dict-file=$dict --disable=import-error spinnman -pylint --enable=invalid-name --output-format=colorized --disable=R --persistent=no --jobs=1 --rcfile=../SupportScripts/actions/pylint/strict_rcfile --spelling-dict=en_GB --spelling-private-dict-file=$dict --disable=all spinnman +pylint --enable=missing-function-docstring --output-format=colorized --disable=R --persistent=no --jobs=1 --rcfile=../SupportScripts/actions/pylint/strict_rcfile --spelling-dict=en_GB --spelling-private-dict-file=$dict --disable=all spinnman diff --git a/spinnman/extended/extended_transceiver.py b/spinnman/extended/extended_transceiver.py index 1a02d62b8..58ac4c347 100644 --- a/spinnman/extended/extended_transceiver.py +++ b/spinnman/extended/extended_transceiver.py @@ -574,7 +574,8 @@ def free_sdram_by_app_id(self, x, y, app_id): logger.info(self.where_is_xy(x, y)) raise - def get_router_diagnostic_filter(self, x, y, position): + def get_router_diagnostic_filter( + self, x: int, y: int, position: int) -> DiagnosticFilter: """ Gets a router diagnostic filter from a router. diff --git a/spinnman/messages/scp/enums/signal.py b/spinnman/messages/scp/enums/signal.py index c4be8198d..cd5a6f7e9 100644 --- a/spinnman/messages/scp/enums/signal.py +++ b/spinnman/messages/scp/enums/signal.py @@ -58,4 +58,9 @@ def __init__(self, value: int, signal_type: SignalType) -> None: @property def signal_type(self) -> SignalType: + """ + The "type" of the signal + + :rtype: SignalType + """ return self._signal_type diff --git a/spinnman/messages/scp/impl/fixed_route_read.py b/spinnman/messages/scp/impl/fixed_route_read.py index 4c3a5ae1b..cff00eb09 100644 --- a/spinnman/messages/scp/impl/fixed_route_read.py +++ b/spinnman/messages/scp/impl/fixed_route_read.py @@ -49,6 +49,11 @@ def read_data_bytestring(self, data: bytes, offset: int): @property def route(self) -> FixedRouteEntry: + """ + Converts this reponse into a Route + + :rtype: FixedRouteEntry + """ processor_ids: List[int] = list() for processor_id in range(26): if self._route & (1 << (6 + processor_id)) != 0: diff --git a/spinnman/messages/sdp/sdp_header.py b/spinnman/messages/sdp/sdp_header.py index 01d9b0a05..f5ea74cbd 100644 --- a/spinnman/messages/sdp/sdp_header.py +++ b/spinnman/messages/sdp/sdp_header.py @@ -325,6 +325,11 @@ def from_bytestring(data: bytes, offset: int): source_chip_x, source_chip_y) def get_physical_cpu_id(self) -> str: + """ + A String describing the physical core of the destination. + + :rtype: str + """ if SpiNNManDataView.has_machine(): chip = SpiNNManDataView.get_machine().get_chip_at( self._destination_chip_x, self._destination_chip_y) diff --git a/spinnman/messages/spinnaker_boot/system_variable_boot_values.py b/spinnman/messages/spinnaker_boot/system_variable_boot_values.py index 8953f8594..c5ab74a97 100644 --- a/spinnman/messages/spinnaker_boot/system_variable_boot_values.py +++ b/spinnman/messages/spinnaker_boot/system_variable_boot_values.py @@ -13,7 +13,7 @@ # limitations under the License. import struct -from typing import NamedTuple, Union, Optional +from typing import Any, NamedTuple, Union, Optional from enum import Enum _SYSTEM_VARIABLES_BOOT_SIZE = 128 @@ -359,11 +359,23 @@ def __init__(self): for variable in SystemVariableDefinition: self._values[variable] = variable.default - def set_value(self, system_variable_definition, value): + def set_value(self, system_variable_definition: SystemVariableDefinition, + value: Any): + """ + + :param system_variable_definition: + :param value: + :return: + """ self._values[system_variable_definition] = value @property - def bytestring(self): + def bytestring(self) -> bytes: + """ + Gets all the SystemVariableDefinition as bytes + + :rtype: bytes + """ data = b"" for sys_var in SystemVariableDefinition: data += struct.pack(sys_var.data_type.struct_code, diff --git a/spinnman/model/diagnostic_filter.py b/spinnman/model/diagnostic_filter.py index 7069f54ae..7730798cd 100644 --- a/spinnman/model/diagnostic_filter.py +++ b/spinnman/model/diagnostic_filter.py @@ -129,36 +129,78 @@ def __init__(self, enable_interrupt_on_counter_event: bool, @property def enable_interrupt_on_counter_event(self) -> bool: + """ + Returns the enable interrupt on counter event passed into + the init unchanged + + Currently unused + """ return self._enable_interrupt_on_counter_event @property def match_emergency_routing_status_to_incoming_packet(self) -> bool: + """ + Returns the match emergency routing status to incoming packet passed + into the init unchanged + + Currently unused + """ return self._match_emergency_routing_status_to_incoming_packet @property def destinations(self) -> List[DiagnosticFilterDestination]: + """ + Returns the destinations passed into the init unchanged + + Currently unused + """ return self._destinations @property def sources(self) -> List[DiagnosticFilterSource]: + """ + Returns the sources passed into the init unchanged + + Currently unused + """ return self._sources @property def payload_statuses(self) -> List[DiagnosticFilterPayloadStatus]: + """ + Returns the payload statuses passed into the init unchanged + + Currently unused + """ return self._payload_statuses @property def default_routing_statuses(self) -> List[ DiagnosticFilterDefaultRoutingStatus]: + """ + Returns the default routing statuses passed into the init unchanged + + Currently unused + """ return self._default_routing_statuses @property def emergency_routing_statuses(self) -> List[ DiagnosticFilterEmergencyRoutingStatus]: + """ + Returns the emergency routing statuses passed into the init unchanged + + Currently unused + """ return self._emergency_routing_statuses @property def packet_types(self) -> List[DiagnosticFilterPacketType]: + """ + Returns the packet types passed into the init unchanged + + Currently unused + """ return self._packet_types @property @@ -194,6 +236,14 @@ def filter_word(self) -> int: @staticmethod def read_from_int(int_value: int) -> DiagnosticFilter: + """ + Claims to returns a filter that reads an int + + Currently only called by unused Transceiver methods + + :param int int_value: + :rtype: DiagnosticFilter + """ enable_interrupt_on_counter_event = ( (int_value >> _ENABLE_INTERRUPT_OFFSET) & 0x1) == 1 match_emergency_routing_status_to_incoming_packet = (