in torchdata/datapipes/iter/util/cacheholder.py [0:0]
def _cache_check_fn(data, filepath_fn, hash_dict, hash_type, extra_check_fn):
filepaths = data if filepath_fn is None else filepath_fn(data)
if not isinstance(filepaths, (list, tuple)):
filepaths = [
filepaths,
]
for filepath in filepaths:
if not os.path.exists(filepath):
return False
if hash_dict is not None and not _hash_check(filepath, hash_dict, hash_type):
return False
if extra_check_fn is not None and not extra_check_fn(filepath):
return False
return True