Skip to content

Commit e24381a

Browse files
committed
saving experiment settings
1 parent c370493 commit e24381a

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/negmas/serialization.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from pathlib import Path
1010
from typing import Any, Callable, Iterable
1111
import sys
12+
from attr import has, asdict
1213

1314
import cloudpickle
1415
import numpy as np
@@ -196,6 +197,20 @@ def convertwith(value, method, pass_identifier=False):
196197
else:
197198
return adjust_dict(converted)
198199

200+
if has(type(value)):
201+
converted = asdict(value, recurse=deep)
202+
if converted is not None:
203+
return serialize(
204+
converted,
205+
deep=deep,
206+
add_type_field=add_type_field,
207+
keep_private=keep_private,
208+
ignore_methods=ignore_methods,
209+
ignore_lambda=ignore_lambda,
210+
shorten_type_field=shorten_type_field,
211+
objmem=objmem,
212+
python_class_identifier=python_class_identifier,
213+
)
199214
for method in ("to_dict", "asdict", "dict"):
200215
try:
201216
converted = convertwith(value, method, pass_identifier=True)

0 commit comments

Comments
 (0)