Source code for spinnman.messages.scp.impl.check_ok_response

# Copyright (c) 2014 The University of Manchester
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from spinn_utilities.overrides import overrides
from spinnman.messages.scp.abstract_messages import AbstractSCPResponse
from spinnman.messages.scp.enums import SCPResult
from spinnman.exceptions import SpinnmanUnexpectedResponseCodeException


class CheckOKResponse(AbstractSCPResponse):
    """
    An SCP response to a request which returns nothing other than OK.
    """
    __slots__ = (
        "_command",
        "_operation")

    def __init__(self, operation: str, command):
        """
        :param str operation: The operation being performed
        :param command: The command that was sent
        :type command: str or ~enum.Enum or int
        """
        super().__init__()
        self._operation = operation
        self._command = command

[docs] @overrides(AbstractSCPResponse.read_data_bytestring) def read_data_bytestring(self, data: bytes, offset: int): result = self.scp_response_header.result if result != SCPResult.RC_OK: raise SpinnmanUnexpectedResponseCodeException( self._operation, str(self._command), result.name)