def __str__(self):
        rstr = "%s %s:%d\n" % ("LEADER" if self.isleader else node_names[self.type], self.addr, self.port)
        rstr += "Members:\n%s\n" % "\n".join(str(peer) for peer in self.replicas)
        rstr += "Waiting to execute command %d.\n" % self.nexttoexecute
        rstr += "Commands:\n"
        for commandnumber, command in self.decisions.iteritems():
            state = ''
            if command in self.executed:
                if isinstance(command, ProposalClientBatch):
                    state = '\t' + str(self.executed[command])
                else:
                    state = '\t' + cr_codes[self.executed[command][0]]+ '\t' + str(self.executed[command][1])
            rstr += str(commandnumber) + ":\t" + str(command) + state + '\n'
        if len(self.pendingcommands):
            rstr += "Pending Commands:\n"
            for commandnumber, command in self.pendingcommands.iteritems():
                rstr += str(commandnumber) + ":\t" + str(command) + '\n'
        if len(self.proposals):
            rstr += "Proposals:\n"
            for commandnumber, command in self.proposals.iteritems():
                rstr += str(commandnumber) + ":\t" + str(command) + '\n'
        # Add QUORUM State
        rstr += "Quorum Ballot Number: %s\n" % str(self.quorumballotnumber)
        rstr += "Accepted PValues: %s\n" % str(self.quorumaccepted)

        return rstr
dataset/ETHPy150Open denizalti/concoord/concoord/replica.py/Replica.__str__/original