Skip to content

Commit 7806ce8

Browse files
committed
FIX: Pass arguments through tag decorator
1 parent c55c945 commit 7806ce8

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

niworkflows/engine/splicer.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import logging
44
import typing as ty
5+
from functools import wraps
56

67
import nipype.pipeline.engine as pe
78
from nipype.pipeline.engine.base import EngineBase
@@ -14,8 +15,9 @@ def tag(tag: str) -> ty.Callable:
1415
This is used to mark nodes or workflows for replacement in the splicing process.
1516
"""
1617

17-
def _decorator(func, *args, **kwargs) -> ty.Callable:
18-
def _tag() -> EngineBase:
18+
def _decorator(func) -> ty.Callable:
19+
@wraps(func)
20+
def _tag(*args, **kwargs) -> EngineBase:
1921
node = func(*args, **kwargs)
2022
node._tag = tag
2123
return node

niworkflows/engine/tests/test_splicer.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,8 @@ def test_splice(wf0):
157157

158158
def test_tag():
159159
@tag('foo')
160-
def init_workflow():
160+
def init_workflow(*, xarg: str):
161161
return Workflow(name='foo')
162162

163-
assert init_workflow()._tag == 'foo'
163+
wf = init_workflow(xarg='bar')
164+
assert wf._tag == 'foo'

0 commit comments

Comments
 (0)