Skip to content

declearn.data_info.get_data_info_fields_documentation

Return the documentation of all registered DataInfoField subclasses.

Parameters:

Name Type Description Default
display bool

Whether to print a docstring-like version of the returned dict.

True

Returns:

Name Type Description
documentation dict[str, str]

Dict with specified 'data_info' fields as keys, and associated documentation (from DataInfoField.doc) as values.

Source code in declearn/data_info/_base.py
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
def get_data_info_fields_documentation(
    display: bool = True,
) -> Dict[str, str]:
    """Return the documentation of all registered `DataInfoField` subclasses.

    Parameters
    ----------
    display: bool, default=True
        Whether to print a docstring-like version of the returned dict.

    Returns
    -------
    documentation: dict[str, str]
        Dict with specified 'data_info' fields as keys, and associated
        documentation (from `DataInfoField.doc`) as values.
    """
    documentation = {cls.field: cls.doc for cls in DATA_INFO_FIELDS.values()}
    if display:
        msg = "\n".join(
            f"{field}:\n    {doc}" for field, doc in documentation.items()
        )
        print(msg)
    return documentation