File tree 2 files changed +25
-0
lines changed
2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change 9
9
from dvc_objects .errors import ObjectFormatError
10
10
11
11
from .hash_info import HashInfo
12
+ from .obj import HashFile
12
13
13
14
if TYPE_CHECKING :
14
15
from dvc_objects .fs .base import AnyFSPath , FileSystem
@@ -47,6 +48,13 @@ def config(self):
47
48
"read_only" : self .read_only ,
48
49
}
49
50
51
+ def get (self , oid : str ):
52
+ return HashFile (
53
+ self .oid_to_path (oid ),
54
+ self .fs ,
55
+ HashInfo (self .hash_name , oid ),
56
+ )
57
+
50
58
def add (
51
59
self ,
52
60
path : "AnyFSPath" ,
Original file line number Diff line number Diff line change
1
+ from typing import TYPE_CHECKING
2
+
3
+ from dvc_objects .obj import Object
4
+
5
+ if TYPE_CHECKING :
6
+ from .fs .base import AnyFSPath , FileSystem
7
+ from .hash_info import HashInfo
8
+
9
+
10
+ class HashFile (Object ):
11
+ def __init__ (
12
+ self , path : "AnyFSPath" , fs : "FileSystem" , hash_info : "HashInfo"
13
+ ):
14
+ assert hash_info .value
15
+ oid = hash_info .value
16
+ super ().__init__ (path , fs , oid )
17
+ self .hash_info = hash_info
You can’t perform that action at this time.
0 commit comments