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

Method transform_cell

IPython/core/inputtransformer2.py:585–594  ·  view source on GitHub ↗

Transforms a cell of input code

(self, cell: str)

Source from the content-addressed store, hash-verified

583 "%d iterations. Aborting." % TRANSFORM_LOOP_LIMIT)
584
585 def transform_cell(self, cell: str) -> str:
586 """Transforms a cell of input code"""
587 if not cell.endswith('\n'):
588 cell += '\n' # Ensure the cell has a trailing newline
589 lines = cell.splitlines(keepends=True)
590 for transform in self.cleanup_transforms + self.line_transforms:
591 lines = transform(lines)
592
593 lines = self.do_token_transforms(lines)
594 return ''.join(lines)
595
596 def check_complete(self, cell: str):
597 """Return whether a block of code is ready to execute, or should be continued

Callers 1

Calls 2

do_token_transformsMethod · 0.95
transformFunction · 0.85

Tested by 1