Skip to content

declearn.communication.utils.list_available_protocols

Return the list of available network protocols.

List protocol names that are associated with both a registered NetworkClient child class and a registered NetworkServer one.

Note that registered implementations might include third-party ones thanks to the (automated) type-registration system attached to the base classes.

Returns:

Name Type Description
protocols list[str]

List of valid names that may be passed as 'protocol' so as to instantiate network endpoints through a generic builder such as the build_client or build_server exposed under declearn.communication.

Source code in declearn/communication/utils/_build.py
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
def list_available_protocols() -> List[str]:
    """Return the list of available network protocols.

    List protocol names that are associated with both a registered
    NetworkClient child class and a registered NetworkServer one.

    Note that registered implementations might include third-party ones
    thanks to the (automated) type-registration system attached to the
    base classes.

    Returns
    -------
    protocols: list[str]
        List of valid names that may be passed as 'protocol' so as
        to instantiate network endpoints through a generic builder
        such as the `build_client` or `build_server` exposed under
        `declearn.communication`.
    """
    client = access_types_mapping("NetworkClient")
    server = access_types_mapping("NetworkServer")
    return list(set(client).intersection(server))