environment.py 文件源码

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

项目:cdbcli 作者: kevinjqiu 项目源码 文件源码
def output(self, text, highlighter=None):
        """Send text to the environment's output stream.
        :param text: the text to output
        :param highlighter: an optional function to colourize the text
        """
        if not self.has_pipe:  # only colourize when the output is not piped
            highlighter = highlighter or (lambda x: x)
            text = highlighter(text)
        output = "{}\n".format(text)
        if isinstance(self.output_stream, io.BufferedIOBase):
            output = bytes(output, encoding='utf-8')

        self.output_stream.write(output)
        self.output_stream.flush()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号