1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-06-17 00:07:37 +02:00

add int conversions

This commit is contained in:
Kelly Brazil
2023-02-04 19:04:43 -08:00
parent 5c7bf363a6
commit aada5f0794

View File

@ -162,6 +162,15 @@ def _process(proc_data: List[JSONDictType]) -> List[JSONDictType]:
List of Dictionaries. Structured to conform to the schema. List of Dictionaries. Structured to conform to the schema.
""" """
int_list = {'read', 'write', 'checksum'}
for obj in proc_data:
if 'config' in obj:
for conf in obj['config']:
for k, v in conf.items():
if k in int_list:
conf[k] = jc.utils.convert_to_int(v)
return proc_data return proc_data
@ -223,10 +232,17 @@ def parse(
pool_str += line + '\n' pool_str += line + '\n'
continue continue
# preserve indentation in continuation lines
if line.startswith(' '): if line.startswith(' '):
pool_str += line + '\n' pool_str += line + '\n'
continue continue
# indent path lines for errors field
if line.startswith('/'):
pool_str += ' ' + line + '\n'
continue
# remove initial spaces from field start lines so we don't confuse line continuation
pool_str += line.strip() + '\n' pool_str += line.strip() + '\n'
if pool_str: if pool_str: