Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
juga
sbws
Commits
39219fc2
Commit
39219fc2
authored
Aug 31, 2018
by
juga
Browse files
Add method to parse V110 file from a given path
parent
d0ca906c
Changes
1
Hide whitespace changes
Inline
Side-by-side
sbws/lib/v3bwfile.py
View file @
39219fc2
...
...
@@ -429,6 +429,16 @@ class V3BWFile(object):
f
=
cls
(
header
,
bw_lines
)
return
f
@
classmethod
def
from_v110_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_v110
(
all_lines
)
bw_lines
=
[
V3BWLine
.
from_bw_line_v110
(
line
)
for
line
in
lines
]
return
cls
(
header
,
bw_lines
)
@
staticmethod
def
bw_kb
(
bw_lines
,
reverse
=
False
):
bw_lines_scaled
=
copy
.
deepcopy
(
bw_lines
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment