clrtype.py 文件源码

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

项目:EdgeHTTP2Fuzzer 作者: sirusdv 项目源码 文件源码
def make_cab(attrib_type, *args, **kwds):
    clrtype = clr.GetClrType(attrib_type)
    argtypes = tuple(map(lambda x:clr.GetClrType(type(x)), args))
    ci = clrtype.GetConstructor(argtypes)

    props = ([],[])
    fields = ([],[])

    for kwd in kwds:
        pi = clrtype.GetProperty(kwd)
        if pi is not None:
            props[0].append(pi)
            props[1].append(kwds[kwd])
        else:
            fi = clrtype.GetField(kwd)
            if fi is not None:
                fields[0].append(fi)
                fields[1].append(kwds[kwd])
            else:
                raise TypeError("No %s Member found on %s" % (kwd, clrtype.Name))

    return CustomAttributeBuilder(ci, args, 
        tuple(props[0]), tuple(props[1]), 
        tuple(fields[0]), tuple(fields[1]))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号