cytoscape_helper.py 文件源码

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

项目:viewX-vscode 作者: danielkupco 项目源码 文件源码
def deserialize_json(json):
    """
    A helper method for deserializing json into Cytoscape.js elements.
    :param json: json representation of Cytoscape.js element
    :return: Cytoscape.js element object if json is valid, else json
    """
    class_name = json.pop('__classname__', None)
    if class_name == 'Element':  # type(self).__name__:
        obj = Element.__new__(Element)   # Make instance without calling __init__
        for key, value in json.items():
            setattr(obj, key, value)
            return obj
    else:
        return json
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号