Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
FSL
fslpy
Commits
2211bbd6
Commit
2211bbd6
authored
Mar 27, 2020
by
Michiel Cottaar
Browse files
REF: set partial_fill to False again
Still using `partial_fill` when creating FileTreeQuery
parent
dd48efe0
Changes
3
Hide whitespace changes
Inline
Side-by-side
fsl/utils/filetree/filetree.py
View file @
2211bbd6
...
...
@@ -354,7 +354,7 @@ class FileTree(object):
self
.
variables
=
{}
@
classmethod
def
read
(
cls
,
tree_name
:
str
,
directory
=
'.'
,
partial_fill
=
Tru
e
,
**
variables
)
->
"FileTree"
:
def
read
(
cls
,
tree_name
:
str
,
directory
=
'.'
,
partial_fill
=
Fals
e
,
**
variables
)
->
"FileTree"
:
"""
Reads a FileTree from a specific file
...
...
fsl/utils/filetree/query.py
View file @
2211bbd6
...
...
@@ -89,6 +89,8 @@ class FileTreeQuery(object):
:arg tree: The :class:`.FileTree` object
"""
# Hard-code into the templates any pre-defined variables
tree
=
tree
.
partial_fill
()
# Find all files present in the directory
# (as Match objects), and find all variables,
...
...
tests/test_filetree/test_read.py
View file @
2211bbd6
...
...
@@ -13,14 +13,21 @@ def same_path(p1, p2):
def
test_simple_tree
():
tree
=
filetree
.
FileTree
.
read
(
'eddy'
)
assert
'basename'
not
in
tree
.
variables
assert
'basename'
in
tree
.
variables
same_path
(
tree
.
get
(
'basename'
),
'./eddy_output'
)
same_path
(
tree
.
get
(
'image'
),
'./eddy_output.nii.gz'
)
same_path
(
tree
.
update
(
basename
=
'eddy'
).
get
(
'image'
),
'./eddy.nii.gz'
)
tree
=
filetree
.
FileTree
.
read
(
'eddy.tree'
,
basename
=
'out'
)
assert
'basename'
in
tree
.
variables
same_path
(
tree
.
get
(
'basename'
),
'./out'
)
same_path
(
tree
.
update
(
basename
=
'eddy'
).
get
(
'image'
),
'./eddy.nii.gz'
)
tree
=
filetree
.
FileTree
.
read
(
'eddy.tree'
,
basename
=
'out'
,
partial_fill
=
True
)
assert
'basename'
not
in
tree
.
variables
same_path
(
tree
.
get
(
'basename'
),
'./out'
)
same_path
(
tree
.
update
(
basename
=
'eddy'
).
get
(
'image'
),
'./out.nii.gz'
)
with
pytest
.
raises
(
ValueError
):
filetree
.
FileTree
.
read
(
'non_existing'
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment