• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

SpiNNakerManchester / SpiNNMan / 6574804013

19 Oct 2023 12:47PM UTC coverage: 51.937% (+1.2%) from 50.777%
6574804013

Pull #327

github

Christian-B
typing changes
Pull Request #327: Type Annotations and Checking

105 of 1288 branches covered (0.0%)

Branch coverage included in aggregate %.

2375 of 2375 new or added lines in 180 files covered. (100.0%)

4775 of 8108 relevant lines covered (58.89%)

0.59 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

53.33
/spinnman/messages/scp/impl/flood_fill_data.py
1
# Copyright (c) 2014 The University of Manchester
2
#
3
# Licensed under the Apache License, Version 2.0 (the "License");
4
# you may not use this file except in compliance with the License.
5
# You may obtain a copy of the License at
6
#
7
#     https://www.apache.org/licenses/LICENSE-2.0
8
#
9
# Unless required by applicable law or agreed to in writing, software
10
# distributed under the License is distributed on an "AS IS" BASIS,
11
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
# See the License for the specific language governing permissions and
13
# limitations under the License.
14
from typing import Optional
1✔
15
from spinn_utilities.overrides import overrides
1✔
16
from spinnman.messages.scp import SCPRequestHeader
1✔
17
from spinnman.messages.scp.abstract_messages import AbstractSCPRequest
1✔
18
from spinnman.messages.scp.enums import SCPCommand
1✔
19
from spinnman.messages.sdp import SDPFlag, SDPHeader
1✔
20
from .check_ok_response import CheckOKResponse
1✔
21

22
_NNP_FORWARD_RETRY = (0x3f << 24) | (0x1E << 16)
1✔
23
_NNP_FLOOD_FILL_START = 6
1✔
24

25

26
class FloodFillData(AbstractSCPRequest[CheckOKResponse]):
1✔
27
    """
28
    A request to start a flood fill of data.
29
    """
30
    __slots__ = (
1✔
31
        "_data_to_write",
32
        "_offset",
33
        "_size")
34

35
    def __init__(
1✔
36
            self, nearest_neighbour_id: int, block_no: int, base_address: int,
37
            data: bytes, offset: int = 0, length: Optional[int] = None):
38
        """
39
        :param int nearest_neighbour_id:
40
            The ID of the packet, between 0 and 127
41
        :param int block_no: Which block this block is, between 0 and 255
42
        :param int base_address:
43
            The base address where the data is to be loaded
44
        :param bytes data:
45
            The data to load, between 4 and 256 bytes and the size must be
46
            divisible by 4
47
        """
48
        # pylint: disable=too-many-arguments
49
        self._offset = offset
×
50
        self._data_to_write = data
×
51
        if length is None:
×
52
            self._size = len(data)
×
53
        else:
54
            self._size = length
×
55

56
        argument_1 = _NNP_FORWARD_RETRY | nearest_neighbour_id
×
57
        argument_2 = (block_no << 16) | (((self._size // 4) - 1) << 8)
×
58

59
        super().__init__(
×
60
            SDPHeader(
61
                flags=SDPFlag.REPLY_EXPECTED, destination_port=0,
62
                destination_cpu=0,
63
                destination_chip_x=self.DEFAULT_DEST_X_COORD,
64
                destination_chip_y=self.DEFAULT_DEST_Y_COORD),
65
            SCPRequestHeader(command=SCPCommand.CMD_FFD),
66
            argument_1=argument_1, argument_2=argument_2,
67
            argument_3=base_address, data=None)
68

69
    @property
1✔
70
    def bytestring(self) -> bytes:
1✔
71
        datastring = super().bytestring
×
72
        data = self._data_to_write[self._offset:self._offset + self._size]
×
73
        return datastring + bytes(data)
×
74

75
    @overrides(AbstractSCPRequest.get_scp_response)
1✔
76
    def get_scp_response(self) -> CheckOKResponse:
1✔
77
        return CheckOKResponse("Flood Fill", "CMD_NNP:NNP_FFS")
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc