

def receiveMessage(self, msg, sender):
    logger = logging.getLogger('Thespian.Actor')
    logger.setLevel(logging.DEBUG)
    logger.debug('%s Pattinson got message "%s" from %s', str(self.myAddress), str(msg), str(sender))
    if (msg == 'girlfriend?'):
        logger.debug('Pattinson creating girlfriend')
        self.girlFriend = self.createActor(Stewart)
        logger.debug('Pattinson returning girlfriend address')
        self.send(sender, self.girlFriend)
        logger.debug('Pattinson girlfriend stuff done')
    elif (msg == 'allfriends?'):
        friend1 = self.createActor(Jolie)
        friend2 = self.createActor(Stewart)
        logger.debug('%s Pattinson created friends %s and %s', str(self.myAddress), str(friend1), str(friend2))
        self.send(friend2, AskFriendsMsg('all say?', friend1, sender))
    elif isinstance(msg, AskFriendsMsg):
        self.send(msg.asker, ('Pattinson:hi.' + msg.response))
        self.send(msg.otherFriend, ActorExitRequest())
        self.send(sender, ActorExitRequest())
    elif (msg == 'Girlfriend Says'):
        if (not self.girlFriend):
            self.send(sender, 'no girlfriend')
        else:
            self.asker = sender
            self.send(self.girlFriend, 'you say?')
    elif (msg == 'Girlfriend Best Friend Says'):
        if (not self.girlFriend):
            self.send(sender, 'no girlfriend')
        else:
            self.asker = sender
            self.send(self.girlFriend, 'Best Friend Says')
    elif (sender == self.girlFriend):
        if self.asker:
            self.send(self.asker, ('She says ' + msg))
            self.asker = None
    else:
        super(Pattinson, self).receiveMessage(msg, sender)

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