# Path: wallace/nodes.py
# class Agent(Node):
# class ReplicatorAgent(Agent):
# class Source(Node):
# class RandomBinaryStringSource(Source):
# class Environment(Node):
#     def fitness(self):
#     def fitness(self, fitness):
#     def fitness(self):
#     def update(self, infos):
#     def _what(self):
#     def create_information(self):
#     def _info_type(self):
#     def _contents(self):
#     def receive(self, what):
#     def _contents(self):
#     def state(self, time=None):
#     def _what(self):
# 
# Path: wallace/information.py
# class Gene(Info):
# class Meme(Info):
# class State(Info):
# 
# Path: wallace/db.py
# def sessions_scope(local_session, commit=False):
# def scoped_session_decorator(func):
#     def wrapper(*args, **kwargs):
# def init_db(drop_all=False):
# 
# Path: wallace/models.py
# DATETIME_FMT = "%Y-%m-%dT%H:%M:%S.%f"
# def timenow():
#     def __init__(self, worker_id, assignment_id, hit_id, mode):
#     def __json__(self):
#     def nodes(self, type=None, failed=False):
#     def questions(self, type=None):
#     def infos(self, type=None, failed=False):
#     def fail(self):
#     def __init__(self, participant, question, response, number):
#     def fail(self):
#     def __json__(self):
#     def __repr__(self):
#     def __json__(self):
#     def nodes(self, type=None, failed=False, participant_id=None):
#     def size(self, type=None, failed=False):
#     def infos(self, type=None, failed=False):
#     def transmissions(self, status="all", failed=False):
#     def transformations(self, type=None, failed=False):
#     def latest_transmission_recipient(self):
#     def vectors(self, failed=False):
#     def add_node(self, node):
#     def fail(self):
#     def calculate_full(self):
#     def print_verbose(self):
#     def __init__(self, network, participant=None):
#     def __repr__(self):
#     def __json__(self):
#     def vectors(self, direction="all", failed=False):
#     def neighbors(self, type=None, direction="to", failed=None):
#     def is_connected(self, whom, direction="to", failed=None):
#     def infos(self, type=None, failed=False):
#     def received_infos(self, type=None, failed=None):
#     def transmissions(self, direction="outgoing", status="all", failed=False):
#     def transformations(self, type=None, failed=False):
#     def fail(self):
#     def connect(self, whom, direction="to"):
#     def flatten(self, l):
#     def transmit(self, what=None, to_whom=None):
#     def _what(self):
#     def _to_whom(self):
#     def receive(self, what=None):
#     def update(self, infos):
#     def replicate(self, info_in):
#     def mutate(self, info_in):
#     def __init__(self, origin, destination):
#     def __repr__(self):
#     def __json__(self):
#     def transmissions(self, status="all"):
#     def fail(self):
#     def __init__(self, origin, contents=None):
#     def _write_once(self, key, value):
#     def __repr__(self):
#     def __json__(self):
#     def fail(self):
#     def transmissions(self, status="all"):
#     def transformations(self, relationship="all"):
#     def _mutated_contents(self):
#     def __init__(self, vector, info):
#     def mark_received(self):
#     def __repr__(self):
#     def __json__(self):
#     def fail(self):
#     def __repr__(self):
#     def __init__(self, info_in, info_out):
#     def __json__(self):
#     def fail(self):
# class SharedMixin(object):
# class Participant(Base, SharedMixin):
# class Question(Base, SharedMixin):
# class Network(Base, SharedMixin):
# class Node(Base, SharedMixin):
# class Vector(Base, SharedMixin):
# class Info(Base, SharedMixin):
# class Transmission(Base, SharedMixin):
# class Transformation(Base, SharedMixin):
# class Notification(Base, SharedMixin):
# 
# Path: wallace/information.py
# class Meme(Info):
#     """A meme."""
# 
#     __mapper_args__ = {
#         "polymorphic_identity": "meme"
#     }
# 
# class Gene(Info):
#     """A gene."""
# 
#     __mapper_args__ = {
#         "polymorphic_identity": "gene"
#     }


from wallace import nodes, information, db, models
from wallace.information import Meme, Gene
from nose.tools import raises
        agent1 = nodes.ReplicatorAgent(network=net)
        agent2 = nodes.ReplicatorAgent(network=net)
        agent3 = nodes.ReplicatorAgent(network=net)

        agent1.connect(direction="to", whom=agent2)
        agent1.connect(direction="to", whom=agent3)
        info = models.Info(origin=agent1, contents="foo")

        agent1.transmit(what=models.Info, to_whom=nodes.Agent)

        agent2.receive()
        agent3.receive()

        assert agent1.infos()[0].contents == agent2.infos()[0].contents
        assert agent1.infos()[0].contents == agent3.infos()[0].contents
        assert agent1.infos()[0].id != agent2.infos()[0].id != agent3.infos()[0].id

        transmissions = info.transmissions()
        assert len(transmissions) == 2

    def test_transmit_selector_default(self):
        net = models.Network()
        self.db.add(net)
        # Create a network of two biological nodes.
        agent1 = nodes.ReplicatorAgent(network=net)
        agent2 = nodes.ReplicatorAgent(network=net)

        agent1.connect(direction="to", whom=agent2)

        information.Meme(origin=agent1, contents="foo")

# Path: wallace/nodes.py
# class Agent(Node):
# class ReplicatorAgent(Agent):
# class Source(Node):
# class RandomBinaryStringSource(Source):
# class Environment(Node):
#     def fitness(self):
#     def fitness(self, fitness):
#     def fitness(self):
#     def update(self, infos):
#     def _what(self):
#     def create_information(self):
#     def _info_type(self):
#     def _contents(self):
#     def receive(self, what):
#     def _contents(self):
#     def state(self, time=None):
#     def _what(self):
# 
# Path: wallace/information.py
# class Gene(Info):
# class Meme(Info):
# class State(Info):
# 
# Path: wallace/db.py
# def sessions_scope(local_session, commit=False):
# def scoped_session_decorator(func):
#     def wrapper(*args, **kwargs):
# def init_db(drop_all=False):
# 
# Path: wallace/models.py
# DATETIME_FMT = "%Y-%m-%dT%H:%M:%S.%f"
# def timenow():
#     def __init__(self, worker_id, assignment_id, hit_id, mode):
#     def __json__(self):
#     def nodes(self, type=None, failed=False):
#     def questions(self, type=None):
#     def infos(self, type=None, failed=False):
#     def fail(self):
#     def __init__(self, participant, question, response, number):
#     def fail(self):
#     def __json__(self):
#     def __repr__(self):
#     def __json__(self):
#     def nodes(self, type=None, failed=False, participant_id=None):
#     def size(self, type=None, failed=False):
#     def infos(self, type=None, failed=False):
#     def transmissions(self, status="all", failed=False):
#     def transformations(self, type=None, failed=False):
#     def latest_transmission_recipient(self):
#     def vectors(self, failed=False):
#     def add_node(self, node):
#     def fail(self):
#     def calculate_full(self):
#     def print_verbose(self):
#     def __init__(self, network, participant=None):
#     def __repr__(self):
#     def __json__(self):
#     def vectors(self, direction="all", failed=False):
#     def neighbors(self, type=None, direction="to", failed=None):
#     def is_connected(self, whom, direction="to", failed=None):
#     def infos(self, type=None, failed=False):
#     def received_infos(self, type=None, failed=None):
#     def transmissions(self, direction="outgoing", status="all", failed=False):
#     def transformations(self, type=None, failed=False):
#     def fail(self):
#     def connect(self, whom, direction="to"):
#     def flatten(self, l):
#     def transmit(self, what=None, to_whom=None):
#     def _what(self):
#     def _to_whom(self):
#     def receive(self, what=None):
#     def update(self, infos):
#     def replicate(self, info_in):
#     def mutate(self, info_in):
#     def __init__(self, origin, destination):
#     def __repr__(self):
#     def __json__(self):
#     def transmissions(self, status="all"):
#     def fail(self):
#     def __init__(self, origin, contents=None):
#     def _write_once(self, key, value):
#     def __repr__(self):
#     def __json__(self):
#     def fail(self):
#     def transmissions(self, status="all"):
#     def transformations(self, relationship="all"):
#     def _mutated_contents(self):
#     def __init__(self, vector, info):
#     def mark_received(self):
#     def __repr__(self):
#     def __json__(self):
#     def fail(self):
#     def __repr__(self):
#     def __init__(self, info_in, info_out):
#     def __json__(self):
#     def fail(self):
# class SharedMixin(object):
# class Participant(Base, SharedMixin):
# class Question(Base, SharedMixin):
# class Network(Base, SharedMixin):
# class Node(Base, SharedMixin):
# class Vector(Base, SharedMixin):
# class Info(Base, SharedMixin):
# class Transmission(Base, SharedMixin):
# class Transformation(Base, SharedMixin):
# class Notification(Base, SharedMixin):
# 
# Path: wallace/information.py
# class Meme(Info):
#     """A meme."""
# 
#     __mapper_args__ = {
#         "polymorphic_identity": "meme"
#     }
# 
# class Gene(Info):
#     """A gene."""
# 
#     __mapper_args__ = {
#         "polymorphic_identity": "gene"
#     }


# Path: tests/test_agents.py
from wallace import nodes, information, db, models
from wallace.information import Meme, Gene
from nose.tools import raises

        agent1 = nodes.ReplicatorAgent(network=net)
        agent2 = nodes.ReplicatorAgent(network=net)
        agent3 = nodes.ReplicatorAgent(network=net)

        agent1.connect(direction="to", whom=agent2)
        agent1.connect(direction="to", whom=agent3)
        info = models.Info(origin=agent1, contents="foo")

        agent1.transmit(what=models.Info, to_whom=nodes.Agent)

        agent2.receive()
        agent3.receive()

        assert agent1.infos()[0].contents == agent2.infos()[0].contents
        assert agent1.infos()[0].contents == agent3.infos()[0].contents
        assert agent1.infos()[0].id != agent2.infos()[0].id != agent3.infos()[0].id

        transmissions = info.transmissions()
        assert len(transmissions) == 2

    def test_transmit_selector_default(self):
        net = models.Network()
        self.db.add(net)
        # Create a network of two biological nodes.
        agent1 = nodes.ReplicatorAgent(network=net)
        agent2 = nodes.ReplicatorAgent(network=net)

        agent1.connect(direction="to", whom=agent2)

        information.Meme(origin=agent1, contents="foo")

        information.Gene(origin=agent1, contents="bar")