Skip to content

Commit

Permalink
Type Checking
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian-B committed Dec 19, 2023
1 parent caceb8f commit e47d5d9
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion unittests/abstract_base/abstract_has_constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def add_constraint(self, constraint: Any):

@property
@abstractmethod
def constraints(self):
def constraints(self) -> Any:
""" An iterable of constraints
:return: iterable of constraints
Expand Down
5 changes: 3 additions & 2 deletions unittests/abstract_base/checked_bad_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from typing import Any
from spinn_utilities.overrides import overrides
from .abstract_grandparent import AbstractGrandParent
from .abstract_has_constraints import AbstractHasConstraints
Expand All @@ -25,9 +26,9 @@ def set_label(selfself, label):
pass

@overrides(AbstractHasConstraints.add_constraint)
def add_constraint(self, not_constraint):
def add_constraint(self, not_constraint: Any):
raise NotImplementedError("We set our own constrainst")

@overrides(AbstractHasConstraints.constraints)
def constraints(self):
def constraints(self) -> Any:
return ["No night feeds", "No nappy changes"]
2 changes: 1 addition & 1 deletion unittests/abstract_base/grandparent.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ def add_constraint(self, constraint: Any):
raise NotImplementedError("We set our own constrainst")

@overrides(AbstractHasConstraints.constraints)
def constraints(self):
def constraints(self) -> Any:
return ["No night feeds", "No nappy changes"]
2 changes: 1 addition & 1 deletion unittests/abstract_base/no_label.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ def add_constraint(self, constraint: Any):
raise NotImplementedError("We set our own constraints")

@overrides(AbstractHasConstraints.constraints)
def constraints(self):
def constraints(self) -> Any:
return ["No night feeds", "No nappy changes"]
2 changes: 1 addition & 1 deletion unittests/abstract_base/unchecked_bad_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ def add_constraint(self, constraint: Any):
raise NotImplementedError("We set our own constrainst")

@overrides(AbstractHasConstraints.constraints)
def constraints(self):
def constraints(self) -> Any:
return ["No night feeds", "No nappy changes"]

0 comments on commit e47d5d9

Please sign in to comment.