From 40ba0fd9d57943e3f51fd4371b80861ffe77005f Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Mon, 25 Mar 2024 07:42:20 +0000 Subject: [PATCH] typing fixes --- pacman/model/placements/placements.py | 4 ++-- pacman/operations/placer_algorithms/application_placer.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pacman/model/placements/placements.py b/pacman/model/placements/placements.py index 684740001..b90cd6e0f 100644 --- a/pacman/model/placements/placements.py +++ b/pacman/model/placements/placements.py @@ -13,7 +13,7 @@ # limitations under the License. from collections import defaultdict -from typing import Dict, Iterable, Iterator +from typing import Collection, Dict, Iterable, Iterator from spinn_utilities.typing.coords import XY @@ -197,7 +197,7 @@ def placements(self) -> Iterable[Placement]: """ return iter(self._machine_vertices.values()) - def placements_on_chip(self, xy: XY) -> Iterable[Placement]: + def placements_on_chip(self, xy: XY) -> Collection[Placement]: """ Get the placements on a specific chip. diff --git a/pacman/operations/placer_algorithms/application_placer.py b/pacman/operations/placer_algorithms/application_placer.py index cc2e5ef35..d53aebc81 100644 --- a/pacman/operations/placer_algorithms/application_placer.py +++ b/pacman/operations/placer_algorithms/application_placer.py @@ -129,7 +129,7 @@ def __init__(self, placements: Placements): self.__current_chip: Optional[Chip] = None self.__current_cores_free: List[int] = list() self.__current_sdram_free = 0 - self.__app_vertex_label = "NO APP VETERX SET" + self.__app_vertex_label = None # Set some value so no Optional needed self.__ethernet_x = -1 @@ -255,7 +255,7 @@ def _prepare_placements(self, same_chip_groups: Sequence[ return placements_to_make def _filter_vertices( - self, vertices: List[MachineVertex]) -> List[MachineVertex]: + self, vertices: Sequence[MachineVertex]) -> List[MachineVertex]: """ Removes an already placed or virtual vertices. @@ -335,9 +335,9 @@ def _place_error(self, system_placements: Placements, f.write(f"Vertex: {app_vertex}\n") same_chip_groups = app_vertex.splitter.get_same_chip_groups() for vertices, sdram in same_chip_groups: - sdram = sdram.get_total_sdram(self.__plan_n_timesteps) + p_sdram = sdram.get_total_sdram(self.__plan_n_timesteps) f.write(f" Group of {len(vertices)} vertices uses " - f"{sdram} bytes of SDRAM:\n") + f"{p_sdram} bytes of SDRAM:\n") for vertex in vertices: f.write(f" Vertex {vertex}") if self.__placements.is_vertex_placed(vertex):