fixed typechecked()
This commit is contained in:
@ -8,7 +8,7 @@ def typechecked(func):
|
|||||||
def typechecked_call(obj, *args, **kwargs):
|
def typechecked_call(obj, *args, **kwargs):
|
||||||
type_hints = get_type_hints(func)
|
type_hints = get_type_hints(func)
|
||||||
del type_hints["return"]
|
del type_hints["return"]
|
||||||
for arg, dtype in zip(args, type_hints):
|
for arg, dtype in zip(args, type_hints.values()):
|
||||||
arg_type = type(arg)
|
arg_type = type(arg)
|
||||||
if dtype != arg_type:
|
if dtype != arg_type:
|
||||||
raise TypeError(f"{func} expected to receive input of type {dtype.__name__} but received {arg_type.__name__}")
|
raise TypeError(f"{func} expected to receive input of type {dtype.__name__} but received {arg_type.__name__}")
|
||||||
|
Reference in New Issue
Block a user