Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fslpy
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Evan Edmond
fslpy
Commits
e2bfd0d9
Commit
e2bfd0d9
authored
6 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
ENH: New convnience function to list all known trees
parent
dc3ee77e
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
fsl/utils/filetree/__init__.py
+1
-1
1 addition, 1 deletion
fsl/utils/filetree/__init__.py
fsl/utils/filetree/parse.py
+13
-1
13 additions, 1 deletion
fsl/utils/filetree/parse.py
with
14 additions
and
2 deletions
fsl/utils/filetree/__init__.py
+
1
−
1
View file @
e2bfd0d9
...
...
@@ -277,4 +277,4 @@ of the short variable names defined in the
__author__ =
'
Michiel
Cottaar
<
Michiel
.
Cottaar
@ndcn.ox.ac.uk
>
'
from .filetree import FileTree, register_tree, MissingVariable
from .parse import tree_directories
from .parse import tree_directories
, list_all_trees
This diff is collapsed.
Click to expand it.
fsl/utils/filetree/parse.py
+
13
−
1
View file @
e2bfd0d9
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
:data:`tree_directories`
"""
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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment