Pipeline.__getitem__ should recursively search when provided with str input.
from padl import transform, identity
@transform
def my_func(x):
return x + 1
@transform
def my_func2(x):
return x + 2
t = my_func >> my_func2 + identity
print(t[1][0].pd_name) # returns `my_func2`
t["my_func2"] # gives error
gives
Traceback (most recent call last):
File "/padl/venv/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3444, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-2-2ec20bbacb50>", line 12, in <module>
t["my_func2"]
File "/padl/padl/transforms.py", line 1589, in __getitem__
raise ValueError(f"{item}: Transform with pd_name '{item}' not found")
ValueError: my_func2: Transform with pd_name 'my_func2' not found
Expected behavior
t["my_func2"] should return the transform with that name.
🐞 Bug
Pipeline.__getitem__
should recursively search when provided with str input.gives
Expected behavior
t["my_func2"]
should return the transform with that name.Environment/System