diff --git a/pybrica/__init__.py b/pybrica/__init__.py index 632d9ad..31199eb 100644 --- a/pybrica/__init__.py +++ b/pybrica/__init__.py @@ -1,9 +1,7 @@ from pybrica import messager from pybrica import component -from pybrica import circuit from pybrica import scheduler from pybrica.messager import Messager from pybrica.component import Component -from pybrica.circuit import Circuit from pybrica.scheduler import Scheduler diff --git a/pybrica/circuit.py b/pybrica/circuit.py deleted file mode 100644 index 277f725..0000000 --- a/pybrica/circuit.py +++ /dev/null @@ -1,17 +0,0 @@ -class Circuit(object): - def __init__(self, **components): - self.components = components - self.in_ports = [] - self.out_port = None - - def form(self, inputs, output): - targets = [self.components[key] for key in inputs] - self.components[output].connect(targets) - return self - - def expose(self, inputs, output): - self.in_ports = [] - for key in inputs: - self.in_ports += self.components[key].in_ports - self.out_port = self.components[output].out_port - return self diff --git a/pybrica/scheduler.py b/pybrica/scheduler.py index c976b36..766f101 100644 --- a/pybrica/scheduler.py +++ b/pybrica/scheduler.py @@ -10,12 +10,11 @@ def __init__(self, time, component, fire=True): def __lt__(self, other): return self.time < other.time - def __init__(self, circuit): - self.circuit = circuit + def __init__(self, *components): self.event_queue = queue.PriorityQueue() - for name in circuit.components: - component = circuit.components[name] + for component in components: + component = components[name] self.event_queue.put(Scheduler.Event( component.offset, component, @@ -49,14 +48,3 @@ def next(self): for component in awake: component.fire() - - - def __call__(self, *args): - assert(len(args) == len(self.circuit.in_ports)) - - for i, arg in enumerate(args): - self.circuit.in_ports[i].send(arg) - - self.next() - - return self.circuit.out_port.recv()