base.py 文件源码

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

项目:deckhand 作者: att-comdev 项目源码 文件源码
def _to_dict(self, body, many=False):
        """Convert YAML-formatted response body into dict or list.

        :param body: YAML-formatted response body to convert.
        :param many: Controls whether to return list or dict. If True, returns
            list, else dict. False by default.
        :rtype: dict or list
        """
        try:
            return (
                list(yaml.safe_load_all(body))
                    if many else yaml.safe_load(body)
            )
        except yaml.YAMLError:
            return None
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号