decoders.py 文件源码

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

项目:jumpscale_portal 作者: jumpscale7 项目源码 文件源码
def write(self, data):
        """Takes any input data provided, decodes it as quoted-printable, and
        passes it on to the underlying object.

        :param data: quoted-printable data to decode
        """
        # Prepend any cache info to our data.
        if len(self.cache) > 0:
            data = self.cache + data

        # Since the longest possible escape is 3 characters long, either in
        # the form '=XX' or '=\r\n', we encode up to 3 characters before the
        # end of the string.
        enc, rest = data[:-3], data[-3:]

        # Encode and write, if we have data.
        if len(enc) > 0:
            self.underlying.write(binascii.a2b_qp(enc))

        # Save remaining in cache.
        self.cache = rest
        return len(data)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号