5
5
from dvc .exceptions import OutputNotFoundError
6
6
from dvc .path_info import PathInfo
7
7
from dvc .remote .base import RemoteActionNotImplemented
8
- from dvc .scm . tree import BaseTree
8
+ from dvc .tree . base import BaseRemoteTree
9
9
from dvc .utils import file_md5
10
10
from dvc .utils .fs import copy_fobj_to_file , makedirs
11
11
12
12
logger = logging .getLogger (__name__ )
13
13
14
14
15
- class DvcTree (BaseTree ): # pylint:disable=abstract-method
15
+ class DvcTree (BaseRemoteTree ): # pylint:disable=abstract-method
16
16
"""DVC repo tree.
17
17
18
18
Args:
@@ -27,7 +27,7 @@ class DvcTree(BaseTree): # pylint:disable=abstract-method
27
27
"""
28
28
29
29
def __init__ (self , repo , fetch = False , stream = False ):
30
- self . repo = repo
30
+ super (). __init__ ( repo , { "url" : repo . root_dir })
31
31
self .fetch = fetch
32
32
self .stream = stream
33
33
@@ -101,14 +101,14 @@ def open(
101
101
cache_path = out .cache_path
102
102
return open (cache_path , mode = mode , encoding = encoding )
103
103
104
- def exists (self , path ):
104
+ def exists (self , path ): # pylint: disable=arguments-differ
105
105
try :
106
106
self ._find_outs (path , strict = False , recursive = True )
107
107
return True
108
108
except OutputNotFoundError :
109
109
return False
110
110
111
- def isdir (self , path ):
111
+ def isdir (self , path ): # pylint: disable=arguments-differ
112
112
if not self .exists (path ):
113
113
return False
114
114
@@ -134,7 +134,7 @@ def isdir(self, path):
134
134
except FileNotFoundError :
135
135
return True
136
136
137
- def isfile (self , path ):
137
+ def isfile (self , path ): # pylint: disable=arguments-differ
138
138
if not self .exists (path ):
139
139
return False
140
140
@@ -237,7 +237,7 @@ def get_file_hash(self, path_info):
237
237
return out .checksum
238
238
239
239
240
- class RepoTree (BaseTree ): # pylint:disable=abstract-method
240
+ class RepoTree (BaseRemoteTree ): # pylint:disable=abstract-method
241
241
"""DVC + git-tracked files tree.
242
242
243
243
Args:
@@ -247,7 +247,7 @@ class RepoTree(BaseTree): # pylint:disable=abstract-method
247
247
"""
248
248
249
249
def __init__ (self , repo , ** kwargs ):
250
- self . repo = repo
250
+ super (). __init__ ( repo , { "url" : repo . root_dir })
251
251
if hasattr (repo , "dvc_dir" ):
252
252
self .dvctree = DvcTree (repo , ** kwargs )
253
253
else :
@@ -266,7 +266,9 @@ def stream(self):
266
266
return self .dvctree .stream
267
267
return False
268
268
269
- def open (self , path , mode = "r" , encoding = "utf-8" , ** kwargs ):
269
+ def open (
270
+ self , path , mode = "r" , encoding = "utf-8" , ** kwargs
271
+ ): # pylint: disable=arguments-differ
270
272
if "b" in mode :
271
273
encoding = None
272
274
@@ -276,20 +278,20 @@ def open(self, path, mode="r", encoding="utf-8", **kwargs):
276
278
)
277
279
return self .repo .tree .open (path , mode = mode , encoding = encoding )
278
280
279
- def exists (self , path ):
281
+ def exists (self , path ): # pylint: disable=arguments-differ
280
282
return self .repo .tree .exists (path ) or (
281
283
self .dvctree and self .dvctree .exists (path )
282
284
)
283
285
284
- def isdir (self , path ):
286
+ def isdir (self , path ): # pylint: disable=arguments-differ
285
287
return self .repo .tree .isdir (path ) or (
286
288
self .dvctree and self .dvctree .isdir (path )
287
289
)
288
290
289
291
def isdvc (self , path , ** kwargs ):
290
292
return self .dvctree is not None and self .dvctree .isdvc (path , ** kwargs )
291
293
292
- def isfile (self , path ):
294
+ def isfile (self , path ): # pylint: disable=arguments-differ
293
295
return self .repo .tree .isfile (path ) or (
294
296
self .dvctree and self .dvctree .isfile (path )
295
297
)
@@ -393,7 +395,7 @@ def walk(
393
395
repo_walk = self .repo .tree .walk (top , topdown = topdown )
394
396
yield from self ._walk (dvc_walk , repo_walk , dvcfiles = dvcfiles )
395
397
396
- def walk_files (self , top , ** kwargs ):
398
+ def walk_files (self , top , ** kwargs ): # pylint: disable=arguments-differ
397
399
for root , _ , files in self .walk (top , ** kwargs ):
398
400
for fname in files :
399
401
yield PathInfo (root ) / fname
@@ -437,5 +439,5 @@ def copytree(self, top, dest):
437
439
copy_fobj_to_file (fobj , dest_dir / fname )
438
440
439
441
@property
440
- def hash_jobs (self ):
442
+ def hash_jobs (self ): # pylint: disable=invalid-overridden-method
441
443
return self .repo .tree .hash_jobs
0 commit comments