# Copyright 2025 Flower Labs GmbH. All Rights Reserved.## Licensed under the Apache License, Version 2.0 (the "License");# you may not use this file except in compliance with the License.# You may obtain a copy of the License at## http://www.apache.org/licenses/LICENSE-2.0## Unless required by applicable law or agreed to in writing, software# distributed under the License is distributed on an "AS IS" BASIS,# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.# See the License for the specific language governing permissions and# limitations under the License.# =============================================================================="""Legacy common type definitions."""fromcollections.abcimportCallablefromdataclassesimportdataclassfromenumimportEnumfromtypingimportAnyimportnumpyasnpimportnumpy.typingasnptNDArray=npt.NDArray[Any]NDArrayInt=npt.NDArray[np.int_]NDArrayFloat=npt.NDArray[np.float64]NDArrays=list[NDArray]Scalar=bool|bytes|float|int|strValue=(bool|bytes|float|int|str|list[bool]|list[bytes]|list[float]|list[int]|list[str])Metrics=dict[str,Scalar]MetricsAggregationFn=Callable[[list[tuple[int,Metrics]]],Metrics]Config=dict[str,Scalar]Properties=dict[str,Scalar]
[문서]classCode(Enum):"""Client status codes."""OK=0GET_PROPERTIES_NOT_IMPLEMENTED=1GET_PARAMETERS_NOT_IMPLEMENTED=2FIT_NOT_IMPLEMENTED=3EVALUATE_NOT_IMPLEMENTED=4
[문서]@dataclassclassGetParametersIns:"""Parameters request for a client."""config:Config
[문서]@dataclassclassGetParametersRes:"""Response when asked to return parameters."""status:Statusparameters:Parameters
[문서]@dataclassclassFitIns:"""Fit instructions for a client."""parameters:Parametersconfig:dict[str,Scalar]
[문서]@dataclassclassFitRes:"""Fit response from a client."""status:Statusparameters:Parametersnum_examples:intmetrics:dict[str,Scalar]
[문서]@dataclassclassEvaluateIns:"""Evaluate instructions for a client."""parameters:Parametersconfig:dict[str,Scalar]
[문서]@dataclassclassEvaluateRes:"""Evaluate response from a client."""status:Statusloss:floatnum_examples:intmetrics:dict[str,Scalar]
[문서]@dataclassclassGetPropertiesIns:"""Properties request for a client."""config:Config
[문서]@dataclassclassGetPropertiesRes:"""Properties response from a client."""status:Statusproperties:Properties
[문서]@dataclassclassReconnectIns:"""ReconnectIns message from server to client."""seconds:int|None
[문서]@dataclassclassDisconnectRes:"""DisconnectRes message from client to server."""reason:str
[문서]@dataclassclassServerMessage:"""ServerMessage is a container used to hold one instruction message."""get_properties_ins:GetPropertiesIns|None=Noneget_parameters_ins:GetParametersIns|None=Nonefit_ins:FitIns|None=Noneevaluate_ins:EvaluateIns|None=None
[문서]@dataclassclassClientMessage:"""ClientMessage is a container used to hold one result message."""get_properties_res:GetPropertiesRes|None=Noneget_parameters_res:GetParametersRes|None=Nonefit_res:FitRes|None=Noneevaluate_res:EvaluateRes|None=None