diff --git a/spinn_utilities/ranged/abstract_view.py b/spinn_utilities/ranged/abstract_view.py index 7f626254..8fd86229 100644 --- a/spinn_utilities/ranged/abstract_view.py +++ b/spinn_utilities/ranged/abstract_view.py @@ -37,7 +37,8 @@ def __init__(self, range_dict: RangeDictionary[T]): """ self._range_dict = range_dict - def __getitem__(self, key: Union[int, slice, Iterable[int]]): + def __getitem__(self, key: Union[int, slice, Iterable[int]] + ) -> AbstractView[T]: """ Support for the view[x] based the type of the key @@ -64,7 +65,7 @@ def __getitem__(self, key: Union[int, slice, Iterable[int]]): return self._range_dict.view_factory(ids[key]) return self._range_dict.view_factory([ids[i] for i in key]) - def __setitem__(self, key: str, value: T): + def __setitem__(self, key: str, value: T) -> None: """ See :py:meth:`AbstractDict.set_value` diff --git a/spinn_utilities/ranged/ids_view.py b/spinn_utilities/ranged/ids_view.py index ec3d9962..4b6de1b3 100644 --- a/spinn_utilities/ranged/ids_view.py +++ b/spinn_utilities/ranged/ids_view.py @@ -71,7 +71,7 @@ def set_value( for _id in self._ids: ranged_list.set_value_by_id(the_id=_id, value=value) - def set_value_by_ids(self, key: str, ids: Iterable[int], value: T): + def set_value_by_ids(self, key: str, ids: Iterable[int], value: T) -> None: """ Sets a already existing key to the new value. For the view specified. @@ -84,7 +84,8 @@ def set_value_by_ids(self, key: str, ids: Iterable[int], value: T): rl.set_value_by_id(the_id=_id, value=value) @overload - def iter_all_values(self, key: str, update_safe=False) -> Iterator[T]: + def iter_all_values( + self, key: str, update_safe: bool = False) -> Iterator[T]: ... @overload diff --git a/spinn_utilities/ranged/single_view.py b/spinn_utilities/ranged/single_view.py index 08498715..b2412a85 100644 --- a/spinn_utilities/ranged/single_view.py +++ b/spinn_utilities/ranged/single_view.py @@ -64,13 +64,14 @@ def get_value(self, key: _Keys) -> Union[T, Dict[str, T]]: for k in key} @overload - def iter_all_values(self, key: str, update_safe=False) -> Iterator[T]: + def iter_all_values(self, key: str, update_safe: bool = False + ) -> Iterator[T]: ... @overload def iter_all_values( - self, key: Optional[_StrSeq], update_safe=False) -> Iterator[ - Dict[str, T]]: + self, key: Optional[_StrSeq], update_safe: bool = False + ) -> Iterator[Dict[str, T]]: ... @overrides(AbstractDict.iter_all_values) diff --git a/spinn_utilities/ranged/slice_view.py b/spinn_utilities/ranged/slice_view.py index c0a94ea9..42afdb77 100644 --- a/spinn_utilities/ranged/slice_view.py +++ b/spinn_utilities/ranged/slice_view.py @@ -78,13 +78,13 @@ def update_safe_iter_all_values(self, key: str) -> Iterator[T]: @overload def iter_all_values( - self, key: str, update_safe=False) -> Iterator[T]: + self, key: str, update_safe: bool = False) -> Iterator[T]: ... @overload def iter_all_values( self, key: Optional[_StrSeq] = None, - update_safe=False) -> Iterator[Dict[str, T]]: + update_safe: bool = False) -> Iterator[Dict[str, T]]: ... @overrides(AbstractDict.iter_all_values, extend_defaults=True)