Skip to content

Commit e1eae66

Browse files
committed
updated print_help
1 parent bc4b373 commit e1eae66

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

pydra/engine/helpers.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,24 +78,26 @@ def from_list_if_single(obj: ty.Any) -> ty.Any:
7878
return obj
7979

8080

81-
def print_help(obj):
81+
def print_help(defn: "TaskDef[DefType]") -> list[str]:
8282
"""Visit a task object and print its input/output interface."""
83-
lines = [f"Help for {obj.__class__.__name__}"]
84-
if attrs.fields(obj.interface):
83+
from pydra.design.base import EMPTY
84+
85+
lines = [f"Help for {defn.__class__.__name__}"]
86+
if list_fields(defn):
8587
lines += ["Input Parameters:"]
86-
for f in attrs.fields(obj.interface):
88+
for f in list_fields(defn):
8789
default = ""
88-
if f.default != attrs.NOTHING and not f.name.startswith("_"):
90+
if f.default is not EMPTY and not f.name.startswith("_"):
8991
default = f" (default: {f.default})"
9092
try:
9193
name = f.type.__name__
9294
except AttributeError:
9395
name = str(f.type)
9496
lines += [f"- {f.name}: {name}{default}"]
95-
output_klass = obj.interface.Outputs
96-
if attrs.fields(output_klass):
97+
output_klass = defn.Outputs
98+
if list_fields(output_klass):
9799
lines += ["Output Parameters:"]
98-
for f in attrs.fields(output_klass):
100+
for f in list_fields(output_klass):
99101
try:
100102
name = f.type.__name__
101103
except AttributeError:

0 commit comments

Comments
 (0)