Skip to content

Docstring conventions#

CAREamics follows the numpydoc docstring conventions. The is enforced by the use of the numpydoc pre-commit hook.

On top of the numpy conventions, we try to build a more human readable docstring by adapting principles from Pandas docstring.

Parameter declaration#

"""
    param : Union[str, int] ❌
    param : str or int ✅
    param : str | int ✅

    choice : Literal["a", "b", "c"] ❌
    choice : {"a", "b", "c"} ✅

    param : Tuple[int, int] ❌
    param : (int, int) ✅

    sequence: List[int] ❌
    sequence: list of int ✅

    param : int 
        The default is 1. ❌
    param : int, default=1 ✅

    param : Optional[int] ❌
    param : int, optional ✅
"""

Third-party types#

"""
    param : pandas.DataFrame
    param : NDArray
    param : torch.Tensor
    param : tensorflow.Tensor
"""