experimaestro 1.8.3__py3-none-any.whl → 1.8.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of experimaestro might be problematic. Click here for more details.
- experimaestro/core/objects/config.py +6 -0
- experimaestro/core/objects/config_walk.py +3 -0
- experimaestro/tests/test_identifier.py +9 -0
- experimaestro/tests/test_param.py +20 -0
- experimaestro/tests/test_serializers.py +21 -2
- {experimaestro-1.8.3.dist-info → experimaestro-1.8.5.dist-info}/METADATA +1 -1
- {experimaestro-1.8.3.dist-info → experimaestro-1.8.5.dist-info}/RECORD +10 -10
- {experimaestro-1.8.3.dist-info → experimaestro-1.8.5.dist-info}/LICENSE +0 -0
- {experimaestro-1.8.3.dist-info → experimaestro-1.8.5.dist-info}/WHEEL +0 -0
- {experimaestro-1.8.3.dist-info → experimaestro-1.8.5.dist-info}/entry_points.txt +0 -0
|
@@ -339,6 +339,9 @@ class ConfigInformation:
|
|
|
339
339
|
try:
|
|
340
340
|
if argument.generator:
|
|
341
341
|
if not isinstance(argument.generator, Generator):
|
|
342
|
+
# Don't set if already set
|
|
343
|
+
if config.__xpm__.values.get(k) is not None:
|
|
344
|
+
continue
|
|
342
345
|
value = argument.generator()
|
|
343
346
|
else:
|
|
344
347
|
sig = inspect.signature(argument.generator)
|
|
@@ -800,6 +803,9 @@ class ConfigInformation:
|
|
|
800
803
|
def __collect_objects__(value, objects: List[Dict], context: SerializationContext):
|
|
801
804
|
"""Serialize all needed configuration objects, looking at sub
|
|
802
805
|
configurations if necessary"""
|
|
806
|
+
if value is None:
|
|
807
|
+
return
|
|
808
|
+
|
|
803
809
|
if isinstance(value, Config):
|
|
804
810
|
value.__xpm__.__get_objects__(objects, context)
|
|
805
811
|
elif isinstance(value, (list, tuple)):
|
|
@@ -38,6 +38,11 @@ class C(Config):
|
|
|
38
38
|
b: Param[int]
|
|
39
39
|
|
|
40
40
|
|
|
41
|
+
class CField(Config):
|
|
42
|
+
a: Param[int] = field(default_factory=lambda: 1)
|
|
43
|
+
b: Param[int]
|
|
44
|
+
|
|
45
|
+
|
|
41
46
|
class D(Config):
|
|
42
47
|
a: Param[A]
|
|
43
48
|
|
|
@@ -79,6 +84,10 @@ def test_param_default():
|
|
|
79
84
|
assert_equal(C(a=1, b=2), C(b=2))
|
|
80
85
|
|
|
81
86
|
|
|
87
|
+
def test_identifier_default_field():
|
|
88
|
+
assert_equal(CField(a=1, b=2), CField(b=2))
|
|
89
|
+
|
|
90
|
+
|
|
82
91
|
def test_param_inner_eq():
|
|
83
92
|
assert_equal(D(a=A(a=1)), D(a=A(a=1)))
|
|
84
93
|
|
|
@@ -290,6 +290,26 @@ def test_default_mismatch():
|
|
|
290
290
|
A.__getxpmtype__().getArgument("x")
|
|
291
291
|
|
|
292
292
|
|
|
293
|
+
# --- Handling default with field
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
def test_param_default_set():
|
|
297
|
+
"""Test that the default setting is well set"""
|
|
298
|
+
|
|
299
|
+
class A0(Config):
|
|
300
|
+
x: Param[int] = 2
|
|
301
|
+
|
|
302
|
+
assert A0().instance().x == 2
|
|
303
|
+
assert A0(x=3).instance().x == 3
|
|
304
|
+
|
|
305
|
+
class A(Config):
|
|
306
|
+
x: Param[int] = field(default_factory=lambda: 2)
|
|
307
|
+
|
|
308
|
+
assert A().instance().x == 2
|
|
309
|
+
|
|
310
|
+
assert A(x=3).instance().x == 3
|
|
311
|
+
|
|
312
|
+
|
|
293
313
|
# --- Handling help annotations
|
|
294
314
|
|
|
295
315
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from typing import Optional
|
|
1
2
|
from experimaestro import (
|
|
2
3
|
Config,
|
|
3
4
|
Task,
|
|
@@ -78,8 +79,8 @@ class Object2(Config):
|
|
|
78
79
|
def test_serializers_serialization():
|
|
79
80
|
context = SerializationContext(save_directory=None)
|
|
80
81
|
|
|
81
|
-
obj1 = Object1()
|
|
82
|
-
obj2 = Object2(object=obj1)
|
|
82
|
+
obj1 = Object1.C()
|
|
83
|
+
obj2 = Object2.C(object=obj1)
|
|
83
84
|
|
|
84
85
|
data = state_dict(context, [obj1, obj2])
|
|
85
86
|
|
|
@@ -92,3 +93,21 @@ def test_serializers_serialization():
|
|
|
92
93
|
assert isinstance(obj1, Object1) and not isinstance(obj1, ConfigMixin)
|
|
93
94
|
assert isinstance(obj2, Object2)
|
|
94
95
|
assert obj2.object is obj1
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
class SubConfig(Config):
|
|
99
|
+
pass
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
class MultiParamObject(Config):
|
|
103
|
+
opt_a: Param[Optional[int]]
|
|
104
|
+
|
|
105
|
+
x: Param[dict[str, Optional[SubConfig]]]
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def test_serializers_types():
|
|
109
|
+
context = SerializationContext(save_directory=None)
|
|
110
|
+
|
|
111
|
+
config = MultiParamObject.C(x={"a": None})
|
|
112
|
+
config.__xpm__.seal(context)
|
|
113
|
+
state_dict(context, config)
|
|
@@ -17,9 +17,9 @@ experimaestro/core/callbacks.py,sha256=59JfeUgWcCCdIQ3pvh-xNnoRp9BX8f4iOAkgm16wB
|
|
|
17
17
|
experimaestro/core/context.py,sha256=41jvgudz4sgMDWrqOhPbgFRJHa3klWKvS3l_L661er0,2600
|
|
18
18
|
experimaestro/core/identifier.py,sha256=JadBAdW2fOIgoTyMRtKI_RY9SXQP2B1vq1rUcV465Hs,10214
|
|
19
19
|
experimaestro/core/objects/__init__.py,sha256=ucJY5e17QQ1Kc-GYXeL7g8GFj8rP0XB4g2vrl32uhxY,721
|
|
20
|
-
experimaestro/core/objects/config.py,sha256=
|
|
20
|
+
experimaestro/core/objects/config.py,sha256=qOUgCmX1NwhRhpTVxgr2sSAqBCMYloUXb5f-NiXgV8Q,56989
|
|
21
21
|
experimaestro/core/objects/config_utils.py,sha256=ZLECGkeIWdzunm8vwWsQhvcSgV1e064BgXbLiZnxSEM,1288
|
|
22
|
-
experimaestro/core/objects/config_walk.py,sha256=
|
|
22
|
+
experimaestro/core/objects/config_walk.py,sha256=gyDMrVPbBMChn7r4em_gQXuqnxASO_JVauEbnJNO8II,4245
|
|
23
23
|
experimaestro/core/objects.pyi,sha256=xvlsRj4u1xsJxbevJl5Ner_HwmxR8x1JlAeIVDJzuy0,6498
|
|
24
24
|
experimaestro/core/serialization.py,sha256=TLMTfU627bs9_1gyY2O5tX_xy1GhePIzleXwi27ffz0,5683
|
|
25
25
|
experimaestro/core/serializers.py,sha256=R_CAMyjjfU1oi-eHU6VlEUixJpFayGqEPaYu7VsD9xA,1197
|
|
@@ -121,13 +121,13 @@ experimaestro/tests/test_dependencies.py,sha256=xfWrSkvjT45G4FSCL535m1huLT2ghmyW
|
|
|
121
121
|
experimaestro/tests/test_experiment.py,sha256=QWF9aHewL9hepagrKKFyfikKn3iiZ_lRRXl1LLttta0,1687
|
|
122
122
|
experimaestro/tests/test_findlauncher.py,sha256=8tjpR8bLMi6Gjs7KpY2t64izZso6bmY7vIivMflm-Bc,2965
|
|
123
123
|
experimaestro/tests/test_forward.py,sha256=9y1zYm7hT_Lx5citxnK7n20cMZ2WJbsaEeY5irCZ9U4,735
|
|
124
|
-
experimaestro/tests/test_identifier.py,sha256=
|
|
124
|
+
experimaestro/tests/test_identifier.py,sha256=zgfpz5UumQftQTHhdw3nmr044Xd7Ntrh7e2hIAoS_PA,13862
|
|
125
125
|
experimaestro/tests/test_instance.py,sha256=h-8UeoOlNsD-STWq5jbhmxw35CyiwJxtKAaUGmLPgB8,1521
|
|
126
126
|
experimaestro/tests/test_objects.py,sha256=zycxjvWuJAbPR8-q2T3zuBY9xfmlhf1YvtOcrImHxnc,2431
|
|
127
127
|
experimaestro/tests/test_outputs.py,sha256=DYzPk5TT_yLumy8SsQbl-S66ivVxJ-ERFrZ68KQZ4KU,781
|
|
128
|
-
experimaestro/tests/test_param.py,sha256=
|
|
128
|
+
experimaestro/tests/test_param.py,sha256=7BltCUm9uhtEupJZ-QSaj7MxuXoUl73NjE8NfzJD5BA,7290
|
|
129
129
|
experimaestro/tests/test_progress.py,sha256=wtIGQzlV3ldd_wMng11LinVESchW-1J954mCJNlG28E,7580
|
|
130
|
-
experimaestro/tests/test_serializers.py,sha256=
|
|
130
|
+
experimaestro/tests/test_serializers.py,sha256=u3A5JbusN8aW6x6reUIwpU1Fs-avnzTRU7WuTear9Qs,2722
|
|
131
131
|
experimaestro/tests/test_snippets.py,sha256=rojnyDjtmAMnSuDUj6Bv9XEgdP8oQf2nVc132JF8vsM,3081
|
|
132
132
|
experimaestro/tests/test_ssh.py,sha256=KS1NWltiXrJBSStY9d4mwrexeqgNGWmhxuAU_WLQDAU,1449
|
|
133
133
|
experimaestro/tests/test_tags.py,sha256=v_8_7LuEHfY_gfa0JRCUkmgJh8h6RMya_nd5NcPAJPw,2852
|
|
@@ -150,8 +150,8 @@ experimaestro/utils/jupyter.py,sha256=JcEo2yQK7x3Cr1tNl5FqGMZOICxCv9DwMvL5xsWdQP
|
|
|
150
150
|
experimaestro/utils/resources.py,sha256=j-nvsTFwmgENMoVGOD2Ap-UD3WU85WkI0IgeSszMCX4,1328
|
|
151
151
|
experimaestro/utils/settings.py,sha256=jpFMqF0DLL4_P1xGal0zVR5cOrdD8O0Y2IOYvnRgN3k,793
|
|
152
152
|
experimaestro/xpmutils.py,sha256=S21eMbDYsHfvmZ1HmKpq5Pz5O-1HnCLYxKbyTBbASyQ,638
|
|
153
|
-
experimaestro-1.8.
|
|
154
|
-
experimaestro-1.8.
|
|
155
|
-
experimaestro-1.8.
|
|
156
|
-
experimaestro-1.8.
|
|
157
|
-
experimaestro-1.8.
|
|
153
|
+
experimaestro-1.8.5.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
154
|
+
experimaestro-1.8.5.dist-info/METADATA,sha256=0qVBZsnk31ZTq0hrOn9yOW7xTggTuTzqX5j5uZaQ3zA,6170
|
|
155
|
+
experimaestro-1.8.5.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
156
|
+
experimaestro-1.8.5.dist-info/entry_points.txt,sha256=TppTNiz5qm5xm1fhAcdLKdCLMrlL-eQggtCrCI00D9c,446
|
|
157
|
+
experimaestro-1.8.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|