Skip to content

Commit

Permalink
Cache the BOM entry key in the entry itself
Browse files Browse the repository at this point in the history
  • Loading branch information
kvid committed Apr 6, 2021
1 parent 55760ac commit f549988
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/wireviz/wv_bom.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ def get_additional_component_bom(component: Union[Connector, Cable]) -> List[BOM

def bom_types_group(entry: BOMEntry) -> BOMKey:
"""Return a tuple of string values from the dict that must be equal to join BOM entries."""
return tuple(clean_whitespace(make_str(entry.get(key))) for key in ('description', 'unit', 'manufacturer', 'mpn', 'pn'))
if 'key' not in entry:
entry['key'] = tuple(clean_whitespace(make_str(entry.get(k))) for k in ('description', 'unit', 'manufacturer', 'mpn', 'pn'))
return entry['key']

def generate_bom(harness: "Harness") -> List[BOMEntry]:
"""Return a list of BOM entries generated from the harness."""
Expand Down

0 comments on commit f549988

Please sign in to comment.