fsl.utils.filetree.parse
¶
-
fsl.utils.filetree.parse.
search_tree
(name: str) → str¶ Searches for the file defining the specific tree
Iteratively searches through the directories in
tree_directories
till a file named ${name}.tree is found- Parameters
name – Name of the tree
- Returns
path to the file defining the tree
-
fsl.utils.filetree.parse.
list_all_trees
() → List[str]¶ Return a list containing paths to all tree files that can be found in
tree_directories
-
fsl.utils.filetree.parse.
check_forbidden_characters
(text, characters, text_type)¶ Checks the text for forbidden characters
raises ValueError if one is found
- Parameters
text – string with the text
characters – sequence of forbidden characters
text_type – type of the text to raise in error message
-
fsl.utils.filetree.parse.
read_line
(line: str) → Tuple[int, pathlib.PurePath, str]¶ Parses line from the tree file
- Parameters
line – input line from a *.tree file
- Returns
Tuple with:
number of spaces in front of the name
name of the file or the sub_tree
short name of the file
-
fsl.utils.filetree.parse.
read_subtree_line
(line: str, directory: str) → Tuple[int, fsl.utils.filetree.filetree.FileTree, str]¶ Parses the line defining a sub_tree
- Parameters
line – input line from a *.tree file
directory – containing directory
- Returns
Tuple with
number of spaces in front of the name
sub_tree
short name of the sub_tree