@@ -524,39 +524,3 @@ def bytes_repr_numpy(obj: numpy.ndarray, cache: Cache) -> Iterator[bytes]:
524
524
525
525
526
526
NUMPY_CHUNK_LEN = 8192
527
-
528
-
529
- # class MtimeCachingHash:
530
- # """Hashing object that stores a cache of hash values for PathLikes
531
-
532
- # The cache only stores values for PathLikes pointing to existing files,
533
- # and the mtime is checked to validate the cache. If the mtime differs,
534
- # the old hash is discarded and a new mtime-tagged hash is stored.
535
-
536
- # The cache can grow without bound; we may want to consider using an LRU
537
- # cache.
538
- # """
539
-
540
- # def __init__(self) -> None:
541
- # self.cache: ty.Dict[os.PathLike, ty.Tuple[float, Hash]] = {}
542
-
543
- # def __call__(self, obj: object) -> Hash:
544
- # if isinstance(obj, os.PathLike):
545
- # path = Path(obj)
546
- # try:
547
- # stat_res = path.stat()
548
- # mode, mtime = stat_res.st_mode, stat_res.st_mtime
549
- # except FileNotFoundError:
550
- # # Only attempt to cache existing files
551
- # pass
552
- # else:
553
- # if stat.S_ISREG(mode) and obj in self.cache:
554
- # # Cache (and hash) the actual object, as different pathlikes will have
555
- # # different serializations
556
- # save_mtime, save_hash = self.cache[obj]
557
- # if mtime == save_mtime:
558
- # return save_hash
559
- # new_hash = hash_object(obj)
560
- # self.cache[obj] = (mtime, new_hash)
561
- # return new_hash
562
- # return hash_object(obj)
0 commit comments