/usr/lib/python3/dist-packages/checkbox_support/parsers/lshwjson.py is in python3-checkbox-support 0.2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | import sys
import json
class LshwJsonParser:
def __init__(self, stream_or_string):
self.stream_or_string = stream_or_string
def _parse_lshw(self, lshw, result):
if 'children' in lshw.keys():
for child in lshw['children']:
self._parse_lshw(child, result)
del lshw['children']
result.addHardware(lshw)
def run(self, result):
try:
lshw = json.loads(self.stream_or_string)
except:
print('not valid json')
self._parse_lshw(lshw, result)
|