Closed prisae closed 4 years ago
I did some minor re-formatting to please flake8
.
Thinking of the future: Maybe we should actually use the repr_dict()
within __repr__
and _repr_html_
too, it could simplify a lot of code.
Meaning, e.g., in __repr__
, we could do instead of
text += '{:>18} : {}\n'.format('OS', self.system)
text += '{:>18} : {}\n'.format('CPU(s)', self.cpu_count)
text += '{:>18} : {}\n'.format('Machine', self.machine)
text += '{:>18} : {}\n'.format('Architecture', self.architecture)
just this:
for key in ['OS', 'CPU(s)', 'Machine', 'Architecture']:
text += '{:>18} : {}\n'.format(key, repr_dict[key])
Changes look good. Thanks for the refactoring.
Perhaps in a different PR we can address repr_dict
, and depending on the number of keys, it might be helpful to implement it as:
keys = ['OS', 'CPU(s)', 'Machine', 'Architecture']
for key in keys:
text += '{:>18} : {}\n'.format(key, repr_dict[key])
Thanks for reviewing/merging @akaszynski !
Add a
to_dict()
method to serialize the report. This can be useful to, e.g., attach meta-data to data written to a file.