Skip to content

Commit 1795f7e

Browse files
committed
MNT: switch to using ts*100 as int for image list timestamp
The factor of 100 reduces the window of collisions to 10ms which is an acceptable risk.
1 parent 44ac541 commit 1795f7e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/matplotlib/testing/decorators.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -604,13 +604,13 @@ def _load_blame(target_file):
604604
def _write_imagelist(data, *, target_file):
605605
with open(target_file, "w") as fout:
606606
for fname, v in sorted(data.items()):
607-
fout.write(f"{fname}:{v['rev']}:{v['ts']}\n")
607+
fout.write(f"{fname}:{v['rev']}:{int(v['ts'])}\n")
608608

609609

610610
def _rev_fname(fname, *, target_file="image_list.txt"):
611611
data = _load_imagelist()
612612
old_rev = data[fname]["rev"]
613-
data[fname] = {"rev": old_rev + 1, "ts": time.time()}
613+
data[fname] = {"rev": old_rev + 1, "ts": time.time()*100}
614614
_write_imagelist(data)
615615

616616

0 commit comments

Comments
 (0)