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

beautify process function

This commit is contained in:
Kelly Brazil
2023-01-05 16:59:22 -08:00
parent 7cfe68b96a
commit 1350a34316

View File

@ -82,15 +82,15 @@ def _process(proc_data):
""" """
# remove quotation marks from beginning and end of values # remove quotation marks from beginning and end of values
for key in proc_data: for key in proc_data:
if proc_data[key] is not None and proc_data[key].startswith('"') and proc_data[key].endswith('"'): if proc_data[key] is None:
proc_data[key] = proc_data[key][1:-1]
elif proc_data[key] is not None and proc_data[key].startswith("'") and proc_data[key].endswith("'"):
proc_data[key] = proc_data[key][1:-1]
elif proc_data[key] is None:
proc_data[key] = '' proc_data[key] = ''
elif proc_data[key].startswith('"') and proc_data[key].endswith('"'):
proc_data[key] = proc_data[key][1:-1]
elif proc_data[key].startswith("'") and proc_data[key].endswith("'"):
proc_data[key] = proc_data[key][1:-1]
return proc_data return proc_data
@ -130,8 +130,5 @@ def parse(data, raw=False, quiet=False):
for key, value in output_dict['data'].items(): for key, value in output_dict['data'].items():
raw_output[key] = value raw_output[key] = value
if raw: return raw_output if raw else _process(raw_output)
return raw_output
else:
return _process(raw_output)