aboutsummaryrefslogtreecommitdiff
path: root/src/ee/xml/bom_file_utils.py
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2019-03-28 16:38:50 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2019-03-28 16:43:14 +0100
commitfa85d46af0b91477cf354947df628af0dc0d2800 (patch)
treeb18b775d232560f57eaeb3f43d0861b98201d4ef /src/ee/xml/bom_file_utils.py
parent52401b170d8f1c9deaa153acca76e7d6060a06df (diff)
downloadee-python-fa85d46af0b91477cf354947df628af0dc0d2800.tar.gz
ee-python-fa85d46af0b91477cf354947df628af0dc0d2800.tar.bz2
ee-python-fa85d46af0b91477cf354947df628af0dc0d2800.tar.xz
ee-python-fa85d46af0b91477cf354947df628af0dc0d2800.zip
ee.xsd:
o Renaming <part-uri> to <part-reference>. o Adding <supplier> on <part>, removing from <supplier-part-number>. 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.
Diffstat (limited to 'src/ee/xml/bom_file_utils.py')
-rw-r--r--src/ee/xml/bom_file_utils.py49
1 files changed, 0 insertions, 49 deletions
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)