Skip to content

declearn.communication.NetworkServerConfig

Bases: BuildServerConfig, TomlConfig

TOML-parsable dataclass for network servers' instantiation.

This class enables parsing and bundling arguments to the build_server 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_server method.

Source code in declearn/communication/utils/_build.py
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
class NetworkServerConfig(BuildServerConfig, TomlConfig):  # type: ignore
    """TOML-parsable dataclass for network servers' instantiation.

    This class enables parsing and bundling arguments to the
    [build_server][declearn.communication.build_server] 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_server` method.
    """

    def build_server(self) -> NetworkServer:
        """Build a NetworkServer from the wrapped parameters.

        Returns
        -------
        server: NetworkServer
            NetworkServer communication endpoint instance.
        """
        return self.call()

build_server()

Build a NetworkServer from the wrapped parameters.

Returns:

Name Type Description
server NetworkServer

NetworkServer communication endpoint instance.

Source code in declearn/communication/utils/_build.py
222
223
224
225
226
227
228
229
230
def build_server(self) -> NetworkServer:
    """Build a NetworkServer from the wrapped parameters.

    Returns
    -------
    server: NetworkServer
        NetworkServer communication endpoint instance.
    """
    return self.call()