MCPcopy Index your code
hub / github.com/ipython/ipython / transform_cell

Method transform_cell

IPython/core/inputtransformer2.py:725–734  ·  view source on GitHub ↗

Transforms a cell of input code

(self, cell: str)

Source from the content-addressed store, hash-verified

723 "%d iterations. Aborting." % TRANSFORM_LOOP_LIMIT)
724
725 def transform_cell(self, cell: str) -> str:
726 """Transforms a cell of input code"""
727 if not cell.endswith('\n'):
728 cell += '\n' # Ensure the cell has a trailing newline
729 lines = cell.splitlines(keepends=True)
730 for transform in self.cleanup_transforms + self.line_transforms:
731 lines = transform(lines)
732
733 lines = self.do_token_transforms(lines)
734 return ''.join(lines)
735
736 def check_complete(self, cell: str):
737 """Return whether a block of code is ready to execute, or should be continued

Callers 1

Calls 1

do_token_transformsMethod · 0.95

Tested by 1