mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-06-17 00:07:37 +02:00
fix for multiple list items on a line
This commit is contained in:
@ -104,11 +104,7 @@ def _process(proc_data: JSONDictType) -> JSONDictType:
|
|||||||
return proc_data
|
return proc_data
|
||||||
|
|
||||||
|
|
||||||
def parse(
|
def parse(data: str, raw: bool = False, quiet: bool = False) -> JSONDictType:
|
||||||
data: str,
|
|
||||||
raw: bool = False,
|
|
||||||
quiet: bool = False
|
|
||||||
) -> JSONDictType:
|
|
||||||
"""
|
"""
|
||||||
Main text parsing function
|
Main text parsing function
|
||||||
|
|
||||||
@ -154,27 +150,35 @@ def parse(
|
|||||||
supported_ports.extend(val_list)
|
supported_ports.extend(val_list)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if 'Supported link modes:' in line:
|
if 'Supported link modes:' in line and 'Not reported' not in line:
|
||||||
_, val = line.split(':', maxsplit=1)
|
_, val = line.split(':', maxsplit=1)
|
||||||
supported_link_modes.append(val.strip())
|
val = val.strip()
|
||||||
|
val_list = val.split()
|
||||||
|
supported_link_modes.extend(val_list)
|
||||||
mode = 'supported_link_modes'
|
mode = 'supported_link_modes'
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if 'Supported FEC modes:' in line:
|
if 'Supported FEC modes:' in line and 'Not reported' not in line:
|
||||||
_, val = line.split(':', maxsplit=1)
|
_, val = line.split(':', maxsplit=1)
|
||||||
supported_fec_modes.append(val.strip())
|
val = val.strip()
|
||||||
|
val_list = val.split()
|
||||||
|
supported_fec_modes.extend(val_list)
|
||||||
mode = 'supported_fec_modes'
|
mode = 'supported_fec_modes'
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if 'Advertised link modes:' in line:
|
if 'Advertised link modes:' in line and 'Not reported' not in line:
|
||||||
_, val = line.split(':', maxsplit=1)
|
_, val = line.split(':', maxsplit=1)
|
||||||
advertised_link_modes.append(val.strip())
|
val = val.strip()
|
||||||
|
val_list = val.split()
|
||||||
|
advertised_link_modes.extend(val_list)
|
||||||
mode = 'advertised_link_modes'
|
mode = 'advertised_link_modes'
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if 'Advertised FEC modes:' in line:
|
if 'Advertised FEC modes:' in line and 'Not reported' not in line:
|
||||||
_, val = line.split(':', maxsplit=1)
|
_, val = line.split(':', maxsplit=1)
|
||||||
advertised_fec_modes.append(val.strip())
|
val = val.strip()
|
||||||
|
val_list = val.split()
|
||||||
|
advertised_fec_modes.extend(val_list)
|
||||||
mode = 'advertised_fec_modes'
|
mode = 'advertised_fec_modes'
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@ -185,19 +189,27 @@ def parse(
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
if mode == 'supported_link_modes':
|
if mode == 'supported_link_modes':
|
||||||
supported_link_modes.append(line.strip())
|
val = line.strip()
|
||||||
|
val_list = val.split()
|
||||||
|
supported_link_modes.extend(val_list)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if mode == 'supported_fec_modes':
|
if mode == 'supported_fec_modes':
|
||||||
supported_fec_modes.append(line.strip())
|
val = line.strip()
|
||||||
|
val_list = val.split()
|
||||||
|
supported_fec_modes.extend(val_list)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if mode == 'advertised_link_modes':
|
if mode == 'advertised_link_modes':
|
||||||
advertised_link_modes.append(line.strip())
|
val = line.strip()
|
||||||
|
val_list = val.split()
|
||||||
|
advertised_link_modes.extend(val_list)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if mode == 'advertised_fec_modes':
|
if mode == 'advertised_fec_modes':
|
||||||
advertised_fec_modes.append(line.strip())
|
val = line.strip()
|
||||||
|
val_list = val.split()
|
||||||
|
advertised_fec_modes.extend(val_list)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if mode == 'current_message_level':
|
if mode == 'current_message_level':
|
||||||
|
Reference in New Issue
Block a user