runs the overridden fn() if fn() returns False, put it on the stack and quit so any other pipes will get it and pass it on, quitting if fn() returns None, don't put anything
(self)
| 24 | pass |
| 25 | |
| 26 | def run(self): |
| 27 | """ |
| 28 | runs the overridden fn() |
| 29 | if fn() returns False, put it on the stack and quit |
| 30 | so any other pipes will get it and pass it on, quitting |
| 31 | if fn() returns None, don't put anything |
| 32 | """ |
| 33 | ret = True |
| 34 | while ret is not False: |
| 35 | if self.input is None: # it's a faucet |
| 36 | ret = self.fn() |
| 37 | elif hasattr(self.input, 'get'): # it's a pipe |
| 38 | ob = self.input.get() |
| 39 | if ob is False: |
| 40 | self.put(ob) |
| 41 | break |
| 42 | ret = self.fn(ob) |
| 43 | if ret is not None: self.put(ret) |