localfs: use mtime/size/inode for checksum

Currently it depends on the whole `info()` output, which has too much
information that doesn't really matter. To check if file contents didn't
change mtime, size, inode combo is enough.
This commit is contained in:
Ruslan Kuprieiev
2021-10-27 20:19:17 +03:00
parent 0d895e2661
commit 41aee9a3b7
+5 -1
View File
@@ -39,7 +39,11 @@ class LocalFileSystem(BaseFileSystem):
return os.path.lexists(path_info)
def checksum(self, path_info) -> str:
return self.fs.checksum(path_info)
from fsspec.utils import tokenize
st = os.stat(path_info)
return str(int(tokenize([st.st_ino, st.st_mtime, st.st_size]), 16))
def isfile(self, path_info) -> bool:
return os.path.isfile(path_info)