From 0149fcfa2bd9ac8c9f6b05851f7264f005aa2305 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sat, 11 May 2019 14:48:15 +0200 Subject: drawio-to-parts: new tool. ee.xsd: new type: Assembly and AssemblyPart. Should probably be its own file type. ee.part: Better DSL instead of using the raw xml types. --- src/ee/part/excel.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/ee/part/excel.py') diff --git a/src/ee/part/excel.py b/src/ee/part/excel.py index 12b583d..b0c4a2b 100644 --- a/src/ee/part/excel.py +++ b/src/ee/part/excel.py @@ -1,3 +1,4 @@ +import uuid from pathlib import Path from typing import Optional, Mapping @@ -38,12 +39,12 @@ def from_excel(path: Path, sheet_name: Optional[str]) -> PartDb: print("Bad part, line #{}. MPN or description is required".format(idx)) continue - part = Part(types.Part()) + uri = "urn:uuid:{}".format(uuid.uuid5(uuid.NAMESPACE_URL, url)) + part = Part(types.Part(uri=uri)) - if not mpn: - mpn = desc.replace(" ", "-").lower() + if mpn: + part.add_mpn(mpn) - part.add_mpn(mpn) part.xml.descriptionProp = desc if price: -- cgit v1.2.3