Skip to content

Commit

Permalink
double type guard
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian-B committed Apr 8, 2024
1 parent 3f5fd4a commit 3e68a42
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
4 changes: 3 additions & 1 deletion spinn_machine/version/abstract_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from __future__ import annotations
import logging
from typing import Mapping, Optional, Sequence, Tuple, TYPE_CHECKING
from typing_extensions import TypeGuard
from spinn_utilities.abstract_base import AbstractBase, abstractmethod
from spinn_utilities.log import FormatAdapter
from spinn_utilities.config_holder import get_config_int_or_none
Expand Down Expand Up @@ -252,7 +253,8 @@ def get_potential_ethernet_chips(
"""
raise NotImplementedError

def verify_size(self, width: Optional[int], height: Optional[int]):
def verify_size(self, width: Optional[int],
height: Optional[int]) -> TypeGuard[int, int]:
"""
Checks that the width and height are allowed for this version.
Expand Down
12 changes: 0 additions & 12 deletions spinn_machine/virtual_machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,6 @@ class _VirtualMachine(object):

ORIGIN = "Virtual"

@overload
def __init__(
self, width: int, height: int,
validate: bool = True, n_cores: None = None):
...

@overload
def __init__(
self, width: None = None, height: None = None,
validate: bool = True, n_cores: int = 0):
...

def __init__(
self, width: Optional[int] = None, height: Optional[int] = None,
validate: bool = True, n_cores: Optional[int] = None):
Expand Down

0 comments on commit 3e68a42

Please sign in to comment.