aboutsummaryrefslogtreecommitdiff
path: root/src/ee/part/excel.py
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2019-05-11 14:48:15 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2019-05-11 14:48:15 +0200
commit0149fcfa2bd9ac8c9f6b05851f7264f005aa2305 (patch)
tree3757a7148377bf18e32234d375444ffccbc5a8f0 /src/ee/part/excel.py
parenteffb3470dd1be3a0dd1eaa83991cef45b5e08dab (diff)
downloadee-python-0149fcfa2bd9ac8c9f6b05851f7264f005aa2305.tar.gz
ee-python-0149fcfa2bd9ac8c9f6b05851f7264f005aa2305.tar.bz2
ee-python-0149fcfa2bd9ac8c9f6b05851f7264f005aa2305.tar.xz
ee-python-0149fcfa2bd9ac8c9f6b05851f7264f005aa2305.zip
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.
Diffstat (limited to 'src/ee/part/excel.py')
-rw-r--r--src/ee/part/excel.py9
1 files changed, 5 insertions, 4 deletions
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: