Line
Link Here
|
|
ruamel_yaml>=0.17 |
|
ruamel_yaml>=0.17 |
1 |
-- |
|
|
2 |
whipper/common/yaml.py | 18 ++++++++++++++++++ |
1 |
whipper/common/yaml.py | 18 ++++++++++++++++++ |
3 |
whipper/result/logger.py | 11 ++++++----- |
2 |
whipper/result/logger.py | 11 ++++++----- |
4 |
whipper/test/test_result_logger.py | 14 ++++++-------- |
3 |
whipper/test/test_result_logger.py | 14 ++++++-------- |
5 |
3 files changed, 30 insertions(+), 13 deletions(-) |
4 |
3 files changed, 30 insertions(+), 13 deletions(-) |
6 |
create mode 100644 whipper/common/yaml.py |
5 |
create mode 100644 whipper/common/yaml.py |
7 |
-- /dev/null |
6 |
++ b/whipper/common/yaml.py |
Line 0
Link Here
|
0 |
-- a/whipper/result/logger.py |
1 |
from ruamel.yaml import YAML as ruamel_YAML |
|
|
2 |
from ruamel.yaml.compat import StringIO |
3 |
|
4 |
# https://yaml.readthedocs.io/en/latest/example.html#output-of-dump-as-a-string |
5 |
class YAML(ruamel_YAML): |
6 |
def __init__(self, *args, **kwargs): |
7 |
super().__init__() |
8 |
self.width = 4000 |
9 |
self.default_flow_style = False |
10 |
|
11 |
def dump(self, data, stream=None, **kw): |
12 |
inefficient = False |
13 |
if stream is None: |
14 |
inefficient = True |
15 |
stream = StringIO() |
16 |
ruamel_YAML.dump(self, data, stream, **kw) |
17 |
if inefficient: |
18 |
return stream.getvalue() |
|
|
19 |
++ b/whipper/result/logger.py |
Lines 1-12
Link Here
|
1 |
import time |
1 |
import time |
2 |
import hashlib |
2 |
import hashlib |
3 |
import re |
3 |
import re |
4 |
import ruamel.yaml as yaml |
|
|
5 |
from ruamel.yaml.comments import CommentedMap as OrderedDict |
4 |
from ruamel.yaml.comments import CommentedMap as OrderedDict |
6 |
|
5 |
|
7 |
import whipper |
6 |
import whipper |
8 |
|
7 |
|
9 |
from whipper.common import common |
8 |
from whipper.common import common |
|
|
9 |
from whipper.common.yaml import YAML |
10 |
from whipper.result import result |
10 |
from whipper.result import result |
11 |
|
11 |
|
12 |
|
12 |
|
Lines 148-158
def logRip(self, ripResult, epoch):
Link Here
|
148 |
data["EOF"] = "End of status report" |
148 |
data["EOF"] = "End of status report" |
149 |
riplog["Conclusive status report"] = data |
149 |
riplog["Conclusive status report"] = data |
150 |
|
150 |
|
|
|
151 |
yaml = YAML( |
152 |
typ="rt", |
153 |
pure=True |
154 |
) |
151 |
riplog = yaml.dump( |
155 |
riplog = yaml.dump( |
152 |
riplog, |
156 |
riplog |
153 |
default_flow_style=False, |
|
|
154 |
width=4000, |
155 |
Dumper=yaml.RoundTripDumper |
156 |
) |
157 |
) |
157 |
# Add a newline after the "Log creation date" line |
158 |
# Add a newline after the "Log creation date" line |
158 |
riplog = re.sub( |
159 |
riplog = re.sub( |