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
Model registry
Operate
Environments
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
FSL
fslpy
Commits
14cac1be
Commit
14cac1be
authored
9 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
Fixes to typedict enhancements - was not combining return
values when performing recursive class hierarchy search.
parent
b309db9c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fsl/utils/typedict.py
+15
-7
15 additions, 7 deletions
fsl/utils/typedict.py
with
15 additions
and
7 deletions
fsl/utils/typedict.py
+
15
−
7
View file @
14cac1be
...
@@ -125,8 +125,9 @@ class TypeDict(object):
...
@@ -125,8 +125,9 @@ class TypeDict(object):
# Otherwise, accumulate the value, and keep
# Otherwise, accumulate the value, and keep
# searching
# searching
else
:
else
:
keys
.
append
(
lKey
)
hits
.
append
(
val
)
hits
.
append
(
val
)
if
bykey
:
keys
.
append
(
lKey
)
# No more base classes to search for - there
# No more base classes to search for - there
# really is no value associated with this key
# really is no value associated with this key
...
@@ -144,18 +145,25 @@ class TypeDict(object):
...
@@ -144,18 +145,25 @@ class TypeDict(object):
for
elemBase
in
elemBases
:
for
elemBase
in
elemBases
:
newKey
=
list
(
key
)
newKey
=
list
(
key
)
newKey
[
i
]
=
elemBase
.
__name__
newKey
[
i
]
=
elemBase
if
len
(
newKey
)
==
1
:
newKey
=
newKey
[
0
]
if
len
(
newKey
)
==
1
:
newKey
=
newKey
[
0
]
else
:
newKey
=
tuple
(
newKey
)
else
:
newKey
=
tuple
(
newKey
)
try
:
val
=
self
.
__getitem__
(
newKey
)
try
:
except
KeyError
:
continue
newVal
=
self
.
__getitem__
(
newKey
,
allhits
,
bykey
)
except
KeyError
:
continue
if
not
allhits
:
return
val
if
not
allhits
:
return
newVal
else
:
else
:
keys
.
append
(
newKey
)
if
bykey
:
hits
.
append
(
val
)
newKeys
,
newVals
=
zip
(
*
newVal
.
items
())
keys
.
extend
(
newKeys
)
hits
.
extend
(
newVals
)
else
:
hits
.
extend
(
newVal
)
# No value for any base classes either
# No value for any base classes either
if
len
(
hits
)
==
0
:
if
len
(
hits
)
==
0
:
...
...
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