Skip to content

declearn.communication.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/_build.py
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
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))