def _weight_func(dist):
    """ Weight function to replace lambda d: d ** -2.
    The lambda function is not valid because:
    if d==0 then 0^-2 is not valid. """

    # Dist could be multidimensional, flatten it so all values
    # can be looped
    with np.errstate(divide='ignore'):
        retval = dist / 1.
    return retval ** 2
dataset/ETHPy150Open scikit-learn/scikit-learn/sklearn/neighbors/tests/test_neighbors.py/_weight_func/swapped operands of `/`