|
25 | 25 | "\n", |
26 | 26 | "# Note that we use PascalCase because the object returned by the decorator is actually a class\n", |
27 | 27 | "@python.define\n", |
28 | | - "def MyFirstTaskDef(a, b):\n", |
| 28 | + "def MyFirstTask(a, b):\n", |
29 | 29 | " \"\"\"Sample function for testing\"\"\"\n", |
30 | 30 | " return a + b" |
31 | 31 | ] |
|
45 | 45 | "outputs": [], |
46 | 46 | "source": [ |
47 | 47 | "# Instantiate the task, setting all parameters\n", |
48 | | - "my_first_task = MyFirstTaskDef(a=1, b=2.0)\n", |
| 48 | + "my_first_task = MyFirstTask(a=1, b=2.0)\n", |
49 | 49 | "\n", |
50 | 50 | "# Execute the task\n", |
51 | 51 | "outputs = my_first_task()\n", |
|
69 | 69 | "outputs": [], |
70 | 70 | "source": [ |
71 | 71 | "@python.define(outputs=[\"c\", \"d\"])\n", |
72 | | - "def NamedOutputTaskDef(a, b):\n", |
| 72 | + "def NamedOutputTask(a, b):\n", |
73 | 73 | " \"\"\"Sample function for testing\"\"\"\n", |
74 | 74 | " return a + b, a - b\n", |
75 | 75 | "\n", |
76 | 76 | "\n", |
77 | | - "named_output_task = NamedOutputTaskDef(a=2, b=1)\n", |
| 77 | + "named_output_task = NamedOutputTask(a=2, b=1)\n", |
78 | 78 | "\n", |
79 | 79 | "outputs = named_output_task()\n", |
80 | 80 | "\n", |
|
102 | 102 | " \"d\": python.out(type=float, help=\"the difference of the inputs\"),\n", |
103 | 103 | " },\n", |
104 | 104 | ")\n", |
105 | | - "def AugmentedTaskDef(a, b):\n", |
| 105 | + "def AugmentedTask(a, b):\n", |
106 | 106 | " \"\"\"Sample function for testing\"\"\"\n", |
107 | 107 | " return a + b, a - b" |
108 | 108 | ] |
|
163 | 163 | "metadata": {}, |
164 | 164 | "outputs": [], |
165 | 165 | "source": [ |
166 | | - "from pprint import pprint\n", |
167 | | - "from pydra.utils import fields_dict\n", |
| 166 | + "from pydra.utils import task_help\n", |
168 | 167 | "\n", |
169 | 168 | "\n", |
170 | 169 | "@python.define(outputs=[\"c\", \"d\"])\n", |
171 | | - "def DocStrDef(a: int, b: float) -> tuple[float, float]:\n", |
172 | | - " \"\"\"Sample function for testing\n", |
| 170 | + "def DocStrExample(a: int, b: float) -> tuple[float, float]:\n", |
| 171 | + " \"\"\"Example python task with help strings pulled from doc-string\n", |
173 | 172 | "\n", |
174 | 173 | " Args:\n", |
175 | 174 | " a: First input\n", |
|
183 | 182 | " return a + b, a * b\n", |
184 | 183 | "\n", |
185 | 184 | "\n", |
186 | | - "pprint(fields_dict(DocStrDef))\n", |
187 | | - "pprint(fields_dict(DocStrDef.Outputs))" |
| 185 | + "task_help(DocStrExample)" |
188 | 186 | ] |
189 | 187 | }, |
190 | 188 | { |
|
0 commit comments