#NEWLINE# def _check_is_permutation( indices , n_samples ) : #NEWLINE# #INDENT# 'Check whether indices is a reordering of the array np.arange(n_samples)\n\n    Parameters\n    ----------\n    indices : ndarray\n        integer array to test\n    n_samples : int\n        number of expected elements\n\n    Returns\n    -------\n    is_partition : bool\n        True iff sorted(locs) is range(n)\n    ' #NEWLINE# if ( len ( indices ) != n_samples ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# hit = np . zeros ( n_samples , bool ) #NEWLINE# hit [ indices ] = True #NEWLINE# if ( not np . all ( hit ) ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# return True