Skip to content

Commit

Permalink
Remove Circuit for refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Kotone Itaya committed Jul 18, 2018
1 parent ef8a92a commit 3466ccc
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 34 deletions.
2 changes: 0 additions & 2 deletions 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
17 changes: 0 additions & 17 deletions pybrica/circuit.py

This file was deleted.

18 changes: 3 additions & 15 deletions pybrica/scheduler.py
Expand Up @@ -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,
Expand Down Expand Up @@ -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()

0 comments on commit 3466ccc

Please sign in to comment.