Show More
@@ -495,35 +495,27 b' class IPythonInputSplitter(InputSplitter):' | |||||
495 | pass |
|
495 | pass | |
496 |
|
496 | |||
497 | def flush_transformers(self): |
|
497 | def flush_transformers(self): | |
498 | def _flush(transform, out): |
|
498 | def _flush(transform, outs): | |
499 | """yield transformed lines |
|
499 | """yield transformed lines | |
500 |
|
500 | |||
501 | always strings, never None |
|
501 | always strings, never None | |
502 |
|
502 | |||
503 | transform: the current transform |
|
503 | transform: the current transform | |
504 | out: an iterable of previously transformed inputs. |
|
504 | outs: an iterable of previously transformed inputs. | |
505 | Each may be multiline, which will be passed |
|
505 | Each may be multiline, which will be passed | |
506 | one line at a time to transform. |
|
506 | one line at a time to transform. | |
507 | """ |
|
507 | """ | |
508 |
|
|
508 | for out in outs: | |
509 | for out in out: |
|
|||
510 | anything = True |
|
|||
511 | tmp = None |
|
|||
512 | for line in out.splitlines(): |
|
509 | for line in out.splitlines(): | |
513 | # push one line at a time |
|
510 | # push one line at a time | |
514 | tmp = transform.push(line) |
|
511 | tmp = transform.push(line) | |
515 | if tmp is not None: |
|
512 | if tmp is not None: | |
516 | yield tmp |
|
513 | yield tmp | |
517 | if tmp is None: |
|
514 | ||
518 | # transformer is still consuming, reset |
|
515 | # reset the transform | |
519 |
|
|
516 | tmp = transform.reset() | |
520 |
|
|
517 | if tmp is not None: | |
521 |
|
|
518 | yield tmp | |
522 | if not anything: |
|
|||
523 | # nothing was pushed, reset |
|
|||
524 | tmp = transform.reset() |
|
|||
525 | if tmp is not None: |
|
|||
526 | yield tmp |
|
|||
527 |
|
519 | |||
528 | out = [] |
|
520 | out = [] | |
529 | for t in self.transforms_in_use: |
|
521 | for t in self.transforms_in_use: |
General Comments 0
You need to be logged in to leave comments.
Login now