Commit df910a75 authored by theos's avatar theos
Browse files

Fixed the _infer_dtype function such that it identifies a list of slices correctly.

parent 20a124d4
Pipeline #3166 skipped
...@@ -255,12 +255,11 @@ def _infer_key_type(key): ...@@ -255,12 +255,11 @@ def _infer_key_type(key):
return (None, None) return (None, None)
found_boolean = False found_boolean = False
# Check which case we got: # 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 # Check if there is something different in the array than
# scalars and slices # scalars and slices
if isinstance(key, slice) or np.isscalar(key):
key = [key]
scalarQ = np.array(map(np.isscalar, key)) scalarQ = np.array(map(np.isscalar, key))
sliceQ = np.array(map(lambda z: isinstance(z, slice), key)) sliceQ = np.array(map(lambda z: isinstance(z, slice), key))
if np.all(scalarQ + sliceQ): if np.all(scalarQ + sliceQ):
...@@ -273,8 +272,6 @@ def _infer_key_type(key): ...@@ -273,8 +272,6 @@ def _infer_key_type(key):
elif isinstance(key, distributed_data_object): elif isinstance(key, distributed_data_object):
found = 'd2o' found = 'd2o'
found_boolean = (key.dtype == np.bool_) found_boolean = (key.dtype == np.bool_)
elif isinstance(key, list):
found = 'indexinglist'
else: else:
raise ValueError(about._errors.cstring("ERROR: Unknown keytype!")) raise ValueError(about._errors.cstring("ERROR: Unknown keytype!"))
return (found, found_boolean) return (found, found_boolean)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment