

def receiveMessage(self, msg, sender):
    logger = logging.getLogger('Thespian.Actor')
    logger.debug('Stewart got message "%s" from %s', str(msg), str(sender))
    if (msg == 'you say?'):
        self.send(sender, 'hi')
    elif (msg == 'cat says'):
        if (not self.cat):
            self.cat = self.createActor(Morris)
        self.askedBy = sender
        self.send(self.cat, 'kitty')
    elif (sender == self.cat):
        if self.askedBy:
            self.send(self.askedBy, msg)
            self.askedBy = None
    elif isinstance(msg, AskFriendsMsg):
        msg.backto = sender
        msg.response = 'Stewart:hello'
        self.send(msg.otherFriend, msg)
    else:
        self.nmessages = (self.nmessages + 1)
        if (self.nmessages < 10):
            super(Stewart, self).receiveMessage(msg, sender)
        else:
            self.send(sender, 'Appear to be in infinite sending loop!')

dataset/ETHPy150Open godaddy/Thespian/thespian/test/testMultipleActorSystems.py Stewart.receiveMessage/original