Skip to content
This repository was archived by the owner on Apr 20, 2020. It is now read-only.

Commit c1b441c

Browse files
committed
slot.value: Handle case where value is an iterable other than a list.
This fixes the particular issue observed in #76, which involved a "value slot" where the value is a dict. This issue needs to be fixed more generally. See also: ilastik/ilastik#704 and ilastik/ilastik#705
1 parent 302ef7c commit c1b441c

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

lazyflow/slot.py

+9-8
Original file line numberDiff line numberDiff line change
@@ -971,16 +971,17 @@ def value(self):
971971
else:
972972
# _value case
973973
return self._value
974-
if isinstance(temp, numpy.ndarray) and temp.shape != (1,):
974+
if isinstance(temp, numpy.ndarray):
975+
if temp.shape == (1,):
976+
return temp[0]
975977
return temp
978+
elif isinstance(temp, list):
979+
return temp[0]
976980
else:
977-
try:
978-
return temp[0]
979-
except IndexError:
980-
self.logger.warn("FIXME: Slot.value for slot {} is {},"
981-
" which should be wrapped in an ndarray.".format(
982-
self.name, temp))
983-
return temp
981+
self.logger.warn("FIXME: Slot.value for slot {} is {},"
982+
" which should be wrapped in an ndarray.".format(
983+
self.name, temp))
984+
return temp
984985

985986
@is_setup_fn
986987
def setValue(self, value, notify=True, check_changed=True):

0 commit comments

Comments
 (0)