haesleinhuepf / napari-workflows

BSD 3-Clause "New" or "Revised" License
12 stars 10 forks source link

`Workflow.roots()` bug with non-function task #41

Open multimeric opened 1 month ago

multimeric commented 1 month ago

Here is an example:

from napari_workflows import Workflow

w = Workflow()
w.set("x", 10)
w.roots()
Traceback (most recent call last):
  File "/Users/milton.m/Programming/workflows_bug.py", line 5, in <module>
    w.roots()
  File "/opt/anaconda3/envs/napari2/lib/python3.10/site-packages/napari_workflows/_workflow.py", line 112, in roots
    keys_with_functions = [key for key, task in self._tasks.items() if callable(task[0])]
  File "/opt/anaconda3/envs/napari2/lib/python3.10/site-packages/napari_workflows/_workflow.py", line 112, in <listcomp>
    keys_with_functions = [key for key, task in self._tasks.items() if callable(task[0])]
TypeError: 'int' object is not subscriptable

Using napari-workflows==0.2.9.

Should be an easy fix.

multimeric commented 4 weeks ago

Actually this happens in a few other places too, including .followers_of() and therefore .leafs().

haesleinhuepf commented 4 weeks ago

Hi @multimeric ,

good catch! This should be easily fixable, indeed.

Best, Robert