@@ -211,7 +211,9 @@ def _decode_leaf(r, builds, db: t.Optional['Datalayer'] = None):
211
211
db = db ,
212
212
)
213
213
else :
214
- assert issubclass (cls , Base )
214
+ mro = [f'{ x .__module__ } .{ x .__name__ } ' for x in cls .__mro__ ]
215
+
216
+ assert issubclass (cls , Base ) or 'superduper.base.base.Base' in mro
215
217
dict_ = cls .class_schema .decode_data (dict_ , builds = builds , db = db )
216
218
out = cls .from_dict (dict_ , db = db )
217
219
@@ -272,7 +274,7 @@ def encode_data(self, item, context):
272
274
:param context: A context object containing caches.
273
275
"""
274
276
assert isinstance (item , list )
275
- return [
277
+ out = [
276
278
(
277
279
ComponentType ().encode_data (
278
280
r ,
@@ -283,6 +285,7 @@ def encode_data(self, item, context):
283
285
)
284
286
for r in item
285
287
]
288
+ return out
286
289
287
290
def decode_data (self , item , builds , db ):
288
291
"""Decode the item from `bytes`.
@@ -310,7 +313,8 @@ def encode_data(self, item, context):
310
313
:param context: A context object containing caches.
311
314
"""
312
315
assert isinstance (item , dict )
313
- return {k : File ().encode_data (v , context ) for k , v in item .items ()}
316
+ out = {k : File ().encode_data (v , context ) for k , v in item .items ()}
317
+ return out
314
318
315
319
def decode_data (self , item , builds , db ):
316
320
"""Decode the item from `bytes`.
@@ -633,9 +637,11 @@ def encode_data(self, item, context):
633
637
:param context: A context object containing caches.
634
638
"""
635
639
if isinstance (item , FileItem ):
636
- return item .reference
637
- assert os .path .exists (item )
638
- file = FileItem (identifier = self .hash (item ), path = item )
640
+ file = item
641
+ else :
642
+ assert os .path .exists (item )
643
+ file = FileItem (identifier = self .hash (item ), path = item )
644
+
639
645
context .files [file .identifier ] = file .path
640
646
return file .reference
641
647
@@ -646,7 +652,9 @@ def decode_data(self, item, builds, db):
646
652
:param builds: The build cache.
647
653
:param db: Datalayer.
648
654
"""
649
- return FileItem (identifier = item .split (':' )[- 1 ], db = db )
655
+ file_id = item .split (':' )[- 1 ]
656
+ path = db .artifact_store .get_file (file_id )
657
+ return FileItem (identifier = file_id , path = path , db = db )
650
658
651
659
@classmethod
652
660
def hash (cls , item ):
0 commit comments