Skip to content

Commit

Permalink
[Fix issue #558] Add a condition check before subvendor dict creation (
Browse files Browse the repository at this point in the history
…#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 <[email protected]>
Co-authored-by: Kelly Brazil <[email protected]>
  • Loading branch information
ssiuhk and kellyjonbrazil committed Apr 28, 2024
1 parent a9cfb4b commit e2b2406
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion jc/parsers/pci_ids.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/generic/pci.ids.json

Large diffs are not rendered by default.

0 comments on commit e2b2406

Please sign in to comment.