def _validateJob(self, jobSet):
        """
        @raise InternalConaryError: the job set is inconsistent.
        """
        # sanity check for jobSet - never allow a job that would add
        # or remove the same trove twice to be applied to the system.
        oldTroves = [ (x[0], x[1]) for x in jobSet if x[1][0]]
        if not len(oldTroves) == len(set(oldTroves)):
            extraTroves = set(x for x in oldTroves if oldTroves.count(x) > 1)
            raise InternalConaryError(
                            "Update tries to remove same trove twice:\n    "
                              + '\n    '.join('%s=%s[%s]' % ((x[0],) + x[1])
                                              for x in sorted(extraTroves)))

        newTroves = [ (x[0], x[2]) for x in jobSet if x[2][0]]
        if not len(newTroves) == len(set(newTroves)):
            extraTroves = [ x for x in newTroves if newTroves.count(x) > 1 ]
            raise InternalConaryError(
                             "Update tries to add same trove twice:\n    "
                              + '\n    '.join('%s=%s[%s]' % ((x[0],) + x[1])
                                              for x in sorted(extraTroves)))
dataset/ETHPy150Open sassoftware/conary/conary/conaryclient/update.py/ClientUpdate._validateJob/original