Skip to content

declearn.communication.NetworkClientConfig

Bases: BuildClientConfig, TomlConfig

TOML-parsable dataclass for network clients' instantiation.

This class enables parsing and bundling arguments to the build_client function from a TOML config file (using the from_toml classmethod) or from keyword arguments (using the from_kwargs one), and calling that function using the build_client method.

Source code in declearn/communication/utils/_build.py
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
class NetworkClientConfig(BuildClientConfig, TomlConfig):  # type: ignore
    """TOML-parsable dataclass for network clients' instantiation.

    This class enables parsing and bundling arguments to the
    [build_client][declearn.communication.build_client] function
    from a TOML config file (using the `from_toml` classmethod)
    or from keyword arguments (using the `from_kwargs` one), and
    calling that function using the `build_client` method.
    """

    def build_client(self) -> NetworkClient:
        """Build a NetworkClient from the wrapped parameters.

        Returns
        -------
        client: NetworkClient
            NetworkClient communication endpoint instance.
        """
        return self.call()

build_client()

Build a NetworkClient from the wrapped parameters.

Returns:

Name Type Description
client NetworkClient

NetworkClient communication endpoint instance.

Source code in declearn/communication/utils/_build.py
201
202
203
204
205
206
207
208
209
def build_client(self) -> NetworkClient:
    """Build a NetworkClient from the wrapped parameters.

    Returns
    -------
    client: NetworkClient
        NetworkClient communication endpoint instance.
    """
    return self.call()