utils.py 文件源码

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

项目:rill 作者: PermaData 项目源码 文件源码
def process(self, msg, kwargs):
        import gevent
        thread = gevent.getcurrent()
        # use explicit component if it was provided
        comp = kwargs.pop('component', None)
        if comp is not None:
            show_thread = comp != thread
        else:
            comp = thread
            show_thread = False

        args = kwargs.pop('args', None)
        if args:
            msg = msg.format(*self._format_args(args))

        message, n = self._format(kwargs.pop('port', comp))
        # FIXME: get maximum port name length:
        pad = max(15 - n, 0)
        # can't use .format to left justify because of the color codes
        message += ' ' * pad
        section = kwargs.pop('section', None)
        if section:
            message += ' {} :'.format(section)
        message += ' {}'.format(msg)
        if show_thread:
            message += colored(" (on thread {})".format(thread), 'yellow')

        return message, kwargs
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号