Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Neel Shah
NIFTy
Commits
df910a75
Commit
df910a75
authored
May 17, 2016
by
theos
Browse files
Fixed the _infer_dtype function such that it identifies a list of slices correctly.
parent
20a124d4
Changes
1
Hide whitespace changes
Inline
Side-by-side
d2o/distributor_factory.py
View file @
df910a75
...
...
@@ -255,12 +255,11 @@ def _infer_key_type(key):
return
(
None
,
None
)
found_boolean
=
False
# Check which case we got:
if
isinstance
(
key
,
tuple
)
or
isinstance
(
key
,
slice
)
or
np
.
isscalar
(
key
):
if
isinstance
(
key
,
slice
)
or
np
.
isscalar
(
key
):
found
=
'slicetuple'
elif
isinstance
(
key
,
tuple
)
or
isinstance
(
key
,
list
):
# Check if there is something different in the array than
# scalars and slices
if
isinstance
(
key
,
slice
)
or
np
.
isscalar
(
key
):
key
=
[
key
]
scalarQ
=
np
.
array
(
map
(
np
.
isscalar
,
key
))
sliceQ
=
np
.
array
(
map
(
lambda
z
:
isinstance
(
z
,
slice
),
key
))
if
np
.
all
(
scalarQ
+
sliceQ
):
...
...
@@ -273,8 +272,6 @@ def _infer_key_type(key):
elif
isinstance
(
key
,
distributed_data_object
):
found
=
'd2o'
found_boolean
=
(
key
.
dtype
==
np
.
bool_
)
elif
isinstance
(
key
,
list
):
found
=
'indexinglist'
else
:
raise
ValueError
(
about
.
_errors
.
cstring
(
"ERROR: Unknown keytype!"
))
return
(
found
,
found_boolean
)
...
...
Write
Preview
Markdown
is supported
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