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

Method transform

IPython/core/inputtransformer2.py:576–596  ·  view source on GitHub ↗

Transform a help command found by the ``find()`` classmethod.

(self, lines)

Source from the content-addressed store, hash-verified

574 return cls(line[ix].start, line[-2].start)
575
576 def transform(self, lines):
577 """Transform a help command found by the ``find()`` classmethod.
578 """
579
580 piece = "".join(lines[self.start_line : self.q_line + 1])
581 indent, content = piece[: self.start_col], piece[self.start_col :]
582 lines_before = lines[: self.start_line]
583 lines_after = lines[self.q_line + 1 :]
584
585 m = _help_end_re.search(content)
586 if not m:
587 raise SyntaxError(content)
588 assert m is not None, content
589 target = m.group(1)
590 esc = m.group(3)
591
592
593 call = _make_help_call(target, esc)
594 new_line = indent + call + '\n'
595
596 return lines_before + [new_line] + lines_after
597
598def make_tokens_by_line(lines:List[str]):
599 """Tokenize a series of lines and group tokens by line.

Callers 3

test_transform_helpFunction · 0.95
check_transformFunction · 0.45

Calls 3

_make_help_callFunction · 0.85
groupMethod · 0.80
searchMethod · 0.45

Tested by 2

test_transform_helpFunction · 0.76
check_transformFunction · 0.36