From fa85d46af0b91477cf354947df628af0dc0d2800 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Thu, 28 Mar 2019 16:38:50 +0100 Subject: ee.xsd: o Renaming to . o Adding on , removing from . A part can have exactly one part. create-order: o Creating anonymous part objects, with two references, one schematic reference and one part-uri reference to the selected part. o Redoing how the order is calculated with the new ObjDb structure. ee.part.Part: o Absorbing bom_file_utils into Part. Much better wrapper object around the xml goop. --- src/ee/xml/bom_file_utils.py | 49 -------------------------------------------- 1 file changed, 49 deletions(-) delete mode 100644 src/ee/xml/bom_file_utils.py (limited to 'src/ee/xml/bom_file_utils.py') diff --git a/src/ee/xml/bom_file_utils.py b/src/ee/xml/bom_file_utils.py deleted file mode 100644 index 97b609f..0000000 --- a/src/ee/xml/bom_file_utils.py +++ /dev/null @@ -1,49 +0,0 @@ -from typing import List, Optional - -from ee.xml import types - -__all__ = [ - "facts", - "find_root_tag", - "schematic_references", - "part_numbers", - "supplier_part_numbers", -] - - -def find_root_tag(root): - return next((tag for tag, klass in types.GDSClassesMapping.items() if klass == type(root)), None) - - -def schematic_references(part: types.Part) -> List[types.SchematicReference]: - return [] if part.referencesProp is None or part.referencesProp.schematic_reference is None else \ - part.referencesProp.schematic_reference - - -def part_numbers(part: types.Part) -> List[types.PartNumber]: - return [] if part.referencesProp is None or part.referencesProp.part_number is None else \ - part.referencesProp.part_number - - -def supplier_part_numbers(part: types.Part) -> List[types.SupplierPartNumber]: - return [] if part.referencesProp is None or part.referencesProp.supplier_part_number is None else \ - part.referencesProp.supplier_part_number - - -def facts(part: types.Part, create=False) -> Optional[types.FactList]: - fs: types.FactList = part.factsProp - - if fs is not None: - return fs - - if not create: - return - - fs = types.FactList() - part.factsProp = fs - return fs - - -def find_fact(fs: types.FactList, key: str) -> Optional[types.Fact]: - l: List[types.Fact] = fs.factProp - return next((f for f in l if f.keyProp == key), None) -- cgit v1.2.3