Add in more interfaces (and fix additional errors now that type information is available).

This commit is contained in:
Mike Auty
2017-12-13 20:48:52 +00:00
parent 5536412a5e
commit 50b60c0df6
8 changed files with 169 additions and 102 deletions
+4 -2
View File
@@ -15,8 +15,10 @@ class ValidityRoutines(object):
These are currently implemented by assertions that will be optimized out of production code.
"""
V = typing.TypeVar('V')
@classmethod
def _check_type(cls, value, valid_type):
def _check_type(cls, value: V, valid_type: typing.Type) -> V:
"""Checks that value is an instance of valid_type, and returns value if it is, or throws a TypeError otherwise
:param value: The value of which to validate the type
@@ -30,7 +32,7 @@ class ValidityRoutines(object):
return value
@classmethod
def _check_class(cls, klass, valid_class):
def _check_class(cls, klass: typing.Type, valid_class: typing.Type) -> typing.Type:
"""Checks that class is an instance of valid_class, and returns klass if it is, or throws a TypeError otherwise
:param klass: Class to validate