Commit e2bfd0d9 authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

ENH: New convnience function to list all known trees

parent dc3ee77e
......@@ -277,4 +277,4 @@ of the short variable names defined in the
__author__ = 'Michiel Cottaar <>'
from .filetree import FileTree, register_tree, MissingVariable
from .parse import tree_directories
from .parse import tree_directories, list_all_trees
import glob
import os.path as op
from . import filetree
from pathlib import PurePath
from typing import Tuple
from typing import Tuple, List
import re
......@@ -26,6 +27,17 @@ def search_tree(name: str) -> str:
raise ValueError("No file tree found for %s" % name)
def list_all_trees() -> List[str]:
"""Return a list containing paths to all tree files that can be found in
trees = []
for directory in tree_directories:
directory = op.abspath(directory)
trees.extend(glob.glob(op.join(directory, '*.tree')))
return trees
def read_line(line: str) -> Tuple[int, PurePath, str]:
Parses line from the tree file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment