MCPcopy Create free account
hub / github.com/ipython/ipython / flush_transformers

Method flush_transformers

IPython/core/inputsplitter.py:618–647  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

616 pass
617
618 def flush_transformers(self):
619 def _flush(transform, outs):
620 """yield transformed lines
621
622 always strings, never None
623
624 transform: the current transform
625 outs: an iterable of previously transformed inputs.
626 Each may be multiline, which will be passed
627 one line at a time to transform.
628 """
629 for out in outs:
630 for line in out.splitlines():
631 # push one line at a time
632 tmp = transform.push(line)
633 if tmp is not None:
634 yield tmp
635
636 # reset the transform
637 tmp = transform.reset()
638 if tmp is not None:
639 yield tmp
640
641 out = []
642 for t in self.transforms_in_use:
643 out = _flush(t, out)
644
645 out = list(out)
646 if out:
647 self._store('\n'.join(out))
648
649 def raw_reset(self):
650 """Return raw input only and perform a full reset.

Callers 2

source_resetMethod · 0.95
transform_cellMethod · 0.95

Calls 1

_storeMethod · 0.80

Tested by

no test coverage detected