/usr/share/pyshared/bimdp/nodes/miscnodes.py is in python-mdp 3.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | from bimdp import BiNode, MSG_ID_SEP
from bimdp.nodes import IdentityBiNode
class SenderBiNode(IdentityBiNode):
"""Sends the incoming x data to another node via bi_message."""
def __init__(self, recipient_id=None, **kwargs):
"""Initialize the internal variables.
recipient_id -- None or the id for the data recipient.
"""
super(SenderBiNode, self).__init__(**kwargs)
self._recipient_id = recipient_id
def _execute(self, x, no_x=None):
"""Add msg_x to the message (adressed to a target if defined)."""
msg = dict()
if self._recipient_id:
msg[self._recipient_id + MSG_ID_SEP + "msg_x"] = x
else:
msg["msg_x"] = x
if no_x:
x = None
return x, msg
|