flwr-nightly 1.17.0.dev20250319__py3-none-any.whl → 1.17.0.dev20250320__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.
- flwr/client/app.py +6 -4
- flwr/client/clientapp/app.py +2 -2
- flwr/client/grpc_client/connection.py +23 -20
- flwr/client/message_handler/message_handler.py +27 -27
- flwr/client/mod/centraldp_mods.py +7 -7
- flwr/client/mod/localdp_mod.py +4 -4
- flwr/client/mod/secure_aggregation/secaggplus_mod.py +5 -5
- flwr/client/run_info_store.py +2 -2
- flwr/common/__init__.py +2 -0
- flwr/common/context.py +4 -4
- flwr/common/message.py +269 -101
- flwr/common/record/__init__.py +2 -1
- flwr/common/record/configsrecord.py +2 -2
- flwr/common/record/metricsrecord.py +1 -1
- flwr/common/record/parametersrecord.py +1 -1
- flwr/common/record/{recordset.py → recorddict.py} +57 -17
- flwr/common/{recordset_compat.py → recorddict_compat.py} +105 -105
- flwr/common/serde.py +33 -37
- flwr/proto/exec_pb2.py +32 -32
- flwr/proto/exec_pb2.pyi +3 -3
- flwr/proto/message_pb2.py +12 -12
- flwr/proto/message_pb2.pyi +9 -9
- flwr/proto/recorddict_pb2.py +70 -0
- flwr/proto/{recordset_pb2.pyi → recorddict_pb2.pyi} +2 -2
- flwr/proto/run_pb2.py +32 -32
- flwr/proto/run_pb2.pyi +3 -3
- flwr/server/compat/grid_client_proxy.py +30 -30
- flwr/server/grid/grid.py +3 -3
- flwr/server/grid/grpc_grid.py +15 -23
- flwr/server/grid/inmemory_grid.py +14 -20
- flwr/server/superlink/fleet/vce/vce_api.py +1 -3
- flwr/server/superlink/linkstate/in_memory_linkstate.py +1 -1
- flwr/server/superlink/linkstate/sqlite_linkstate.py +14 -18
- flwr/server/superlink/linkstate/utils.py +10 -7
- flwr/server/superlink/serverappio/serverappio_servicer.py +1 -1
- flwr/server/utils/validator.py +4 -4
- flwr/server/workflow/default_workflows.py +7 -7
- flwr/server/workflow/secure_aggregation/secaggplus_workflow.py +8 -8
- flwr/simulation/ray_transport/ray_client_proxy.py +34 -32
- flwr/simulation/run_simulation.py +3 -3
- flwr/superexec/deployment.py +2 -2
- flwr/superexec/simulation.py +2 -2
- {flwr_nightly-1.17.0.dev20250319.dist-info → flwr_nightly-1.17.0.dev20250320.dist-info}/METADATA +1 -1
- {flwr_nightly-1.17.0.dev20250319.dist-info → flwr_nightly-1.17.0.dev20250320.dist-info}/RECORD +49 -49
- flwr/proto/recordset_pb2.py +0 -70
- /flwr/proto/{recordset_pb2_grpc.py → recorddict_pb2_grpc.py} +0 -0
- /flwr/proto/{recordset_pb2_grpc.pyi → recorddict_pb2_grpc.pyi} +0 -0
- {flwr_nightly-1.17.0.dev20250319.dist-info → flwr_nightly-1.17.0.dev20250320.dist-info}/LICENSE +0 -0
- {flwr_nightly-1.17.0.dev20250319.dist-info → flwr_nightly-1.17.0.dev20250320.dist-info}/WHEEL +0 -0
- {flwr_nightly-1.17.0.dev20250319.dist-info → flwr_nightly-1.17.0.dev20250320.dist-info}/entry_points.txt +0 -0
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright
|
1
|
+
# Copyright 2025 Flower Labs GmbH. All Rights Reserved.
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -12,7 +12,7 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
# ==============================================================================
|
15
|
-
"""
|
15
|
+
"""RecordDict."""
|
16
16
|
|
17
17
|
|
18
18
|
from __future__ import annotations
|
@@ -50,29 +50,29 @@ def _check_value(value: RecordType) -> None:
|
|
50
50
|
|
51
51
|
|
52
52
|
class _SyncedDict(TypedDict[str, T]):
|
53
|
-
"""A synchronized dictionary that mirrors changes to an underlying
|
53
|
+
"""A synchronized dictionary that mirrors changes to an underlying RecordDict.
|
54
54
|
|
55
55
|
This dictionary ensures that any modifications (set or delete operations)
|
56
|
-
are automatically reflected in the associated `
|
56
|
+
are automatically reflected in the associated `RecordDict`. Only values of
|
57
57
|
the specified `allowed_type` are permitted.
|
58
58
|
"""
|
59
59
|
|
60
|
-
def __init__(self,
|
60
|
+
def __init__(self, ref_recorddict: RecordDict, allowed_type: type[T]) -> None:
|
61
61
|
if not issubclass(
|
62
62
|
allowed_type, (ParametersRecord, MetricsRecord, ConfigsRecord)
|
63
63
|
):
|
64
64
|
raise TypeError(f"{allowed_type} is not a valid type.")
|
65
65
|
super().__init__(_check_key, self.check_value)
|
66
|
-
self.
|
66
|
+
self.recorddict = ref_recorddict
|
67
67
|
self.allowed_type = allowed_type
|
68
68
|
|
69
69
|
def __setitem__(self, key: str, value: T) -> None:
|
70
70
|
super().__setitem__(key, value)
|
71
|
-
self.
|
71
|
+
self.recorddict[key] = cast(RecordType, value)
|
72
72
|
|
73
73
|
def __delitem__(self, key: str) -> None:
|
74
74
|
super().__delitem__(key)
|
75
|
-
del self.
|
75
|
+
del self.recorddict[key]
|
76
76
|
|
77
77
|
def check_value(self, value: T) -> None:
|
78
78
|
"""Check if value is of expected type."""
|
@@ -83,10 +83,10 @@ class _SyncedDict(TypedDict[str, T]):
|
|
83
83
|
)
|
84
84
|
|
85
85
|
|
86
|
-
class
|
87
|
-
"""
|
86
|
+
class RecordDict(TypedDict[str, RecordType]):
|
87
|
+
"""RecordDict stores groups of parameters, metrics and configs.
|
88
88
|
|
89
|
-
A :class:`
|
89
|
+
A :class:`RecordDict` is the unified mechanism by which parameters,
|
90
90
|
metrics and configs can be either stored as part of a :class:`Context`
|
91
91
|
in your apps or communicated as part of a :class:`Message` between
|
92
92
|
your apps.
|
@@ -108,28 +108,28 @@ class RecordSet(TypedDict[str, RecordType]):
|
|
108
108
|
|
109
109
|
Examples
|
110
110
|
--------
|
111
|
-
A :
|
111
|
+
A :class:`RecordDict` can hold three types of records, each designed
|
112
112
|
with an specific purpose. What is common to all of them is that they
|
113
113
|
are Python dictionaries designed to ensure that each key-value pair
|
114
114
|
adheres to specified data types.
|
115
115
|
|
116
116
|
Let's see an example.
|
117
117
|
|
118
|
-
>>> from flwr.common import
|
118
|
+
>>> from flwr.common import RecordDict
|
119
119
|
>>> from flwr.common import ConfigsRecord, MetricsRecord, ParametersRecord
|
120
120
|
>>>
|
121
121
|
>>> # Let's begin with an empty record
|
122
|
-
>>>
|
122
|
+
>>> my_records = RecordDict()
|
123
123
|
>>>
|
124
124
|
>>> # We can create a ConfigsRecord
|
125
125
|
>>> c_record = ConfigsRecord({"lr": 0.1, "batch-size": 128})
|
126
126
|
>>> # Adding it to the record_set would look like this
|
127
|
-
>>>
|
127
|
+
>>> my_records["my_config"] = c_record
|
128
128
|
>>>
|
129
129
|
>>> # We can create a MetricsRecord following a similar process
|
130
130
|
>>> m_record = MetricsRecord({"accuracy": 0.93, "losses": [0.23, 0.1]})
|
131
131
|
>>> # Adding it to the record_set would look like this
|
132
|
-
>>>
|
132
|
+
>>> my_records["my_metrics"] = m_record
|
133
133
|
|
134
134
|
Adding a :code:`ParametersRecord` follows the same steps as above but first,
|
135
135
|
the array needs to be serialized and represented as a :code:`flwr.common.Array`.
|
@@ -148,7 +148,7 @@ class RecordSet(TypedDict[str, RecordType]):
|
|
148
148
|
>>> p_record = ParametersRecord({"my_array": arr})
|
149
149
|
>>>
|
150
150
|
>>> # Adding it to the record_set would look like this
|
151
|
-
>>>
|
151
|
+
>>> my_records["my_parameters"] = p_record
|
152
152
|
|
153
153
|
For additional examples on how to construct each of the records types shown
|
154
154
|
above, please refer to the documentation for :code:`ConfigsRecord`,
|
@@ -207,3 +207,43 @@ class RecordSet(TypedDict[str, RecordType]):
|
|
207
207
|
type(original_value).__name__,
|
208
208
|
type(value).__name__,
|
209
209
|
)
|
210
|
+
|
211
|
+
|
212
|
+
class RecordSet(RecordDict):
|
213
|
+
"""Deprecated class ``RecordSet``, use ``RecordDict`` instead.
|
214
|
+
|
215
|
+
This class exists solely for backward compatibility with legacy
|
216
|
+
code that previously used ``RecordSet``. It has been renamed
|
217
|
+
to ``RecordDict`` and will be removed in a future release.
|
218
|
+
|
219
|
+
.. warning::
|
220
|
+
``RecordSet`` is deprecated and will be removed in a future release.
|
221
|
+
Use ``RecordDict`` instead.
|
222
|
+
|
223
|
+
Examples
|
224
|
+
--------
|
225
|
+
Legacy (deprecated) usage::
|
226
|
+
|
227
|
+
from flwr.common import RecordSet
|
228
|
+
|
229
|
+
my_content = RecordSet()
|
230
|
+
|
231
|
+
Updated usage::
|
232
|
+
|
233
|
+
from flwr.common import RecordDict
|
234
|
+
|
235
|
+
my_content = RecordDict()
|
236
|
+
"""
|
237
|
+
|
238
|
+
_warning_logged = False
|
239
|
+
|
240
|
+
def __init__(self, records: dict[str, RecordType] | None = None) -> None:
|
241
|
+
if not RecordSet._warning_logged:
|
242
|
+
RecordSet._warning_logged = True
|
243
|
+
log(
|
244
|
+
WARN,
|
245
|
+
"The `RecordSet` class has been renamed to `RecordDict`. "
|
246
|
+
"Support for `RecordSet` will be removed in a future release. "
|
247
|
+
"Please update your code accordingly.",
|
248
|
+
)
|
249
|
+
super().__init__(records)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright
|
1
|
+
# Copyright 2025 Flower Labs GmbH. All Rights Reserved.
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -12,14 +12,14 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
# ==============================================================================
|
15
|
-
"""
|
15
|
+
"""RecordDict utilities."""
|
16
16
|
|
17
17
|
|
18
18
|
from collections import OrderedDict
|
19
19
|
from collections.abc import Mapping
|
20
20
|
from typing import Union, cast, get_args
|
21
21
|
|
22
|
-
from . import Array, ConfigsRecord, MetricsRecord, ParametersRecord,
|
22
|
+
from . import Array, ConfigsRecord, MetricsRecord, ParametersRecord, RecordDict
|
23
23
|
from .typing import (
|
24
24
|
Code,
|
25
25
|
ConfigsRecordValues,
|
@@ -135,72 +135,72 @@ def _check_mapping_from_recordscalartype_to_scalar(
|
|
135
135
|
"There is not a 1:1 mapping between `common.Scalar` types and those "
|
136
136
|
"supported in `common.ConfigsRecordValues` or "
|
137
137
|
"`common.ConfigsRecordValues`. Consider casting your values to a type "
|
138
|
-
"supported by the `common.
|
138
|
+
"supported by the `common.RecordDict` infrastructure. "
|
139
139
|
f"You used type: {type(value)}"
|
140
140
|
)
|
141
141
|
return cast(dict[str, Scalar], record_data)
|
142
142
|
|
143
143
|
|
144
|
-
def
|
145
|
-
|
144
|
+
def _recorddict_to_fit_or_evaluate_ins_components(
|
145
|
+
recorddict: RecordDict,
|
146
146
|
ins_str: str,
|
147
147
|
keep_input: bool,
|
148
148
|
) -> tuple[Parameters, dict[str, Scalar]]:
|
149
|
-
"""Derive Fit/Evaluate Ins from a
|
149
|
+
"""Derive Fit/Evaluate Ins from a RecordDict."""
|
150
150
|
# get Array and construct Parameters
|
151
|
-
parameters_record =
|
151
|
+
parameters_record = recorddict.parameters_records[f"{ins_str}.parameters"]
|
152
152
|
|
153
153
|
parameters = parametersrecord_to_parameters(
|
154
154
|
parameters_record, keep_input=keep_input
|
155
155
|
)
|
156
156
|
|
157
157
|
# get config dict
|
158
|
-
config_record =
|
158
|
+
config_record = recorddict.configs_records[f"{ins_str}.config"]
|
159
159
|
# pylint: disable-next=protected-access
|
160
160
|
config_dict = _check_mapping_from_recordscalartype_to_scalar(config_record)
|
161
161
|
|
162
162
|
return parameters, config_dict
|
163
163
|
|
164
164
|
|
165
|
-
def
|
165
|
+
def _fit_or_evaluate_ins_to_recorddict(
|
166
166
|
ins: Union[FitIns, EvaluateIns], keep_input: bool
|
167
|
-
) ->
|
168
|
-
|
167
|
+
) -> RecordDict:
|
168
|
+
recorddict = RecordDict()
|
169
169
|
|
170
170
|
ins_str = "fitins" if isinstance(ins, FitIns) else "evaluateins"
|
171
171
|
parametersrecord = parameters_to_parametersrecord(ins.parameters, keep_input)
|
172
|
-
|
172
|
+
recorddict.parameters_records[f"{ins_str}.parameters"] = parametersrecord
|
173
173
|
|
174
|
-
|
174
|
+
recorddict.configs_records[f"{ins_str}.config"] = ConfigsRecord(
|
175
175
|
ins.config # type: ignore
|
176
176
|
)
|
177
177
|
|
178
|
-
return
|
178
|
+
return recorddict
|
179
179
|
|
180
180
|
|
181
|
-
def
|
182
|
-
res_str: str, status: Status,
|
183
|
-
) ->
|
181
|
+
def _embed_status_into_recorddict(
|
182
|
+
res_str: str, status: Status, recorddict: RecordDict
|
183
|
+
) -> RecordDict:
|
184
184
|
status_dict: dict[str, ConfigsRecordValues] = {
|
185
185
|
"code": int(status.code.value),
|
186
186
|
"message": status.message,
|
187
187
|
}
|
188
188
|
# we add it to a `ConfigsRecord`` because the `status.message`` is a string
|
189
189
|
# and `str` values aren't supported in `MetricsRecords`
|
190
|
-
|
191
|
-
return
|
190
|
+
recorddict.configs_records[f"{res_str}.status"] = ConfigsRecord(status_dict)
|
191
|
+
return recorddict
|
192
192
|
|
193
193
|
|
194
|
-
def
|
195
|
-
status =
|
194
|
+
def _extract_status_from_recorddict(res_str: str, recorddict: RecordDict) -> Status:
|
195
|
+
status = recorddict.configs_records[f"{res_str}.status"]
|
196
196
|
code = cast(int, status["code"])
|
197
197
|
return Status(code=Code(code), message=str(status["message"]))
|
198
198
|
|
199
199
|
|
200
|
-
def
|
201
|
-
"""Derive FitIns from a
|
202
|
-
parameters, config =
|
203
|
-
|
200
|
+
def recorddict_to_fitins(recorddict: RecordDict, keep_input: bool) -> FitIns:
|
201
|
+
"""Derive FitIns from a RecordDict object."""
|
202
|
+
parameters, config = _recorddict_to_fit_or_evaluate_ins_components(
|
203
|
+
recorddict,
|
204
204
|
ins_str="fitins",
|
205
205
|
keep_input=keep_input,
|
206
206
|
)
|
@@ -208,44 +208,44 @@ def recordset_to_fitins(recordset: RecordSet, keep_input: bool) -> FitIns:
|
|
208
208
|
return FitIns(parameters=parameters, config=config)
|
209
209
|
|
210
210
|
|
211
|
-
def
|
212
|
-
"""Construct a
|
213
|
-
return
|
211
|
+
def fitins_to_recorddict(fitins: FitIns, keep_input: bool) -> RecordDict:
|
212
|
+
"""Construct a RecordDict from a FitIns object."""
|
213
|
+
return _fit_or_evaluate_ins_to_recorddict(fitins, keep_input)
|
214
214
|
|
215
215
|
|
216
|
-
def
|
217
|
-
"""Derive FitRes from a
|
216
|
+
def recorddict_to_fitres(recorddict: RecordDict, keep_input: bool) -> FitRes:
|
217
|
+
"""Derive FitRes from a RecordDict object."""
|
218
218
|
ins_str = "fitres"
|
219
219
|
parameters = parametersrecord_to_parameters(
|
220
|
-
|
220
|
+
recorddict.parameters_records[f"{ins_str}.parameters"], keep_input=keep_input
|
221
221
|
)
|
222
222
|
|
223
223
|
num_examples = cast(
|
224
|
-
int,
|
224
|
+
int, recorddict.metrics_records[f"{ins_str}.num_examples"]["num_examples"]
|
225
225
|
)
|
226
|
-
configs_record =
|
226
|
+
configs_record = recorddict.configs_records[f"{ins_str}.metrics"]
|
227
227
|
# pylint: disable-next=protected-access
|
228
228
|
metrics = _check_mapping_from_recordscalartype_to_scalar(configs_record)
|
229
|
-
status =
|
229
|
+
status = _extract_status_from_recorddict(ins_str, recorddict)
|
230
230
|
|
231
231
|
return FitRes(
|
232
232
|
status=status, parameters=parameters, num_examples=num_examples, metrics=metrics
|
233
233
|
)
|
234
234
|
|
235
235
|
|
236
|
-
def
|
237
|
-
"""Construct a
|
238
|
-
|
236
|
+
def fitres_to_recorddict(fitres: FitRes, keep_input: bool) -> RecordDict:
|
237
|
+
"""Construct a RecordDict from a FitRes object."""
|
238
|
+
recorddict = RecordDict()
|
239
239
|
|
240
240
|
res_str = "fitres"
|
241
241
|
|
242
|
-
|
242
|
+
recorddict.configs_records[f"{res_str}.metrics"] = ConfigsRecord(
|
243
243
|
fitres.metrics # type: ignore
|
244
244
|
)
|
245
|
-
|
245
|
+
recorddict.metrics_records[f"{res_str}.num_examples"] = MetricsRecord(
|
246
246
|
{"num_examples": fitres.num_examples},
|
247
247
|
)
|
248
|
-
|
248
|
+
recorddict.parameters_records[f"{res_str}.parameters"] = (
|
249
249
|
parameters_to_parametersrecord(
|
250
250
|
fitres.parameters,
|
251
251
|
keep_input,
|
@@ -253,15 +253,15 @@ def fitres_to_recordset(fitres: FitRes, keep_input: bool) -> RecordSet:
|
|
253
253
|
)
|
254
254
|
|
255
255
|
# status
|
256
|
-
|
256
|
+
recorddict = _embed_status_into_recorddict(res_str, fitres.status, recorddict)
|
257
257
|
|
258
|
-
return
|
258
|
+
return recorddict
|
259
259
|
|
260
260
|
|
261
|
-
def
|
262
|
-
"""Derive EvaluateIns from a
|
263
|
-
parameters, config =
|
264
|
-
|
261
|
+
def recorddict_to_evaluateins(recorddict: RecordDict, keep_input: bool) -> EvaluateIns:
|
262
|
+
"""Derive EvaluateIns from a RecordDict object."""
|
263
|
+
parameters, config = _recorddict_to_fit_or_evaluate_ins_components(
|
264
|
+
recorddict,
|
265
265
|
ins_str="evaluateins",
|
266
266
|
keep_input=keep_input,
|
267
267
|
)
|
@@ -269,150 +269,150 @@ def recordset_to_evaluateins(recordset: RecordSet, keep_input: bool) -> Evaluate
|
|
269
269
|
return EvaluateIns(parameters=parameters, config=config)
|
270
270
|
|
271
271
|
|
272
|
-
def
|
273
|
-
"""Construct a
|
274
|
-
return
|
272
|
+
def evaluateins_to_recorddict(evaluateins: EvaluateIns, keep_input: bool) -> RecordDict:
|
273
|
+
"""Construct a RecordDict from a EvaluateIns object."""
|
274
|
+
return _fit_or_evaluate_ins_to_recorddict(evaluateins, keep_input)
|
275
275
|
|
276
276
|
|
277
|
-
def
|
278
|
-
"""Derive EvaluateRes from a
|
277
|
+
def recorddict_to_evaluateres(recorddict: RecordDict) -> EvaluateRes:
|
278
|
+
"""Derive EvaluateRes from a RecordDict object."""
|
279
279
|
ins_str = "evaluateres"
|
280
280
|
|
281
|
-
loss = cast(int,
|
281
|
+
loss = cast(int, recorddict.metrics_records[f"{ins_str}.loss"]["loss"])
|
282
282
|
|
283
283
|
num_examples = cast(
|
284
|
-
int,
|
284
|
+
int, recorddict.metrics_records[f"{ins_str}.num_examples"]["num_examples"]
|
285
285
|
)
|
286
|
-
configs_record =
|
286
|
+
configs_record = recorddict.configs_records[f"{ins_str}.metrics"]
|
287
287
|
|
288
288
|
# pylint: disable-next=protected-access
|
289
289
|
metrics = _check_mapping_from_recordscalartype_to_scalar(configs_record)
|
290
|
-
status =
|
290
|
+
status = _extract_status_from_recorddict(ins_str, recorddict)
|
291
291
|
|
292
292
|
return EvaluateRes(
|
293
293
|
status=status, loss=loss, num_examples=num_examples, metrics=metrics
|
294
294
|
)
|
295
295
|
|
296
296
|
|
297
|
-
def
|
298
|
-
"""Construct a
|
299
|
-
|
297
|
+
def evaluateres_to_recorddict(evaluateres: EvaluateRes) -> RecordDict:
|
298
|
+
"""Construct a RecordDict from a EvaluateRes object."""
|
299
|
+
recorddict = RecordDict()
|
300
300
|
|
301
301
|
res_str = "evaluateres"
|
302
302
|
# loss
|
303
|
-
|
303
|
+
recorddict.metrics_records[f"{res_str}.loss"] = MetricsRecord(
|
304
304
|
{"loss": evaluateres.loss},
|
305
305
|
)
|
306
306
|
|
307
307
|
# num_examples
|
308
|
-
|
308
|
+
recorddict.metrics_records[f"{res_str}.num_examples"] = MetricsRecord(
|
309
309
|
{"num_examples": evaluateres.num_examples},
|
310
310
|
)
|
311
311
|
|
312
312
|
# metrics
|
313
|
-
|
313
|
+
recorddict.configs_records[f"{res_str}.metrics"] = ConfigsRecord(
|
314
314
|
evaluateres.metrics, # type: ignore
|
315
315
|
)
|
316
316
|
|
317
317
|
# status
|
318
|
-
|
319
|
-
f"{res_str}", evaluateres.status,
|
318
|
+
recorddict = _embed_status_into_recorddict(
|
319
|
+
f"{res_str}", evaluateres.status, recorddict
|
320
320
|
)
|
321
321
|
|
322
|
-
return
|
322
|
+
return recorddict
|
323
323
|
|
324
324
|
|
325
|
-
def
|
326
|
-
"""Derive GetParametersIns from a
|
327
|
-
config_record =
|
325
|
+
def recorddict_to_getparametersins(recorddict: RecordDict) -> GetParametersIns:
|
326
|
+
"""Derive GetParametersIns from a RecordDict object."""
|
327
|
+
config_record = recorddict.configs_records["getparametersins.config"]
|
328
328
|
# pylint: disable-next=protected-access
|
329
329
|
config_dict = _check_mapping_from_recordscalartype_to_scalar(config_record)
|
330
330
|
|
331
331
|
return GetParametersIns(config=config_dict)
|
332
332
|
|
333
333
|
|
334
|
-
def
|
335
|
-
"""Construct a
|
336
|
-
|
334
|
+
def getparametersins_to_recorddict(getparameters_ins: GetParametersIns) -> RecordDict:
|
335
|
+
"""Construct a RecordDict from a GetParametersIns object."""
|
336
|
+
recorddict = RecordDict()
|
337
337
|
|
338
|
-
|
338
|
+
recorddict.configs_records["getparametersins.config"] = ConfigsRecord(
|
339
339
|
getparameters_ins.config, # type: ignore
|
340
340
|
)
|
341
|
-
return
|
341
|
+
return recorddict
|
342
342
|
|
343
343
|
|
344
|
-
def
|
344
|
+
def getparametersres_to_recorddict(
|
345
345
|
getparametersres: GetParametersRes, keep_input: bool
|
346
|
-
) ->
|
347
|
-
"""Construct a
|
348
|
-
|
346
|
+
) -> RecordDict:
|
347
|
+
"""Construct a RecordDict from a GetParametersRes object."""
|
348
|
+
recorddict = RecordDict()
|
349
349
|
res_str = "getparametersres"
|
350
350
|
parameters_record = parameters_to_parametersrecord(
|
351
351
|
getparametersres.parameters, keep_input=keep_input
|
352
352
|
)
|
353
|
-
|
353
|
+
recorddict.parameters_records[f"{res_str}.parameters"] = parameters_record
|
354
354
|
|
355
355
|
# status
|
356
|
-
|
357
|
-
res_str, getparametersres.status,
|
356
|
+
recorddict = _embed_status_into_recorddict(
|
357
|
+
res_str, getparametersres.status, recorddict
|
358
358
|
)
|
359
359
|
|
360
|
-
return
|
360
|
+
return recorddict
|
361
361
|
|
362
362
|
|
363
|
-
def
|
364
|
-
|
363
|
+
def recorddict_to_getparametersres(
|
364
|
+
recorddict: RecordDict, keep_input: bool
|
365
365
|
) -> GetParametersRes:
|
366
|
-
"""Derive GetParametersRes from a
|
366
|
+
"""Derive GetParametersRes from a RecordDict object."""
|
367
367
|
res_str = "getparametersres"
|
368
368
|
parameters = parametersrecord_to_parameters(
|
369
|
-
|
369
|
+
recorddict.parameters_records[f"{res_str}.parameters"], keep_input=keep_input
|
370
370
|
)
|
371
371
|
|
372
|
-
status =
|
372
|
+
status = _extract_status_from_recorddict(res_str, recorddict)
|
373
373
|
return GetParametersRes(status=status, parameters=parameters)
|
374
374
|
|
375
375
|
|
376
|
-
def
|
377
|
-
"""Derive GetPropertiesIns from a
|
378
|
-
config_record =
|
376
|
+
def recorddict_to_getpropertiesins(recorddict: RecordDict) -> GetPropertiesIns:
|
377
|
+
"""Derive GetPropertiesIns from a RecordDict object."""
|
378
|
+
config_record = recorddict.configs_records["getpropertiesins.config"]
|
379
379
|
# pylint: disable-next=protected-access
|
380
380
|
config_dict = _check_mapping_from_recordscalartype_to_scalar(config_record)
|
381
381
|
|
382
382
|
return GetPropertiesIns(config=config_dict)
|
383
383
|
|
384
384
|
|
385
|
-
def
|
386
|
-
"""Construct a
|
387
|
-
|
388
|
-
|
385
|
+
def getpropertiesins_to_recorddict(getpropertiesins: GetPropertiesIns) -> RecordDict:
|
386
|
+
"""Construct a RecordDict from a GetPropertiesRes object."""
|
387
|
+
recorddict = RecordDict()
|
388
|
+
recorddict.configs_records["getpropertiesins.config"] = ConfigsRecord(
|
389
389
|
getpropertiesins.config, # type: ignore
|
390
390
|
)
|
391
|
-
return
|
391
|
+
return recorddict
|
392
392
|
|
393
393
|
|
394
|
-
def
|
395
|
-
"""Derive GetPropertiesRes from a
|
394
|
+
def recorddict_to_getpropertiesres(recorddict: RecordDict) -> GetPropertiesRes:
|
395
|
+
"""Derive GetPropertiesRes from a RecordDict object."""
|
396
396
|
res_str = "getpropertiesres"
|
397
|
-
config_record =
|
397
|
+
config_record = recorddict.configs_records[f"{res_str}.properties"]
|
398
398
|
# pylint: disable-next=protected-access
|
399
399
|
properties = _check_mapping_from_recordscalartype_to_scalar(config_record)
|
400
400
|
|
401
|
-
status =
|
401
|
+
status = _extract_status_from_recorddict(res_str, recorddict=recorddict)
|
402
402
|
|
403
403
|
return GetPropertiesRes(status=status, properties=properties)
|
404
404
|
|
405
405
|
|
406
|
-
def
|
407
|
-
"""Construct a
|
408
|
-
|
406
|
+
def getpropertiesres_to_recorddict(getpropertiesres: GetPropertiesRes) -> RecordDict:
|
407
|
+
"""Construct a RecordDict from a GetPropertiesRes object."""
|
408
|
+
recorddict = RecordDict()
|
409
409
|
res_str = "getpropertiesres"
|
410
|
-
|
410
|
+
recorddict.configs_records[f"{res_str}.properties"] = ConfigsRecord(
|
411
411
|
getpropertiesres.properties, # type: ignore
|
412
412
|
)
|
413
413
|
# status
|
414
|
-
|
415
|
-
res_str, getpropertiesres.status,
|
414
|
+
recorddict = _embed_status_into_recorddict(
|
415
|
+
res_str, getpropertiesres.status, recorddict
|
416
416
|
)
|
417
417
|
|
418
|
-
return
|
418
|
+
return recorddict
|