from typing import List


def di_borders(di: List[float]) -> List[float]:
    """Function to return the list of borders based on the directional index
    vector. Threshold chosen at 1.96 to have a p-value below 0.05. As the
    directional index is a t-value, a value below -1.96 or above 1.96 will have
    a p-value below 0.05. Like that we took only significative changes.

    Parameters
    ----------
    di : numpy.ndarray
        List of the directional index computed for each bin.

    Returns
    -------
    list of int:
        Positions in bins of the detected borders.
    
    Example
    -------
        >>> di = [0.5, 2., 3., 4., 0.1, -3.2, -3.5, 0.]
        >>> print(di_borders(di))
        []
        >>> di = [0.5, 2., 3., 4., 0.1, -3.2, 4., -2.]
        >>> print(di_borders(di))
        [1, 6]
    """
    # Initiation use last value as previous one as the genome is considered as
    # circular.
    borders = []
    if di[-1] < -1.96:
        negative = True
    else:
        negative = False

    # Iterates on the DI values
    for i, curr_di in enumerate(di):
        if curr_di >= 1.96 and negative:
            borders.append(i)
            negative = False
        if curr_di <= -1.96:
            negative = True
    return borders