diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2016-12-27 22:49:58 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2016-12-27 22:49:58 +0100 |
commit | 8af35183f1f25e2f9d1d111cac85a48622f22673 (patch) | |
tree | 0b7ed75ff502742196508645323d265fc264ad4f /trygvis/eda/cli/make_bom.py | |
parent | 9bf18900c05547a40bb3c3a7a819a137e81dae92 (diff) | |
download | eda-rdf-8af35183f1f25e2f9d1d111cac85a48622f22673.tar.gz eda-rdf-8af35183f1f25e2f9d1d111cac85a48622f22673.tar.bz2 eda-rdf-8af35183f1f25e2f9d1d111cac85a48622f22673.tar.xz eda-rdf-8af35183f1f25e2f9d1d111cac85a48622f22673.zip |
o Replacing open_database with with_database to make sure it is closed after use.
Diffstat (limited to 'trygvis/eda/cli/make_bom.py')
-rwxr-xr-x | trygvis/eda/cli/make_bom.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/trygvis/eda/cli/make_bom.py b/trygvis/eda/cli/make_bom.py index 39d664b..eae7043 100755 --- a/trygvis/eda/cli/make_bom.py +++ b/trygvis/eda/cli/make_bom.py @@ -22,10 +22,12 @@ class Component(object): def run(schematic_url, db_path): - g = cli.open_database(db_path) + cli.with_database(db_path, lambda g: work(schematic_url, g)) + +def work(schematic_url, g): components = {} - dkParts = {} + dk_parts = {} cli.info("Loading components") @@ -95,11 +97,11 @@ ORDER BY ?ref ?attr_type ?attr_value for row in res: pn = row.part_number - if not hasattr(dkParts, pn): + if not hasattr(dk_parts, pn): part = DigiKeyPart(pn) - dkParts[pn] = part + dk_parts[pn] = part else: - part = dkParts[pn] + part = dk_parts[pn] part.set_attribute(row.type, row.value) cli.info('%5s: %-20s %s' % (pn, row.type + ':', row.value)) |