Commit 9bc81f48 authored by juga's avatar juga
Browse files

Add method to parse V100 file given a path

parent 11ec9846
......@@ -450,6 +450,18 @@ class V3BWFile(object):
bw_lines = [V3BWLine.from_bw_line_v110(line) for line in lines]
return cls(header, bw_lines)
@classmethod
def from_v100_fpath(cls, fpath):
log.info('Parsing bandwidth file %s', fpath)
with open(fpath) as fd:
text = fd.read()
all_lines = text.split(LINE_SEP)
header, lines = V3BWHeader.from_lines_v100(all_lines)
bw_lines = sorted([V3BWLine.from_bw_line_v110(l) for l in lines],
key=lambda l: l.bw)
return cls(header, bw_lines)
@staticmethod
def bw_kb(bw_lines, reverse=False):
bw_lines_scaled = copy.deepcopy(bw_lines)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment