kartothek icon indicating copy to clipboard operation
kartothek copied to clipboard

Add type annotations

Open crepererum opened this issue 5 years ago • 2 comments

Abstract

We use types in our documentation but it would be better to provide proper annotations.

Example

From:

def add(a, b):
    """
    Adds to numbers.

    Parameters
    ----------
    a: Union[float, int]
        First number to add.
    b: Union[float, int]
        Second number to add.

    Returns
    -------
    c: float
        Sum of both.
    """
    ...

To:

from typing import Union


def add(a: Union[float, int], b: Union[float, int]) -> float:
    """
    Adds to numbers.

    Parameters
    ----------
    a:
        First number to add.
    b:
        Second number to add.

    Returns
    -------
    c:
        Sum of both.
    """
    ...

Please note the colons and new lines after the parameter and return value names, otherwise, sphinx docs break (sphinx will treat your docs as types).

crepererum avatar May 14 '19 14:05 crepererum