@@ -202,12 +202,10 @@ def match(self) -> bool:
202202 # Peek at the file to confirm it is really Croissant.
203203 # We use get_file() so the content may already be cached.
204204 try :
205- fobj = self .proj .get_file (basename )
205+ fobj = self .proj .get_file (basename , text = True )
206206 if fobj is None :
207207 continue
208208 text = fobj .read ()
209- if isinstance (text , bytes ):
210- text = text .decode ("utf-8" , errors = "replace" )
211209 if self ._CROISSANT_CONFORMSTO in text :
212210 self ._matched_file = basename
213211 return True
@@ -218,8 +216,12 @@ def match(self) -> bool:
218216 def parse (self ) -> None :
219217 import json
220218
221- from projspec .content import DescriptiveMetadata , License , Citation
222- from projspec .content .data import CroissantRecordSet
219+ from projspec .content import (
220+ CroissantRecordSet ,
221+ DescriptiveMetadata ,
222+ License ,
223+ Citation ,
224+ )
223225 from projspec .utils import AttrDict
224226
225227 if self ._matched_file is None :
@@ -228,7 +230,7 @@ def parse(self) -> None:
228230 self ._contents = AttrDict ()
229231 self ._artifacts = AttrDict ()
230232
231- with self .proj . fs . open (self .proj . basenames [ self . _matched_file ], "rt" ) as f :
233+ with self .get_file (self ._matched_file , text = True ) as f :
232234 meta = json .load (f )
233235
234236 # --- dataset-level metadata ---
@@ -295,6 +297,7 @@ def parse(self) -> None:
295297 fields = field_names ,
296298 )
297299
300+ # TODO: file/fileSets, transforms
298301 if record_sets :
299302 self ._contents ["croissant_record_set" ] = AttrDict (record_sets )
300303
0 commit comments