예제 #1
0
 def insert_data(self, receiver, data, wm_only=False):
     msg = KQMLPerformative('insert')
     msg.set('sender', self.name)
     msg.set('receiver', receiver)
     if wm_only:
         msg.append(':wm-only?')
     msg.set('content', listify(data))
     self.connect(self.host, self.port)
     self.send(msg)
예제 #2
0
    def insert_data(self, receiver, data, wm_only=False):
        """Takes the data input by the user and processes it into an insert
        message which is subsequently sent off to Companions.

        Arguments:
            receiver {str} -- name of the receiver
            data {[type]} -- anything that can be listified

        Keyword Arguments:
            wm_only {bool} -- whether or not this should only be inserted into
                              the working memory (default: {False})
        """
        msg = KQMLPerformative('insert')
        msg.set('sender', self.name)
        msg.set('receiver', receiver)
        if wm_only:
            msg.append(':wm-only?')
        msg.set('content', listify(data))
        # pylint: disable=no-member
        # pylint was unable to pick up on the host and port variables being in
        # a defaults dict which is then used to do __setattr__ with the key
        # value pairs from the dict.
        self.connect(self.host, self.port)
        self.send(msg)