metrics_utils.py 文件源码

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

项目:rca-evaluation 作者: sieve-microservices 项目源码 文件源码
def format_metric_table_line(metrics, metrics_per_line, fillvalue=""):

    # the final result is a string, ready to add in between <TD></TD>
    metric_table_line = ""

    # we use izip_longest to iterate through 'metrics' by 'n' elements at a 
    # time (in this case 'mettrics_per_line')
    izip_longest_args = [iter(metrics)] * metrics_per_line
    for metric_line in izip_longest(*izip_longest_args, fillvalue=fillvalue):
        for metric_str in metric_line:
            # append the metric to the metric table line
            metric_table_line += strip_metric_str(str(metric_str)) + ","
        # add a line break to the table line
        metric_table_line = metric_table_line.rstrip(",") + "<BR/>"

    return(metric_table_line.rstrip("<BR/>"))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号