state: use str representations for inode and mtime

Signed-off-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
Ruslan Kuprieiev
2018-03-18 12:35:56 +02:00
parent 27a5b1e356
commit fa22e56917
3 changed files with 15 additions and 4 deletions
+13 -4
View File
@@ -1,5 +1,6 @@
import os
import json
import nanotime
from checksumdir import dirhash
from dvc.system import System
@@ -70,9 +71,17 @@ class State(object):
with open(self.state_file, 'w+') as fd:
json.dump(self._db, fd)
@staticmethod
def mtime(path):
return str(int(nanotime.timestamp(os.path.getmtime(path))))
@staticmethod
def inode(path):
return str(System.inode(path))
def update(self, path, dump=True):
mtime = os.path.getmtime(path)
inode = System.inode(path)
mtime = self.mtime(path)
inode = self.inode(path)
md5 = self._get(inode, mtime)
if md5:
@@ -100,7 +109,7 @@ class State(object):
return None
def get(self, path):
mtime = os.path.getmtime(path)
inode = System.inode(path)
mtime = self.mtime(path)
inode = self.inode(path)
return self._get(inode, mtime)
+1
View File
@@ -13,3 +13,4 @@ gitpython>=2.1.8
ntfsutils>=0.1.3
checksumdir>=1.1.4
setuptools>=34.0.0
nanotime>=0.5.2
+1
View File
@@ -18,6 +18,7 @@ install_requires = [
"ntfsutils>=0.1.3",
"checksumdir>=1.1.4",
"setuptools>=34.0.0",
"nanotime>=0.5.2",
]
setup(