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

Method transform

IPython/core/inputtransformer2.py:385–408  ·  view source on GitHub ↗

Transform an escaped line found by the ``find()`` classmethod.

(self, lines)

Source from the content-addressed store, hash-verified

383 return cls(line[ix].start)
384
385 def transform(self, lines):
386 """Transform an escaped line found by the ``find()`` classmethod.
387 """
388 start_line, start_col = self.start_line, self.start_col
389
390 indent = lines[start_line][:start_col]
391 end_line = find_end_of_continued_line(lines, start_line)
392 line = assemble_continued_line(lines, (start_line, start_col), end_line)
393
394 if len(line) > 1 and line[:2] in ESCAPE_DOUBLES:
395 escape, content = line[:2], line[2:]
396 else:
397 escape, content = line[:1], line[1:]
398
399 if escape in tr:
400 call = tr[escape](content)
401 else:
402 call = ''
403
404 lines_before = lines[:start_line]
405 new_line = indent + call + '\n'
406 lines_after = lines[end_line + 1:]
407
408 return lines_before + [new_line] + lines_after
409
410_help_end_re = re.compile(r"""(%{0,2}
411 (?!\d)[\w*]+ # Variable name

Callers

nothing calls this directly

Calls 2

assemble_continued_lineFunction · 0.85

Tested by

no test coverage detected