Skip to content

Commit 9473758

Browse files
committed
FIX: Allow staticmethod be passed to callable metadata in ouput spec
1 parent 374cdec commit 9473758

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

pydra/engine/specs.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,12 @@ def _field_metadata(
593593
return attr.NOTHING
594594
return val
595595
elif "callable" in fld.metadata:
596-
call_args = inspect.getfullargspec(fld.metadata["callable"])
596+
callable_ = fld.metadata["callable"]
597+
if isinstance(callable_, staticmethod):
598+
# In case callable is defined as a static method,
599+
# retrieve the function wrapped in the descriptor.
600+
callable_ = callable_.__func__
601+
call_args = inspect.getfullargspec(callable_)
597602
call_args_val = {}
598603
for argnm in call_args.args:
599604
if argnm == "field":
@@ -615,7 +620,7 @@ def _field_metadata(
615620
f"has to be in inputs or be field or output_dir, "
616621
f"but {argnm} is used"
617622
)
618-
return fld.metadata["callable"](**call_args_val)
623+
return callable_(**call_args_val)
619624
else:
620625
raise Exception("(_field_metadata) is not a current valid metadata key.")
621626

0 commit comments

Comments
 (0)