Core seems ok
This commit is contained in:
parent
5909db187f
commit
8f393c8806
@ -11,6 +11,7 @@
|
|||||||
from Input import Input
|
from Input import Input
|
||||||
from Output import Output
|
from Output import Output
|
||||||
|
|
||||||
class Filter(Input, Output):
|
class Filter(Output, Input):
|
||||||
|
"""Output should be first"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__('Filter')
|
super().__init__('Filter')
|
||||||
|
|||||||
@ -18,5 +18,5 @@ class Input(Node):
|
|||||||
def register(self, output):
|
def register(self, output):
|
||||||
self.outputs.append(output)
|
self.outputs.append(output)
|
||||||
|
|
||||||
def run(self):
|
def _run(self):
|
||||||
print('IMA INPUT N I RUNIN')
|
print('I RUN ADSAOADIQJOWDOASJDOQIJWDOIJQOWIDJO')
|
||||||
|
|||||||
@ -17,7 +17,7 @@ class Node:
|
|||||||
return ("Node:{}".format(self.name))
|
return ("Node:{}".format(self.name))
|
||||||
|
|
||||||
def _run(self):
|
def _run(self):
|
||||||
raise NotImplementedError('This method is virtual')
|
raise NotImplementedError('{} should override _run()'.format(self))
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
return self._run()
|
return self._run()
|
||||||
|
|||||||
@ -34,4 +34,9 @@ class Output(Node):
|
|||||||
def _process(self, data):
|
def _process(self, data):
|
||||||
raise NotImplementedError('{} should override _process()'.format(self))
|
raise NotImplementedError('{} should override _process()'.format(self))
|
||||||
|
|
||||||
|
def _run(self):
|
||||||
|
if self.input is None:
|
||||||
|
raise RuntimeError('{} do not have an input'.format(self))
|
||||||
|
return self.input.run()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -11,17 +11,22 @@
|
|||||||
from Node import Node
|
from Node import Node
|
||||||
from Filter import Filter
|
from Filter import Filter
|
||||||
from Input import Input
|
from Input import Input
|
||||||
|
from Output import Output
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
i = Input()
|
||||||
|
o = Output()
|
||||||
n = Filter()
|
n = Filter()
|
||||||
f = Filter()
|
f = Filter()
|
||||||
print(n)
|
print(n)
|
||||||
n.run()
|
#n.run()
|
||||||
print(n.input)
|
print(n.input)
|
||||||
|
f.input = i
|
||||||
n.input = f
|
n.input = f
|
||||||
|
o.input = n
|
||||||
|
o.run()
|
||||||
print(n.input)
|
print(n.input)
|
||||||
print(f.outputs)
|
print(f.outputs)
|
||||||
f.process(None)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user