1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-07-15 01:24:29 +02:00

[Fix issue #558] Add a condition check before subvendor dict creation (#559)

- Updated jc/parsers/pci_ids.py adding a check to see if the subvendor dict is already created
- Updated test fixture

Signed-off-by: Sam SIU <23556929+ssiuhk@users.noreply.github.com>
Co-authored-by: Kelly Brazil <kellyjonbrazil@gmail.com>
This commit is contained in:
Sam SIU
2024-04-28 20:58:22 +01:00
committed by GitHub
parent a9cfb4b13a
commit e2b2406931
2 changed files with 3 additions and 2 deletions

View File

@ -182,7 +182,8 @@ def parse(
if vdc_subvendor:
subvendor = '_' + vdc_subvendor.groupdict()['subvendor']
subdevice = '_' + vdc_subvendor.groupdict()['subdevice']
vdc_obj[vendor_id][device_id][subvendor] = {}
if not vdc_obj[vendor_id][device_id].get(subvendor) or not isinstance(vdc_obj[vendor_id][device_id][subvendor], dict):
vdc_obj[vendor_id][device_id][subvendor] = {}
vdc_obj[vendor_id][device_id][subvendor][subdevice] = {}
vdc_obj[vendor_id][device_id][subvendor][subdevice]['subsystem_name'] = vdc_subvendor.groupdict()['subsystem_name']
continue

File diff suppressed because one or more lines are too long