def stat_regexp_generator(data):
"""Generate a regeular expression that will swift-recon stats.
Lines printed by swift-recon look like::
[data] low: 0, high: 0, avg: 0.0, total: 0, Failed: 0.0%, no_result: 0, reported: 0
Where data above is the value of the ``data`` parameter passed to the
function.
"""
expression = """\s+low:\s+(?P<low>\d+), # parse out the low result
\s+high:\s+(?P<high>\d+), # parse out the high result
\s+avg:\s+(?P<avg>\d+.\d+), # you get the idea now
\s+total:\s+(?P<total>\d+),
\s+Failed:\s+(?P<failed>\d+.\d+%),
\s+no_result:\s+(?P<no_result>\d+),
\s+reported:\s+(?P<reported>\d+)"""
return re.compile('\[' + data + '\]' + expression, re.VERBOSE)
评论列表
文章目录