factory.py 文件源码

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

项目:osisoftpy 作者: dstcontrols 项目源码 文件源码
def create(factory, thing, session, webapi=None):
    """
    Return an object created with factory
    :param webapi: 
    :param factory: 
    :param params: 
    :param session: 
    :return: 
    """


    payload = dict(map(lambda k_v: (k_v[0].lower(), k_v[1]), iteritems(thing)))

    # added to avoid creating Value objects if the value was considered bad values
    # but we don't need this since we don't want the library to cull bad values that
    # the pi web api gave us.
    #
    # if 'good' in payload:
    #     if not payload['good']:
    #         return None

    payload.update({'session': session, 'webapi': webapi})
    thing = factory.create(**payload)
    return thing
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号