bidsbuilder.modules.core.dataset_tree¶
- class Directory¶
Bases:
FileCollectionRepresent a directory with its associated files
- __init__(_name, _file_link, _name_link, parent=None, children=NOTHING)¶
Method generated by attrs for class Directory.
- Parameters:
_name (str)
_file_link (DatasetCore | BidsDataset)
_name_link (filenameBase)
parent (Directory | None)
- Return type:
None
- add_child(name_ref, file_ref, type_flag='collection')¶
- Return type:
Union[Self,FileCollection,FileEntry]- Parameters:
name_ref (filenameBase)
file_ref (DatasetCore)
type_flag (str)
- add_tree_node(name_ref)¶
- Parameters:
name_ref (Self | FileCollection | FileEntry)
- children: dict[str, Union['Directory', Self, 'FileEntry']]¶
- fetch(relpath, reference=True)¶
- Return type:
Union[None,DatasetCore,FileEntry]- Parameters:
relpath (PathLike)
reference (bool)
- property is_dir¶
- property name: str¶
- parent: Union['Directory', None]¶
- property path: str¶
- property relative_path: str¶
The path of the current Dir, relative to the root.
Follows parents up to the root and joins with POSIX separators (/). Directories include trailing slashes for simpler matching.
- class FileCollection¶
Bases:
FileEntryFile collections are stricly not a directory -> They are groups which contain related files i.e. A raw data file and it’s JSON sidecar file would form a collection, with both individual files being FileEntry’s
This enables grouping of similar metadata between them
- __init__(_name, _file_link, _name_link, parent=None, children=NOTHING)¶
Method generated by attrs for class FileCollection.
- Parameters:
_name (str)
_file_link (Union['DatasetCore', 'BidsDataset'])
_name_link (filenameBase)
parent (Union['Directory', None])
children (dict[str, Union['Directory', Self, 'FileEntry']])
- Return type:
None
- add_child(name_ref, file_ref)¶
- Return type:
- Parameters:
name_ref (filenameBase)
file_ref (DatasetCore)
- children: dict[str, Union['Directory', Self, 'FileEntry']]¶
- fetch(relpath, reference=True)¶
- Return type:
Union[None,DatasetCore,FileEntry]- Parameters:
relpath (str)
reference (bool)
- property is_dir¶
- property name: str¶
- parent: Union['Directory', None]¶
- property path: str¶
- property relative_path: str¶
The path of the current FileTree, relative to the root.
Follows parents up to the root and joins with POSIX separators (/). Directories include trailing slashes for simpler matching.
- class FileEntry¶
Bases:
object- __init__(_name, _file_link, _name_link, parent=None)¶
Method generated by attrs for class FileEntry.
- Parameters:
_name (str)
_file_link (Union['DatasetCore', 'BidsDataset'])
_name_link (filenameBase)
parent (Union['Directory', None])
- Return type:
None
- property is_dir¶
- property name: str¶
- parent: Union['Directory', None]¶
- property path: str¶
- property relative_path: str¶