constructor.py 文件源码

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

项目:islam-buddy 作者: hamir 项目源码 文件源码
def construct_python_bytes(self, node):
            # type: (Any) -> Any
            try:
                value = self.construct_scalar(node).encode('ascii')
            except UnicodeEncodeError as exc:
                raise ConstructorError(
                    None, None,
                    "failed to convert base64 data into ascii: %s" % exc,
                    node.start_mark)
            try:
                if hasattr(base64, 'decodebytes'):
                    return base64.decodebytes(value)
                else:
                    return base64.decodestring(value)
            except binascii.Error as exc:
                raise ConstructorError(
                    None, None,
                    "failed to decode base64 data: %s" % exc, node.start_mark)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号