@@ -299,8 +299,10 @@ def from_file(cls, file: FileTree, schema: Namespace) -> t.Self:
299
299
extension = extension ,
300
300
)
301
301
302
+
302
303
@attrs .define
303
304
class Context :
305
+ """A context object that creates context for file on access."""
304
306
305
307
file : FileTree
306
308
dataset : Dataset
@@ -316,67 +318,83 @@ def schema(self) -> Namespace:
316
318
317
319
@property
318
320
def path (self ) -> str :
321
+ """Path of the current file."""
319
322
return self .file_parts .path
320
323
321
324
@property
322
325
def entities (self ) -> dict [str , str ] | None :
326
+ """Entities parsed from the current filename."""
323
327
return self .file_parts .entities
324
328
325
329
@property
326
330
def datatype (self ) -> str | None :
331
+ """Datatype of current file, for examples, anat."""
327
332
return self .file_parts .datatype
328
333
329
334
@property
330
335
def suffix (self ) -> str | None :
336
+ """Suffix of current file."""
331
337
return self .file_parts .suffix
332
338
333
339
@property
334
340
def extension (self ) -> str | None :
341
+ """Extension of current file including initial dot."""
335
342
return self .file_parts .extension
336
343
337
344
@property
338
345
def modality (self ) -> str | None :
346
+ """Modality of current file, for examples, MRI."""
339
347
modalities = self .schema .rules .modalities
340
348
for mod_name , mod_dtypes in modalities .items ():
341
349
if self .datatype in mod_dtypes .datatypes :
342
350
return mod_name
343
351
344
352
@property
345
353
def size (self ) -> int :
354
+ """Length of the current file in bytes."""
346
355
return self .file .direntry .stat ().st_size
347
356
348
357
@property
349
358
def subject (self ) -> ctx .Subject | None :
359
+ """Properties and contents of the current subject."""
350
360
return ctx .Subject ()
351
361
352
362
@property
353
363
def associations (self ) -> ctx .Associations :
364
+ """Associated files, indexed by suffix, selected according to the inheritance principle."""
354
365
return ctx .Associations ()
355
366
356
367
@property
357
368
def columns (self ) -> None :
369
+ """TSV columns, indexed by column header, values are arrays with column contents."""
358
370
pass
359
371
360
372
@property
361
373
def json (self ) -> None :
374
+ """Contents of the current JSON file."""
362
375
pass
363
376
364
377
@property
365
378
def gzip (self ) -> None :
379
+ """Parsed contents of gzip header."""
366
380
pass
367
381
368
382
@property
369
383
def nifti_header (self ) -> None :
384
+ """Parsed contents of NIfTI header referenced elsewhere in schema."""
370
385
pass
371
386
372
387
@property
373
388
def ome (self ) -> None :
389
+ """Parsed contents of OME-XML header, which may be found in OME-TIFF or OME-ZARR files."""
374
390
pass
375
391
376
392
@property
377
393
def tiff (self ) -> None :
394
+ """TIFF file format metadata."""
378
395
pass
379
396
380
397
@property
381
398
def sidecar (self ) -> None :
399
+ """Sidecar metadata constructed via the inheritance principle."""
382
400
pass
0 commit comments