def _decode_contents(feed: bytes) -> TextIO:
"""Decode the provided data from bz2 to text.
The :arg:`feed` is assumed to be bz2-encoded text data in utf-8
encoding.
Keyword arguments:
feed: The data to be decoded.
Returns: Decoded text stream.
"""
with BytesIO(feed) as compressed, \
bz2.open(compressed, mode='rt', encoding='utf-8') as stream:
yield stream
评论列表
文章目录