test_lib.py 文件源码

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

项目:VPP_P4 作者: RuchaMarathe 项目源码 文件源码
def handle_bad_input_mc(f):
    @wraps(f)
    def handle(*args, **kwargs):
        pre_type = args[0].pre_type
        if pre_type == PreType.None:
            return handle_bad_input(f)(*args, **kwargs)
        EType = {
            PreType.SimplePre : SimplePre.InvalidMcOperation,
            PreType.SimplePreLAG : SimplePreLAG.InvalidMcOperation
        }[pre_type]
        Codes = {
            PreType.SimplePre : SimplePre.McOperationErrorCode,
            PreType.SimplePreLAG : SimplePreLAG.McOperationErrorCode
        }[pre_type]
        try:
            return handle_bad_input(f)(*args, **kwargs)
        except EType as e:
            error = Codes._VALUES_TO_NAMES[e.code]
            print "Invalid PRE operation (%s)" % error
    return handle
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号