def add(self, elem, replace=False):
        """Add a requirement.

        :param elem: a string or :class:`Requirement` instance.
        :param replace: if `True`, packages in the set with the same name will
            be removed first.
        """
        if isinstance(elem, text_type):
            elem = Requirement.coerce(elem)
        if replace and elem in self:
            self.remove(elem)
        super(Requirements, self).add(elem)
def permutation_subjects_ktst(y):
    """Permute class labels of Contextual Disorder dataset for KTST.
    """
    yp = np.random.randint(0, 2, len(y)/2)
    yp = np.concatenate((yp, np.logical_not(yp).astype(int)))
    y_perm = np.arange(len(y))
    for i in range(len(y)/2):
        if yp[i] == 1:
            y_perm[i] = len(y)/2+i
            y_perm[len(y)/2+i] = i
    return y_perm