示例#1
0
文件: console.py 项目: yelord/rdc.etl
    def write(threads, prefix='', rewind=True, append=None, debug=False, profile=False):
        t_cnt = len(threads)

        for id, thread in threads:
            if thread.is_alive():
                _line = ''.join((t.black('({})'.format(id)), ' ', t.bold(t.white('+')), ' ', thread.name, ' ',
                                 thread.transform.get_unicode_stats(debug=debug, profile=profile), ' ', ))
            else:
                _line = t.black(''.join(
                    ('({})'.format(id), ' - ', thread.name, ' ', thread.transform.get_unicode_stats(debug=debug, profile=profile), ' ', )))
            print prefix + _line + t.clear_eol

        if append:
            # todo handle multiline
            print ' `->', ' '.join(u'{0}: {1}'.format(t.bold(t.white(k)), v) for k, v in append), t.clear_eol
            t_cnt += 1

        if rewind:
            print t.clear_eol
            print t.move_up * (t_cnt + 2)
示例#2
0
def run(harness):
    print
    retval = harness()
    print " `-> {0}: {1}".format(t.bold(t.white("Return")), retval)
    print
示例#3
0
def run(harness):
    print
    retval = harness()
    print ' `-> {0}: {1}'.format(t.bold(t.white('Return')), retval)
    print