mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-07-09 01:05:53 +02:00
fix kv and ini parsers to only remove 1 quote from beginning and end
This commit is contained in:
@ -3,6 +3,8 @@ jc changelog
|
||||
20230103 v1.22.5
|
||||
- Update copyright dates
|
||||
- Fix INI parser to include top-level values with no section header
|
||||
- Fix INI and Key/Value parsers to only remove one quotation mark from the
|
||||
beginning and end of values.
|
||||
|
||||
20221230 v1.22.4
|
||||
- Add `iwconfig` command parser
|
||||
|
@ -107,10 +107,10 @@ def _process(proc_data):
|
||||
for heading in proc_data:
|
||||
for key, value in proc_data[heading].items():
|
||||
if value is not None and value.startswith('"') and value.endswith('"'):
|
||||
proc_data[heading][key] = value.lstrip('"').rstrip('"')
|
||||
proc_data[heading][key] = value[1:-1]
|
||||
|
||||
elif value is not None and value.startswith("'") and value.endswith("'"):
|
||||
proc_data[heading][key] = value.lstrip("'").rstrip("'")
|
||||
proc_data[heading][key] = value[1:-1]
|
||||
|
||||
elif value is None:
|
||||
proc_data[heading][key] = ''
|
||||
|
@ -83,10 +83,10 @@ def _process(proc_data):
|
||||
# remove quotation marks from beginning and end of values
|
||||
for key in proc_data:
|
||||
if proc_data[key] is not None and proc_data[key].startswith('"') and proc_data[key].endswith('"'):
|
||||
proc_data[key] = proc_data[key].lstrip('"').rstrip('"')
|
||||
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].lstrip("'").rstrip("'")
|
||||
proc_data[key] = proc_data[key][1:-1]
|
||||
|
||||
elif proc_data[key] is None:
|
||||
proc_data[key] = ''
|
||||
|
Reference in New Issue
Block a user