utils.py 文件源码

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

项目:bezier 作者: dhermes 项目源码 文件源码
def from_json(cls, id_, info):
        """Convert JSON surface info into ``SurfaceInfo``.

        This involves parsing the dictionary and converting some stringified
        values (rationals and IEEE-754) to Python ``float``-s.

        Args:
            id_ (str): The ID of the surface.
            info (dict): The JSON data of the surface.

        Returns:
            SurfaceInfo: The surface info parsed from the JSON.
        """
        control_points = info.pop('control_points')
        control_points = np.asfortranarray(_convert_float(control_points))

        # Optional fields.
        note = info.pop('note', None)
        _ensure_empty(info)

        return cls(id_, control_points, note=note)


# pylint: disable=too-few-public-methods
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号