Skip to content

Commit 65a5e68

Browse files
committed
touched up doc strings to refer to un/structure instead of un/serialize
1 parent 3cb79e2 commit 65a5e68

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

docs/source/tutorial/7-canonical-form.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@
242242
"cell_type": "markdown",
243243
"metadata": {},
244244
"source": [
245-
"## Serialization\n",
245+
"## Converting to/from dictionaries\n",
246246
"\n",
247247
"As well as the dataclass-like canonical form, it is also possible to represent all tasks\n",
248248
"in a nested dictionary form, which could be written to a static file (e.g. in JSON or\n",

pydra/utils/general.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,8 @@ def full_val_serializer(
686686

687687

688688
def structure(task_class_dict: dict[str, ty.Any]) -> type["Task"]:
689-
"""Unserializes a task definition from a dictionary created by `unstructure`
689+
"""Converts a dictionary representation created by `unstructure` into a Pydra task
690+
class.
690691
691692
Parameters
692693
----------

pydra/utils/tests/test_general.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from pydra.utils.tests.utils import Concatenate
1313

1414

15-
def check_dict_fully_serialized(dct: dict):
15+
def check_dict_fully_unstructured(dct: dict):
1616
"""Checks if there are any Pydra objects or non list/dict containers in the dict."""
1717
stack = [dct]
1818
while stack:
@@ -55,7 +55,7 @@ def test_python_unstructure(tmp_path):
5555

5656
dct = unstructure(Add)
5757
assert isinstance(dct, dict)
58-
check_dict_fully_serialized(dct)
58+
check_dict_fully_unstructured(dct)
5959
Reloaded = structure(dct)
6060
assert get_fields(Add) == get_fields(Reloaded)
6161

@@ -70,7 +70,7 @@ def test_shell_unstructure():
7070

7171
dct = unstructure(MyCmd)
7272
assert isinstance(dct, dict)
73-
check_dict_fully_serialized(dct)
73+
check_dict_fully_unstructured(dct)
7474
Reloaded = structure(dct)
7575
assert get_fields(MyCmd) == get_fields(Reloaded)
7676

@@ -86,7 +86,7 @@ def AWorkflow(in_file: TextFile, a_param: int) -> TextFile:
8686

8787
dct = unstructure(AWorkflow)
8888
assert isinstance(dct, dict)
89-
check_dict_fully_serialized(dct)
89+
check_dict_fully_unstructured(dct)
9090
Reloaded = structure(dct)
9191
assert get_fields(AWorkflow) == get_fields(Reloaded)
9292

@@ -123,7 +123,7 @@ def type_to_str_serializer(
123123

124124
dct = unstructure(Identity, value_serializer=type_to_str_serializer)
125125
assert isinstance(dct, dict)
126-
check_dict_fully_serialized(dct)
126+
check_dict_fully_unstructured(dct)
127127
assert dct["inputs"] == {"a": {"type": "builtins.int", "help": "the arg"}}
128128

129129

@@ -151,5 +151,5 @@ def no_helps_filter(atr: attrs.Attribute, value: ty.Any) -> bool:
151151

152152
dct = unstructure(Identity, filter=no_helps_filter)
153153
assert isinstance(dct, dict)
154-
check_dict_fully_serialized(dct)
154+
check_dict_fully_unstructured(dct)
155155
assert dct["inputs"] == {"a": {"type": int}}

0 commit comments

Comments
 (0)