Skip to content

foobar.foo

foo module.

bar

bar(data: list[int] | None = None) -> int | None

Sum list of integers.

Parameters:

  • data ((list[int], None), default: None ) –

    optional list of integers (default: None).

Returns:

  • int | None

    None if data=None else the integer sum of data.

Source code in foobar/foo.py
def bar(data: list[int] | None = None) -> int | None:
    """Sum list of integers.

    Args:
        data (list[int], None): optional list of integers (default: None).

    Returns:
        `None` if `data=None` else the integer sum of `data`.
    """
    if data is not None:
        return sum(data)
    return None