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

Method _transform_line

IPython/core/inputsplitter.py:729–771  ·  view source on GitHub ↗

Push a line of input code through the various transformers. Returns any output from the transformers, or None if a transformer is accumulating lines. Sets self.transformer_accumulating as a side effect.

(self, line)

Source from the content-addressed store, hash-verified

727 return False
728
729 def _transform_line(self, line):
730 """Push a line of input code through the various transformers.
731
732 Returns any output from the transformers, or None if a transformer
733 is accumulating lines.
734
735 Sets self.transformer_accumulating as a side effect.
736 """
737 def _accumulating(dbg):
738 #print(dbg)
739 self.transformer_accumulating = True
740 return None
741
742 for transformer in self.physical_line_transforms:
743 line = transformer.push(line)
744 if line is None:
745 return _accumulating(transformer)
746
747 if not self.within_python_line:
748 line = self.assemble_logical_lines.push(line)
749 if line is None:
750 return _accumulating('acc logical line')
751
752 for transformer in self.logical_line_transforms:
753 line = transformer.push(line)
754 if line is None:
755 return _accumulating(transformer)
756
757 line = self.assemble_python_lines.push(line)
758 if line is None:
759 self.within_python_line = True
760 return _accumulating('acc python line')
761 else:
762 self.within_python_line = False
763
764 for transformer in self.python_line_transforms:
765 line = transformer.push(line)
766 if line is None:
767 return _accumulating(transformer)
768
769 #print("transformers clear") #debug
770 self.transformer_accumulating = False
771 return line
772

Callers 1

pushMethod · 0.95

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected