parser.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:slack-today-i-did 作者: eeue56 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号