Skip to content

layopt.example

Behold, module level docstring.

Example

This class exists to show off autodocstring generation.

Source code in src/layopt/example.py
class Example:
    """This class exists to show off autodocstring generation."""

    def add(self, a: int, b: int) -> int:
        """Add two integers.

        Notes:
            Docstring can be useful. I promise.

        Parameters:
            a: First integer to add.
            b: Second integer to add.

        Returns:
            The sum of the two integers.
        """
        return a + b

    def subtract(self, a: int, b: int) -> int:
        """Subtract two integers.

        Parameters:
            a: Integer to subtract from.
            b: Integer to subtract.

        Returns:
            The difference of the two integers.
        """
        return a - b

add

add(a: int, b: int) -> int

Add two integers.

Notes

Docstring can be useful. I promise.

Parameters:

Name Type Description Default
a int

First integer to add.

required
b int

Second integer to add.

required

Returns:

Type Description
int

The sum of the two integers.

Source code in src/layopt/example.py
def add(self, a: int, b: int) -> int:
    """Add two integers.

    Notes:
        Docstring can be useful. I promise.

    Parameters:
        a: First integer to add.
        b: Second integer to add.

    Returns:
        The sum of the two integers.
    """
    return a + b

subtract

subtract(a: int, b: int) -> int

Subtract two integers.

Parameters:

Name Type Description Default
a int

Integer to subtract from.

required
b int

Integer to subtract.

required

Returns:

Type Description
int

The difference of the two integers.

Source code in src/layopt/example.py
def subtract(self, a: int, b: int) -> int:
    """Subtract two integers.

    Parameters:
        a: Integer to subtract from.
        b: Integer to subtract.

    Returns:
        The difference of the two integers.
    """
    return a - b