diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2019-04-09 06:03:33 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2019-04-13 05:58:28 +0200 |
commit | a00dcfc7f6d12442fca8c5b7d43f12b707f0c877 (patch) | |
tree | 537fe862e4a8946a1346e87f97ac77772db56e17 /src/ee/part/create_distributor_search_list.py | |
parent | 0232e0f992c3a03fe163b437cc1c1d631c8ddb83 (diff) | |
download | ee-python-a00dcfc7f6d12442fca8c5b7d43f12b707f0c877.tar.gz ee-python-a00dcfc7f6d12442fca8c5b7d43f12b707f0c877.tar.bz2 ee-python-a00dcfc7f6d12442fca8c5b7d43f12b707f0c877.tar.xz ee-python-a00dcfc7f6d12442fca8c5b7d43f12b707f0c877.zip |
o Renaming part-create-distributor-search-list to pn-part-search-list.
Making the search more narrow, it is only responsible to find parts
based on MPN or SPN.
Diffstat (limited to 'src/ee/part/create_distributor_search_list.py')
-rw-r--r-- | src/ee/part/create_distributor_search_list.py | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/src/ee/part/create_distributor_search_list.py b/src/ee/part/create_distributor_search_list.py deleted file mode 100644 index 8d70e3e..0000000 --- a/src/ee/part/create_distributor_search_list.py +++ /dev/null @@ -1,44 +0,0 @@ -from pathlib import Path - -from ee.part import PartDb, load_db, save_db, Part, fact_keys -from ee.xml import types - -__all__ = ["create_distributor_search_list"] - -ignored_part_classes = [ - "mechanical" -] - - -def create_distributor_search_list(in_path: Path, out_path: Path): - in_parts = load_db(in_path) - out_parts = PartDb() - - print("loaded {} existing parts".format(in_parts.size())) - - for xml in in_parts.iterparts(): - part = Part(xml) - pn_value = next((p.valueProp for p in part.get_mpns()), None) - - part_class = part.find_fact(fact_keys.part_class) - if part_class: - if part_class.valueProp in ignored_part_classes: - continue - - if pn_value is None: - refs = [ref.referenceProp for ref in part.get_schematic_references()] - print("Skipping part with no part number: schematic reference: {}".format(", ".join(refs))) - continue - - entry = out_parts.find_by_pn(pn_value) - - if entry is not None: - continue - - new_part = types.Part() - new_part.referencesProp = xml.referencesProp - - out_parts.add_entry(new_part, True) - - print("Saving {} work parts".format(out_parts.size())) - save_db(out_path, out_parts) |