Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pycalibration
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Analyze
Contributor 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
calibration
pycalibration
Commits
91bf4fa4
Commit
91bf4fa4
authored
3 years ago
by
Thomas Kluyver
Browse files
Options
Downloads
Patches
Plain Diff
Fix converting list of paths to nested dicts
parent
6f4b561b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!527
HDF5 copy except function
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/cal_tools/h5_copy_except.py
+2
-1
2 additions, 1 deletion
src/cal_tools/h5_copy_except.py
with
2 additions
and
1 deletion
src/cal_tools/h5_copy_except.py
+
2
−
1
View file @
91bf4fa4
...
...
@@ -2,9 +2,10 @@ import h5py
def
paths_to_tree
(
paths
):
"""
Convert paths to a nested-dict tree, with True at leaves
"""
tree
=
tree_part
=
{}
tree
=
{}
for
path
in
paths
:
tree_part
=
tree
path_names
=
path
.
strip
(
'
/
'
).
split
(
'
/
'
)
for
name
in
path_names
[:
-
1
]:
tree_part
=
tree_part
.
setdefault
(
name
,
{})
...
...
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