utils.py 文件源码

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

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

        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 curve.
            info (dict): The JSON data of the curve.

        Returns:
            CurveInfo: The curve info parsed from the JSON.
        """
        control_points = info.pop('control_points')
        control_points = np.asfortranarray(_convert_float(control_points))
        implicitized = info.pop('implicitized', None)

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

        return cls(id_, control_points, implicitized=implicitized, note=note)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号