aboutsummaryrefslogtreecommitdiff
path: root/src/ee/part/__init__.py
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2019-02-27 16:09:53 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2019-02-27 16:09:53 +0100
commit0ce5c1e6dcea6643cf72de885c0aca52bf4ac28c (patch)
treeef9109b762a46079ce91aa3376f727aa76abf8b8 /src/ee/part/__init__.py
parentf14a40a4f80275daceeb73f944e1aa1f84d16c79 (diff)
downloadee-python-0ce5c1e6dcea6643cf72de885c0aca52bf4ac28c.tar.gz
ee-python-0ce5c1e6dcea6643cf72de885c0aca52bf4ac28c.tar.bz2
ee-python-0ce5c1e6dcea6643cf72de885c0aca52bf4ac28c.tar.xz
ee-python-0ce5c1e6dcea6643cf72de885c0aca52bf4ac28c.zip
o Always sorting index.xml for better git diffs.
o Normalizing more Digikey facts. o When creating distributor search lists, create a new plain <part> with containing only the part numbers.
Diffstat (limited to 'src/ee/part/__init__.py')
-rw-r--r--src/ee/part/__init__.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/ee/part/__init__.py b/src/ee/part/__init__.py
index 84a6174..e0b0087 100644
--- a/src/ee/part/__init__.py
+++ b/src/ee/part/__init__.py
@@ -91,7 +91,10 @@ def save_db(dir_path: Path, db: PartDb):
idx.filesProp = indexFile.FileList()
files = idx.filesProp.fileProp
- for part in db.iterparts():
+ parts = db.iterparts()
+ parts = sorted(parts, key=lambda p: p.idProp)
+
+ for part in parts:
id_ = part.id
path = dir_path / "{}.xml".format(id_)
with path.open("w") as f: