Skip to content

Commit

Permalink
flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian-B committed May 10, 2024
1 parent 0e8387e commit 2873622
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 14 deletions.
2 changes: 1 addition & 1 deletion spinn_machine/ignores/ignore_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# 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 typing import Any, Iterable, List, Optional, Set, Union
from typing import Any, List, Optional, Set, Union
from typing_extensions import TypeAlias
from spinn_machine.data import MachineDataView

Expand Down
4 changes: 2 additions & 2 deletions spinn_machine/version/abstract_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ def quads_maps(self) -> Optional[Dict[int, Tuple[int, int, int]]]:
raise NotImplementedError

@abstractmethod
def qx_qy_qp_to_id(self, qx:int, qy:int, qp:int) -> int:
def qx_qy_qp_to_id(self, qx: int, qy: int, qp: int) -> int:
"""
Converts quad coordinates to the core id
Expand All @@ -473,7 +473,7 @@ def qx_qy_qp_to_id(self, qx:int, qy:int, qp:int) -> int:
raise NotImplementedError

@abstractmethod
def id_to_qx_qy_qp(self, id:int) -> Tuple[int, int, int]:
def id_to_qx_qy_qp(self, id: int) -> Tuple[int, int, int]:
"""
Converts core id to quad coordinates
Expand Down
11 changes: 4 additions & 7 deletions spinn_machine/version/version_spin1.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

from typing import List, Iterable, Tuple
from spinn_utilities.abstract_base import AbstractBase
from spinn_utilities.exceptions import ConfigException
from spinn_utilities.overrides import overrides
from spinn_machine.exceptions import SpinnMachineInvalidParameterException
from .abstract_version import AbstractVersion


Expand Down Expand Up @@ -60,17 +60,14 @@ def quads_maps(self) -> None:
return None

@overrides(AbstractVersion.qx_qy_qp_to_id)
def qx_qy_qp_to_id(self, qx:int, qy:int, qp:int) -> int:
def qx_qy_qp_to_id(self, qx: int, qy: int, qp: int) -> int:
raise NotImplementedError("Not supported in Version 1")

@overrides(AbstractVersion.id_to_qx_qy_qp)
def id_to_qx_qy_qp(self, id:int) -> Tuple[int, int, int]:
def id_to_qx_qy_qp(self, id: int) -> Tuple[int, int, int]:
raise NotImplementedError("Not supported in Version 1")

@overrides(AbstractVersion.version_parse_cores_string)
def version_parse_cores_string(self, core_string: str) -> Iterable[int]:
if result is not None:
return range(int(result.group(1)), int(result.group(2)) + 1)

raise SpinnMachineInvalidParameterException(
raise ConfigException(
f"{core_string} does not represent cores for Version 1 boards")
7 changes: 4 additions & 3 deletions spinn_machine/version/version_spin2.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from typing import Dict, Final, List, Iterable, Tuple

from spinn_utilities.abstract_base import AbstractBase
from spinn_utilities.exceptions import ConfigException
from spinn_utilities.overrides import overrides

from spinn_machine.exceptions import SpinnMachineInvalidParameterException
Expand Down Expand Up @@ -108,11 +109,11 @@ def quads_maps(self) -> Dict[int, Tuple[int, int, int]]:
return QUAD_MAP

@overrides(AbstractVersion.qx_qy_qp_to_id)
def qx_qy_qp_to_id(self, qx:int, qy:int, qp:int) -> int:
def qx_qy_qp_to_id(self, qx: int, qy: int, qp: int) -> int:
return self._reverse_quad_map[(qx, qy, qp)]

@overrides(AbstractVersion.id_to_qx_qy_qp)
def id_to_qx_qy_qp(self, id:int) -> Tuple[int, int, int]:
def id_to_qx_qy_qp(self, id: int) -> Tuple[int, int, int]:
return QUAD_MAP[id]

def version_parse_cores_string(self, core_string: str) -> Iterable[int]:
Expand All @@ -123,5 +124,5 @@ def version_parse_cores_string(self, core_string: str) -> Iterable[int]:
qp = int(result.group(3))
return (self.qx_qy_qp_to_id(qx, qy, qp),)

raise SpinnMachineInvalidParameterException(
raise ConfigException(
f"{core_string} does not represent cores for Version 2 boards")
1 change: 0 additions & 1 deletion unittests/test_using_virtual_machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
virtual_machine_by_boards, virtual_machine_by_min_size)
from spinn_machine.data import MachineDataView
from spinn_machine.exceptions import (SpinnMachineException)
from spinn_machine.ignores import IgnoreChip, IgnoreCore, IgnoreLink
from spinn_machine.machine_factory import machine_repair
from spinn_machine.version.version_strings import VersionStrings
from spinn_machine.version.version_5 import CHIPS_PER_BOARD
Expand Down

0 comments on commit 2873622

Please sign in to comment.