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