commit ee80724056521a4aa3b0741ab53f68b0448189bb
Author: Matt Traudt <sirmatt(a)ksu.edu>
Date: Thu Jun 14 18:37:25 2018 -0400
Standardize capitalization of v3bw class names
---
sbws/core/generate.py | 4 ++--
sbws/lib/v3bwfile.py | 10 +++++-----
tests/unit/lib/test_v3bwfile.py | 24 ++++++++++++------------
3 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/sbws/core/generate.py b/sbws/core/generate.py
index 3f0df18..25653b1 100644
--- a/sbws/core/generate.py
+++ b/sbws/core/generate.py
@@ -1,5 +1,5 @@
from sbws.globals import (fail_hard, is_initted, SCALE_CONSTANT)
-from sbws.lib.v3bwfile import V3BwFile
+from sbws.lib.v3bwfile import V3BWFile
from sbws.lib.resultdump import load_recent_results_in_datadir
from argparse import ArgumentDefaultsHelpFormatter
import os
@@ -77,7 +77,7 @@ def main(args, conf):
log.warning('No recent results, so not generating anything. (Have you '
'ran sbws scanner recently?)')
return
- bw_file = V3BwFile.from_arg_results(args, conf, results)
+ bw_file = V3BWFile.from_arg_results(args, conf, results)
output = args.output or conf['paths']['v3bw_fname'].format(now_fname())
_write_v3bw_file(bw_file, output)
log.info('Mean bandwidth per line: %f "KiB"', bw_file.avg_bw)
diff --git a/sbws/lib/v3bwfile.py b/sbws/lib/v3bwfile.py
index e09392e..5b07f80 100644
--- a/sbws/lib/v3bwfile.py
+++ b/sbws/lib/v3bwfile.py
@@ -95,7 +95,7 @@ def result_type_to_key(type_str):
return type_str.replace('-', '_')
-class V3BwHeader(object):
+class V3BWHeader(object):
"""
Create a bandwidth measurements (V3bw) header
following bandwidth measurements document spec version 1.1.0.
@@ -178,7 +178,7 @@ class V3BwHeader(object):
def from_lines_v110(cls, lines):
"""
:param list lines: list of lines to parse
- :returns: tuple of V3BwHeader object and non-header lines
+ :returns: tuple of V3BWHeader object and non-header lines
"""
assert isinstance(lines, list)
try:
@@ -198,7 +198,7 @@ class V3BwHeader(object):
def from_text_v110(self, text):
"""
:param str text: text to parse
- :returns: tuple of V3BwHeader object and non-header lines
+ :returns: tuple of V3BWHeader object and non-header lines
"""
assert isinstance(text, str)
return self.from_lines_v110(text.split(LINE_SEP))
@@ -351,7 +351,7 @@ class V3BWLine(object):
return cls.from_results(data[fingerprint])
-class V3BwFile(object):
+class V3BWFile(object):
"""
Create a Bandwidth List file following spec version 1.1.0
@@ -384,6 +384,6 @@ class V3BwFile(object):
bw_lines = sorted(bw_lines, key=lambda d: d.bw, reverse=True)
if args.scale:
bw_lines = scale_lines(bw_lines, args.scale_constant)
- header = V3BwHeader.from_results(conf, results)
+ header = V3BWHeader.from_results(conf, results)
f = cls(header, bw_lines)
return f
diff --git a/tests/unit/lib/test_v3bwfile.py b/tests/unit/lib/test_v3bwfile.py
index e18278d..2f4a631 100644
--- a/tests/unit/lib/test_v3bwfile.py
+++ b/tests/unit/lib/test_v3bwfile.py
@@ -5,9 +5,9 @@ import json
from sbws import __version__ as version
from sbws.globals import SPEC_VERSION, RESULT_VERSION
from sbws.lib.resultdump import Result, load_result_file
-from sbws.lib.v3bwfile import (V3BwHeader, V3BWLine, TERMINATOR, LINE_SEP,
+from sbws.lib.v3bwfile import (V3BWHeader, V3BWLine, TERMINATOR, LINE_SEP,
KEYVALUE_SEP_V110, num_results_of_type,
- V3BwFile)
+ V3BWFile)
timestamp = 1523974147
timestamp_l = str(timestamp)
@@ -86,13 +86,13 @@ RESULT_ERROR_STREAM_STR = str(RESULT_ERROR_STREAM_DICT)
def test_v3bwheader_str():
"""Test header str"""
- header = V3BwHeader(timestamp_l, file_created=file_created)
+ header = V3BWHeader(timestamp_l, file_created=file_created)
assert header_str == str(header)
def test_v3bwheader_extra_str():
"""Test header str with additional headers"""
- header = V3BwHeader(timestamp_l,
+ header = V3BWHeader(timestamp_l,
file_created=file_created,
generator_started=generator_started,
earliest_bandwidth=earliest_bandwidth)
@@ -101,33 +101,33 @@ def test_v3bwheader_extra_str():
def test_v3bwheader_from_lines():
""""""
- header_obj = V3BwHeader(timestamp_l,
+ header_obj = V3BWHeader(timestamp_l,
file_created=file_created,
generator_started=generator_started,
earliest_bandwidth=earliest_bandwidth)
- header, _ = V3BwHeader.from_lines_v110(header_extra_ls)
+ header, _ = V3BWHeader.from_lines_v110(header_extra_ls)
assert str(header_obj) == str(header)
def test_v3bwheader_from_text():
""""""
- header_obj = V3BwHeader(timestamp_l,
+ header_obj = V3BWHeader(timestamp_l,
file_created=file_created,
generator_started=generator_started,
earliest_bandwidth=earliest_bandwidth)
- header, _ = V3BwHeader.from_text_v110(header_extra_str)
+ header, _ = V3BWHeader.from_text_v110(header_extra_str)
assert str(header_obj) == str(header)
def test_v3bwheader_from_file(datadir):
"""Test header str with additional headers"""
- header = V3BwHeader(timestamp_l,
+ header = V3BWHeader(timestamp_l,
file_created=file_created,
generator_started=generator_started,
earliest_bandwidth=earliest_bandwidth)
# at some point this should be read from conftest
text = datadir.read('v3bw/20180425_131057.v3bw')
- h, _ = V3BwHeader.from_text_v110(text)
+ h, _ = V3BWHeader.from_text_v110(text)
assert str(h) == str(header)
@@ -160,10 +160,10 @@ def test_v3bwfile(datadir, tmpdir):
# at some point this should be obtained from conftest
v3bw = datadir.read('v3bw/20180425_131057.v3bw')
results = load_result_file(str(datadir.join("results.txt")))
- header = V3BwHeader(timestamp_l,
+ header = V3BWHeader(timestamp_l,
file_created=file_created,
generator_started=generator_started,
earliest_bandwidth=earliest_bandwidth)
bwls = [V3BWLine.from_results(results[fp]) for fp in results]
- f = V3BwFile(header, bwls)
+ f = V3BWFile(header, bwls)
assert v3bw == str(f)