def mismatching_types_messages(action, annotations, arg_values, arg_types) -> str:
messages = []
for (arg_value, arg_type, (arg_name, annotation)) in zip(arg_values, arg_types, annotations.items()):
if annotation == Any or isinstance(annotation, TypeVar):
continue
if arg_type != annotation:
messages.append(f'Type mistmach for function `{action.__name__}`')
messages.append(
f'You tried to give me a `{arg_type}` but I wanted a `{annotation}` for the arg `{arg_name}`!' # noqa: E501
)
return '\n'.join(messages)
评论列表
文章目录