Skip to content
Snippets Groups Projects
Commit e59d30c4 authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

remove for loop

parent 254b87e2
No related branches found
No related tags found
1 merge request!5ENH: treat case of removed files
Pipeline #5763 passed
This commit is part of merge request !5. Comments created here will be created in the context of that merge request.
...@@ -62,8 +62,6 @@ def rename(changes, chunksize=10): ...@@ -62,8 +62,6 @@ def rename(changes, chunksize=10):
continue continue
cont = db.Container() cont = db.Container()
cmap = {}
for ii, (old, new) in chunk.iterrows(): for ii, (old, new) in chunk.iterrows():
try: try:
fi = db.File(path=old) fi = db.File(path=old)
...@@ -71,17 +69,12 @@ def rename(changes, chunksize=10): ...@@ -71,17 +69,12 @@ def rename(changes, chunksize=10):
if not fi.is_valid(): if not fi.is_valid():
continue continue
assert fi.path == old
fi.path = new
cont.append(fi) cont.append(fi)
cmap[ii] = len(cont)-1
except Exception as e: except Exception as e:
print(e) print(e)
for ii, (old, new) in chunk.iterrows():
if ii not in cmap:
continue
assert cont[cmap[ii]].path == old
cont[cmap[ii]].path = new
if len(cont) > 0: if len(cont) > 0:
cont.update(unique=False) cont.update(unique=False)
i += 1 i += 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment