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